Skip to content

ci(gha): Migrate Claude inference to unprotected roles - #300

Closed
zahin-mohammad wants to merge 1 commit into
masterfrom
fix/ai-inference-workflows
Closed

zahin-mohammad wants to merge 1 commit into
masterfrom
fix/ai-inference-workflows

Conversation

@zahin-mohammad

Copy link
Copy Markdown
Contributor

This restores Claude's Amazon Bedrock model access through the unprotected repository role, after infra commit 0de92c9 deliberately removed that access from protected roles on November 5. It follows identity-service #1144 and github-ai-assistant #167.

Changes

  • Use ai-inference and exchange the workflow identity through OpenID Connect (OIDC) for 199765120567:role/advanced-wallets-iam-unprotected, then assume 168000258654:role/BedrockInferenceRole in us-west-2. Both credential steps use aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd (v6.3.0); the second enables role chaining and skips session tagging. Remove static AWS secret bindings and manual credential outputs. (workflow)
  • Preserve the existing Sonnet 5.5 inference profile, Claude action revision, review prompt and ten-minute inference-job timeout. (workflow)
  • Check current repository write, maintain or admin access for the commenter, original workflow actor and rerun actor in a separate read-only job, before the inference job can receive cloud credentials. Classify the comment once and fail closed on missing identities, denied access or lookup errors. (authorization policy)
  • Check out the default branch without persisting checkout credentials. Ignore project settings, disable hooks and skills, and load only the action-provided Model Context Protocol (MCP) tool servers. Custom requests retain file editing and use GitHub's application programming interface (API) commit path with shell tools unavailable. Reset the Git remote after the action to remove its temporary embedded token. (workflow, upstream API-commit tool)

Behavior changes for this public repository: invoke Claude from a conversation comment; inline review comments no longer trigger it. Fork pull requests support bare @claude reviews only. Custom pull-request commands require an existing head branch in this repository. Bare mentions on ordinary issues are skipped. Custom requests can edit and commit files, but cannot run builds, tests or repository scripts. (trigger, classification and repository checks, tool restrictions)

Validation

59 local regression checks passed, covering all three actor identities, permission levels, malformed events, classification, fork handling, lookup failures, credential boundaries and tool restrictions. The pull-request workflow runs these checks with read-only permissions. (tests, test job)

Local commands and actual output

Location: bound advanced-wallets worktree, branch fix/ai-inference-workflows.

$ node --test --test-reporter=tap .github/scripts/authorize-claude.test.cjs | sed -n '/^# tests/,/^# todo/p'
# tests 59
# suites 0
# pass 59
# fail 0
# cancelled 0
# skipped 0
# todo 0

$ /tmp/advanced-wallets-ai-audit/actionlint .github/workflows/claude-code.yaml .github/workflows/pull_request.yaml
$ printf 'actionlint exit: %s\n' "$?"
actionlint exit: 0

The actionlint binary was v1.7.12, downloaded from its release and checked against the release checksum. All-workflow lint also passed after excluding two stale action-catalog diagnostics about client-id/app-id in the untouched API-audit workflow. The current referenced action accepts client-id and makes app-id optional.

No live AWS assumption, model inference, or workflow dispatch was performed. These checks verify local policy and workflow structure, not deployed cloud behavior.

Environment prerequisites and residual risk

VERIFIED: GitHub reports this repository as public. The ai-inference environment exists with no approval rules or branch restrictions; it is not an approval barrier. The repository uses the default, name-based OIDC subject. The API observations below are from November 11, 2026.

Read-only GitHub verification

Location: same bound worktree.

$ gh api repos/BitGo/advanced-wallets --jq '{visibility,default_branch}'
{"default_branch":"master","visibility":"public"}
$ gh api repos/BitGo/advanced-wallets/environments/ai-inference --jq '{name,protection_rules,deployment_branch_policy}'
{"deployment_branch_policy":null,"name":"ai-inference","protection_rules":[]}
$ gh api repos/BitGo/advanced-wallets/actions/oidc/customization/sub
{"use_default":true,"use_immutable_subject":false,"sub_claim_prefix":"repo:BitGo/advanced-wallets"}

VERIFIED IN SOURCE: the unprotected role trusts repository subjects and retains inference access; its policies also include CodeArtifact package access and Simple Queue Service (SQS) queue access. It is not an inference-only role. The protected role remains unchanged. (repository policies, trust policy)

ASSUMED / TO VERIFY BEFORE LIVE USE: deployed AWS Identity and Access Management (IAM) trust must accept the ai-inference workflow identity, permit the second role assumption, and allow the unchanged model profile. Deployed IAM state was not independently verified. The environment and authorization policy must be present on the default branch before this comment workflow is used.

Prompt injection means malicious instructions embedded in reviewed content. Authorization and tool restrictions reduce exposure; they do not prove content is safe. The credentialed job still has id-token: write, temporary repository-scoped GitHub write permissions, and model credentials. The upstream action can temporarily embed its GitHub token in the remote URL while running; the final cleanup removes it. Malicious content may still influence comments, proposed edits or attempts to disclose data through permitted tools. Review generated output before acting on it. (job permissions, upstream credential handling, upstream security guidance)

Ticket: INF-5300

Authorize public-repository comment requests before loading AWS credentials.
Use the ai-inference environment and pinned credential-action role chaining.
Keep the existing model and isolate contributor configuration and execution.

Ticket: INF-5300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant