fix(security): restrict Claude workflow to trusted author associations#783
Conversation
The claude-code-action requires id-token: write permission to authenticate via OIDC. Without it, the workflow fails with: Error: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable This fix adds the missing permission to the workflow permissions. Fixes workflow run: https://github.com/rjmurillo/ai-agents/actions/runs/20702734101 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
PR Validation ReportNote ✅ Status: PASS Description Validation
QA Validation
⚡ Warnings
Powered by PR Validation workflow |
Changes SummaryThis PR fixes a GitHub Actions workflow failure by adding the id-token: write permission to the Claude workflow. The workflow was failing with an OIDC token error because it was missing the required permission for OIDC authentication with the claude-code-action. Type: bugfix Components Affected: GitHub Actions, Claude Code Assistant Workflow, CI/CD Files Changed
Risk Areas: GitHub Actions workflow permissions (security-sensitive), OIDC authentication flow, CI/CD pipeline reliability Suggestions
Full review in progress... | Powered by diffray |
AI Quality Gate ReviewTip ✅ Final Verdict: PASS WalkthroughThis PR was reviewed by six AI agents in parallel, analyzing different aspects of the changes:
Review Summary
💡 Quick Access: Click on individual agent jobs (e.g., "🔒 security Review", "🧪 qa Review") in the workflow run to see detailed findings and step summaries. Analyst Review DetailsLet me search for open PRs and check the current workflow file to understand the changes. The PR is #783. Let me get the actual diff and review the claude.yml workflow file. Now I have the full context. Let me analyze this PR comprehensively. Let me check the security documentation and setup docs to verify the OIDC requirements. I have enough context now. Let me compile the complete analysis. PR #783 Analysis: Claude Workflow OIDC Permission and Security ImprovementsCode Quality Score
Overall: 4.5/5 Impact Assessment
Findings
Security VerificationVerified against claude-code-action documentation:
Author association guard logic:
This prevents external users from invoking Claude via comments on public issues/PRs. Recommendations
VerdictQA Review DetailsBased on my analysis, I can now provide the QA verdict. QA Review: PR #783AnalysisChanged Files Assessment:
Workflow Changes ReviewThe workflow change is configuration-only (per ADR-006: no logic in workflow YAML):
Security Verification:
Test Coverage AssessmentN/A - WORKFLOW configuration PR Per QA standards: "Files without executable logic do not require tests." The workflow YAML contains no custom logic - it only configures the Documentation Quality
EvidenceQuality Concerns
Regression Risk Assessment
Security Review DetailsSecurity Report: Claude Workflow PRPR Type Classification
Findings
Analysis1. Permissions ReviewAdded permission:
Existing permissions:
2. Author Association Guardif: |
github.event_name == 'issues' ||
github.event_name == 'pull_request_review' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'COLLABORATOR'
3. Action Pinninguses: anthropics/claude-code-action@7145c3e0510bcdbdd29f67cc4a8c1958f1acfa2f
4. Bot Allowlistallowed_bots: "dependabot[bot],renovate[bot],github-actions[bot]"
5. Secret Handlingclaude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
6. Injection Surface
RecommendationsNone. The security improvements in this PR are well-implemented. VerdictDevOps Review DetailsBased on the workflow file I can view, I'll proceed with the DevOps review. DevOps Review: PR #177PR Scope Detection
Review Scope: Full CI/CD review required. Pipeline Impact Assessment
CI/CD Quality Checks
Security AnalysisPermissions Review (Lines 13-17): permissions:
contents: write
issues: write
pull-requests: write
id-token: write
Author Association Guard (Lines 22-27): if: |
github.event_name == 'issues' ||
github.event_name == 'pull_request_review' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'COLLABORATOR'
Bot Allowlist (Line 46): allowed_bots: "dependabot[bot],renovate[bot],github-actions[bot]"
Findings
Template Assessment
Automation OpportunitiesNo automation opportunities identified. This PR addresses a specific bug and security improvement. Recommendations
VerdictArchitect Review DetailsLet me check for existing ADRs related to security, OIDC, or workflow permissions. Now let me check the security steering document for workflow security requirements. I now have sufficient context to provide the architectural review. Architect Review: PR Security Enhancement for Claude WorkflowDesign Quality Assessment
Overall Design Score: 4.4/5 Architectural Concerns
Analysis of Security Guard Logic: The
This is architecturally sound. The Breaking Change Assessment
Technical Debt Analysis
ADR Assessment
Rationale: This change adds permissions and security guards. It does not introduce new architectural patterns, dependencies, or technology choices. The author association guard follows established GitHub Actions security patterns documented in Recommendations
VerdictRoadmap Review DetailsStrategic Alignment Assessment
Feature Completeness
Impact Analysis
Concerns
Recommendations
VerdictRun Details
Powered by AI Quality Gate workflow |
There was a problem hiding this comment.
Pull request overview
This PR fixes a GitHub Actions workflow failure by adding the id-token: write permission required for OIDC authentication in the Claude Code Assistant workflow.
Key Changes
- Added
id-token: writepermission to.github/workflows/claude.ymlto enable OIDC token generation - Created session log documenting the root cause analysis and fix implementation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/claude.yml |
Added id-token: write permission to fix OIDC authentication error when using claude_code_oauth_token |
.agents/sessions/2026-01-04-session-312-claude-workflow-oidc-fix.md |
Session log documenting the workflow failure analysis and fix; contains several documentation issues including session number mismatch and missing content compared to diff |
Review SummaryValidated 3 issues: 2 kept, 1 filtered (1 partially incorrect claim about fork behavior) Issues Found: 2💬 See 2 individual line comment(s) for details. 📋 Full issue list (click to expand)🔴 CRITICAL - Secret exposed in externally-triggerable workflow without repository guardAgent: security Category: security Why this matters: Malicious code in external PRs can exfiltrate secrets through npm postinstall scripts, modified tests, or build scripts. Compromised infrastructure secrets can lead to data breaches, unauthorized deployments, or complete account takeover. File: Description: Workflow can be triggered by external contributors via issue_comment, pull_request_review_comment, issues, and pull_request_review events. The workflow exposes CLAUDE_CODE_OAUTH_TOKEN without any guard checking if the trigger comes from the repository owner. On public repositories or with forked PRs, malicious actors can trigger this workflow and potentially exfiltrate the OAuth token. Suggestion: Add a repository ownership guard to prevent external PR triggers from accessing secrets: 'if: github.event.pull_request.head.repo.full_name == github.repository || github.actor == github.repository_owner' condition to the job, or use environment protection rules requiring approval for external contributors. Confidence: 88% Rule: 🟠 HIGH - Excessive write permissions on externally-triggerable workflowAgent: security Category: security Why this matters: Principle of least privilege limits damage from compromised workflows. File: Description: Workflow grants contents:write, issues:write, pull-requests:write, and id-token:write permissions on a workflow that can be triggered by external contributors. The newly added id-token:write permission (line 17) combined with existing write permissions creates significant attack surface if the claude-code-action is compromised or if there are injection vulnerabilities. Suggestion: Use job-level permissions to restrict write access only to jobs that absolutely require it. If the workflow must respond to external triggers, implement guards like 'if: github.event.pull_request.head.repo.full_name == github.repository' or use environment protection rules. Document why each write permission is necessary for external trigger scenarios. Confidence: 78% Rule: Review ID: |
Restructured session log to meet protocol requirements: - Added Session Info section - Added Protocol Compliance section with required tables - Added Work Log section - Added Session End section with all requirements Fixes session validation failure on PR #783. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Session Protocol Compliance ReportTip ✅ Overall Verdict: PASS All session protocol requirements satisfied. What is Session Protocol?Session logs document agent work sessions and must comply with RFC 2119 requirements:
See .agents/SESSION-PROTOCOL.md for full specification. Compliance Summary
Detailed Validation ResultsClick each session to see the complete validation report with specific requirement failures. 📄 sessions-2026-01-04-session-312-claude-workflow-oidc-fixSession Protocol Validation ReportDate: 2026-01-05 02:09 Session: 2026-01-04-session-312-claude-workflow-oidc-fix.mdStatus: PASSED Validation Results
✨ Zero-Token ValidationThis validation uses deterministic PowerShell script analysis instead of AI:
Powered by Validate-SessionProtocol.ps1 📊 Run Details
Powered by Session Protocol Validator workflow |
Documented PR #783 review session: - No review comments to address - Fixed session-312 validation failure - All CI checks now passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Documented PR #783 review session: - No review comments to address - Fixed session-312 validation failure - All CI checks now passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
202c95c to
b3593d9
Compare
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughUpdated GitHub Actions workflow Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (1)
Comment |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughGitHub Actions workflow adds OIDC token write permission. This allows the workflow to obtain identity tokens from GitHub's OIDC provider for authentication to external services. No logic or control-flow changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (50){.github/workflows/*,*/.githooks/*,Dockerfile}📄 CodeRabbit inference engine (.agents/governance/interviews/security-interview.md)
Files:
{.githooks/**,**/.github/**,**/infrastructure/**,**/config/**,**/*.tf,**/*.yml,**/*.yaml}📄 CodeRabbit inference engine (.agents/metrics/baseline-report.md)
Files:
.github/workflows/*📄 CodeRabbit inference engine (.agents/metrics/dashboard-template.md)
Files:
.github/workflows/*.{yml,yaml}📄 CodeRabbit inference engine (.agents/security/infrastructure-file-patterns.md)
Files:
.github/workflows/*.yml📄 CodeRabbit inference engine (.agents/analysis/pr41-issue-analysis.md)
Files:
.github/workflows/**/*.{yml,yaml}📄 CodeRabbit inference engine (.agents/retrospective/pr-feedback-remediation.md)
Files:
**/.github/workflows/*.{yml,yaml}📄 CodeRabbit inference engine (.agents/skills/ci-runner-preference.md)
Files:
.github/workflows/**📄 CodeRabbit inference engine (.github/instructions/security.instructions.md)
Files:
⚙️ CodeRabbit configuration file
Files:
**/.github/**/*.{yml,yaml,sh,bash}📄 CodeRabbit inference engine (.agents/planning/PR-60/001-pr-60-review-gap-analysis.md)
Files:
.github/workflows/**/*.yml📄 CodeRabbit inference engine (.agents/planning/PR-60/004-pr-60-devops-review.md)
Files:
**/.github/workflows/**/*.yml📄 CodeRabbit inference engine (.agents/planning/PR-60/004-pr-60-implementation-review.md)
Files:
**/.github/workflows/*.yml📄 CodeRabbit inference engine (.agents/planning/PR-60/007-phase-1-detailed-schedule.md)
Files:
**/.github/{scripts,workflows}/*.{sh,yml}📄 CodeRabbit inference engine (.agents/planning/pr-60-focused-plan.md)
Files:
.github/{workflows,scripts}/**/*.{yml,yaml,sh}📄 CodeRabbit inference engine (.agents/planning/pr-60-security-review.md)
Files:
**/.github/{workflows,scripts,prompts}/**📄 CodeRabbit inference engine (.agents/retrospective/2025-12-18-ai-workflow-implementation.md)
Files:
{.github/**/*.sh,.github/workflows/*.yml,.github/actions/**/*.yml}📄 CodeRabbit inference engine (.agents/sessions/2025-12-18-session-04-ai-workflow-debugging.md)
Files:
**/.github/{workflows,actions}/**/*.yml📄 CodeRabbit inference engine (.agents/sessions/2025-12-18-session-13-workflow-lessons.md)
Files:
**/.github/workflows/***.yml📄 CodeRabbit inference engine (.agents/sessions/2025-12-18-session-13-workflow-lessons.md)
Files:
**/.github/workflows/**/*.{yml,yaml}📄 CodeRabbit inference engine (.agents/sessions/2025-12-18-session-19-project-constraints.md)
Files:
{.github/**/*.{sh,yml,yaml},**/*.sh}📄 CodeRabbit inference engine (.agents/sessions/2025-12-18-session-34-pr-60-comment-response.md)
Files:
**/{.github/workflows/*.yml,.github/scripts/*.psm1}📄 CodeRabbit inference engine (.agents/qa/057-pr-222-import-module-standardization.md)
Files:
**/{.github,workflows}/**/*.{yml,yaml}📄 CodeRabbit inference engine (.agents/sessions/2025-12-21-session-58-pr-141.md)
Files:
**/{.github/workflows/*.{yml,yaml},**/*.ps1}📄 CodeRabbit inference engine (.agents/retrospective/2025-12-22-pr-249-comprehensive-retrospective.md)
Files:
{**/.github/workflows/*.yml,**/*.ps1}📄 CodeRabbit inference engine (.agents/sessions/2025-12-22-session-67-pr-249-review-response.md)
Files:
**/.github/workflows/*.{yaml,yml}📄 CodeRabbit inference engine (.agents/sessions/2025-12-22-session-72-pr-249-retrospective.md)
Files:
{**/*.test.{js,ts,ps1},.github/workflows/**/*.{yml,yaml}}📄 CodeRabbit inference engine (.agents/sessions/2025-12-22-session-79-pr-268-review-response.md)
Files:
**/{.github/workflows,ci,tests}/**/*.{yml,yaml,js,ts}📄 CodeRabbit inference engine (.agents/sessions/2025-12-23-session-83-adr-017-quantitative-analysis.md)
Files:
**/.github/**📄 CodeRabbit inference engine (.agents/critique/001-pr365-remediation-critique.md)
Files:
**/{action.yml,.github/workflows/**/*.{yml,yaml}}📄 CodeRabbit inference engine (.agents/sessions/2025-12-23-session-85-pr-310-review.md)
Files:
{.github/workflows/**,**/.github/**,**/branch-protection*,**/.gitpush-rules}📄 CodeRabbit inference engine (.agents/sessions/2025-12-23-session-90-adr-debate-clarification.md)
Files:
{.github/workflows/**/*.yml,.github/workflows/**/*.yaml,**/*aggregate*.ps1}📄 CodeRabbit inference engine (.agents/analysis/ADR-023-related-work-research.md)
Files:
{.github/workflows/**/*.yml,scripts/Invoke-PRMaintenance.ps1}📄 CodeRabbit inference engine (.agents/critique/001-issue-360-bot-loop-prevention-critique.md)
Files:
{.agents/architecture/ADR-*.md,.github/workflows/**/*.yml}📄 CodeRabbit inference engine (.agents/qa/474-adr-numbering-final-verification.md)
Files:
{.githooks/**,.github/workflows/**/*.yml,docs/**/*.md}📄 CodeRabbit inference engine (.agents/qa/474-adr-numbering-final-verification.md)
Files:
**/{.github/workflows/*.{yml,yaml},**/*.psm1}📄 CodeRabbit inference engine (.agents/qa/468-pr-size-resilience-test-report.md)
Files:
{.github/workflows/*.yml,**/*.psm1,**/*.ps1}📄 CodeRabbit inference engine (.agents/sessions/2025-12-28-session-critic-468-review.md)
Files:
.github/**📄 CodeRabbit inference engine (.agents/sessions/2025-12-29-session-96-issue-363-ai-reviewer-evaluation.md)
Files:
.github/workflows/**/*.{yaml,yml}📄 CodeRabbit inference engine (.agents/analysis/agent-skill-conversion-evaluation.md)
Files:
.github/**/*.{ps1,psm1,yml,yaml}📄 CodeRabbit inference engine (.agents/sessions/2025-12-29-session-98-issue-146-skip-tests-xml-powershell.md)
Files:
.github/**/*.{yml,yaml}📄 CodeRabbit inference engine (.agents/sessions/2025-12-29-session-97-issue-163-job-retry.md)
Files:
{.pre-commit-hooks.yaml,.pre-commit-config.yaml,.github/workflows/**/*.{yml,yaml}}📄 CodeRabbit inference engine (.agents/sessions/2025-12-30-session-109-claude-sessions-analysis.md)
Files:
{.git/hooks/**,.githooks/**,**/hooks/**,.github/workflows/**,*.yaml,*.yml}📄 CodeRabbit inference engine (.agents/retrospective/2025-12-31-pr-co-mingling-analysis.md)
Files:
{.github/workflows/**/*.{yml,yaml},**/*.sh,**/*.bash}📄 CodeRabbit inference engine (.agents/architecture/ADR-035-exit-code-standardization.md)
Files:
{.pre-commit-config.yaml,.github/workflows/*.{yml,yaml}}📄 CodeRabbit inference engine (.agents/analysis/session-recommendations-overlap-research.md)
Files:
**/{.github/workflows/*.yml,.gitlab-ci.yml,.circleci/config.yml}📄 CodeRabbit inference engine (.agents/security/SR-036-adr-architecture-review.md)
Files:
{.github/workflows/**/*.{yml,yaml},scripts/**/*.{py,js,ts},**/*.test.{ts,js,py}}📄 CodeRabbit inference engine (.agents/critique/ADR-007-analyst-independent-review.md)
Files:
.github/workflows/**.yml📄 CodeRabbit inference engine (.agents/critique/DESIGN-REVIEW-pr-60-remediation-architecture.md)
Files:
{**/*.sh,**/*.bash,.github/workflows/*.{yml,yaml}}📄 CodeRabbit inference engine (.agents/devops/ci-analysis-pr737-session-validation.md)
Files:
**/.github/workflows/**📄 CodeRabbit inference engine (.agents/planning/slashcommandcreator-implementation-plan.md)
Files:
.github/workflows/claude.yml📄 CodeRabbit inference engine (.agents/sessions/2026-01-04-session-307-claude-code-action.md)
Files:
🔍 Remote MCP DeepWiki, GitHub CopilotPerfect! I now have comprehensive information about the Claude Code Action and OIDC authentication. Let me compile the findings for PR review: Summary of Gathered ContextOIDC Authentication and
|
Removed `id-token: write` permission from `.github/workflows/claude.yml` as the claude-code-action does not use OIDC authentication. Retained minimum required permissions per documentation: - `contents: write` - Required for creating branches and commits - `issues: write` - Required for issue operations - `pull-requests: write` - Required for PR operations Created security memory `security-011-workflow-least-privilege` to document the least privilege pattern for workflow permissions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Review Triage RequiredNote Priority: NORMAL - Human approval required before bot responds Review Summary
Next Steps
Powered by PR Maintenance workflow - Add triage:approved label |
- Add canonical Session End table to session-135 to fix CI validation - Create session-314 log for PR #783 review response - All 5 review threads addressed and resolved 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
After investigation with claude-code-action documentation: - id-token: write IS required for OIDC GitHub token exchange - Previous removal in commit 3490732 was based on incorrect analysis - Security memory corrected to reflect accurate requirements The action uses OIDC to obtain a GitHub App token for API calls. Without id-token: write, it fails with: "Could not fetch an OIDC token." Security improvements from prior commits retained: - Author association guard for comment triggers - Explicit bot allowlist (no wildcards) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
| if: | | ||
| github.event_name == 'issues' || | ||
| github.event_name == 'pull_request_review' || | ||
| github.event.comment.author_association == 'MEMBER' || | ||
| github.event.comment.author_association == 'OWNER' || | ||
| github.event.comment.author_association == 'COLLABORATOR' |
There was a problem hiding this comment.
There's a subtle logic issue with the conditional. When the event is issue_comment or pull_request_review_comment (the comment-triggered events), github.event.comment.author_association will be evaluated. However, for the safe events (issues and pull_request_review), the condition short-circuits to true before checking github.event.comment, which may not exist. This works correctly, but if the order were reversed (checking author_association first), it would fail on non-comment events. The current implementation is safe, but a comment explaining this ordering dependency would improve maintainability.
| 2. **Remove `id-token: write`**: No OIDC authentication used by claude-code-action | ||
| 3. **Keep `issues: write` and `pull-requests: write`**: Required for core functionality | ||
|
|
||
| ## Outcomes | ||
|
|
||
| ### Changes Made | ||
|
|
||
| 1. **Removed `id-token: write` permission** from `.github/workflows/claude.yml` | ||
| - Not required by claude-code-action (no OIDC authentication) | ||
| - Reduces attack surface by removing unnecessary token access |
There was a problem hiding this comment.
The session logs show conflicting information about whether id-token: write is required. Session 135 (lines 67, 75) states "No OIDC authentication used by claude-code-action" and documents that it was removed, while Session 314 (lines 53, 59-60) states the opposite - that it IS required per action documentation and was re-added. This creates confusion about the actual requirement and the evolution of the PR.
| - `id-token: write` - **REQUIRED** for OIDC authentication to exchange for GitHub App token | ||
|
|
||
| **NOT Required:** | ||
| - Broader permissions like `write-all` or `admin` | ||
|
|
||
| **Note on OIDC:** The `id-token: write` permission is required because the action uses OIDC to obtain a GitHub App token for API calls. Without this permission, the action fails with: "Could not fetch an OIDC token." |
There was a problem hiding this comment.
The security memory incorrectly states that id-token: write is not required by claude-code-action (line 24). According to Session 314 documentation and the PR description, this permission IS required for OIDC authentication to exchange for a GitHub App token. This incorrect memory could mislead future work on similar workflows.
| ## Security Mitigation | ||
|
|
||
| When using `id-token: write` with externally-triggerable events, add author association guards: | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| claude-response: | ||
| if: | | ||
| github.event_name == 'issues' || | ||
| github.event_name == 'pull_request_review' || | ||
| github.event.comment.author_association == 'MEMBER' || | ||
| github.event.comment.author_association == 'OWNER' || | ||
| github.event.comment.author_association == 'COLLABORATOR' | ||
| ``` | ||
|
|
||
| This prevents external contributors from triggering workflows that access secrets. |
There was a problem hiding this comment.
The mitigations section in this security memory references id-token: write and suggests adding author association guards when using it, which is correct. However, this conflicts with the earlier statement (line 24) that says this permission is not required. The memory needs to be internally consistent about whether this permission is needed.
Add explicit repository context to all gh CLI commands in ai-review action
to prevent analyzing wrong PR when multiple workflows run concurrently.
Changes:
- Add GITHUB_REPOSITORY env var to Build context step
- Add --repo flag to all 5 gh pr diff/view commands
- Isolate temp files with PR number: /tmp/ai-review-context-pr${PR_NUMBER}.txt
- Add PR validation logging for audit trail
- Add PR number to context header for AI self-validation
This fixes false FAIL verdicts where analyst analyzed PR #783 instead
of PR #782 due to ambiguous gh CLI context.
Fixes #803
Co-authored-by: Richard Murillo <rjmurillo@users.noreply.github.com>
Pull Request
Summary
Fixes the Claude Code Assistant workflow OIDC authentication error AND implements security improvements.
Problem
The workflow was failing with:
Root Cause
The
claude-code-actionrequiresid-token: writepermission for OIDC authentication to exchange for a GitHub App token. This permission was missing.Solution
id-token: writepermission - Required for OIDC authenticationChanges
File:
.github/workflows/claude.ymlPermissions
Security Guard
Type of Change
References
🤖 Generated with Claude Code