Skip to content

ci(review): use Anthropic workload identity federation, fall back to the stored key - #449

Merged
ajianaz merged 2 commits into
developfrom
ci/cora-review-wif
Oct 28, 2026
Merged

ajianaz merged 2 commits into
developfrom
ci/cora-review-wif

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What

The Cora Review job exchanges its GitHub OIDC token for a short-lived Anthropic access token (workload identity federation) when ANTHROPIC_FEDERATION_RULE_ID, ANTHROPIC_ORGANIZATION_ID, ANTHROPIC_SERVICE_ACCOUNT_ID and ANTHROPIC_WORKSPACE_ID are available. Without them, or when the exchange fails, it uses the CORA_* secrets as before.

Closes #448. Ported from codecoradev/cora-code#700.

Why

A stored API key can leak and does not expire; the exchanged token lives for one job.

Changes

  • .github/workflows/cora-review.yml: id-token: write; an exchange step (continue-on-error, warning only) that keeps the OIDC token in its own shell and exports only the short-lived token; a guard that fails the job when neither federation nor the CORA_* secrets are available; with a federation token, key, base URL (https://api.anthropic.com/v1) and model (ANTHROPIC_MODEL, default claude-opus-5-5) switch together, so the token never goes to CORA_BASE_URL.
  • .github/workflows/anthropic-wif-smoke.yml: manual (workflow_dispatch) check of the exchange and a Bearer call to /v1/chat/completions; prints HTTP statuses only.
  • CONTRIBUTING.md: credential setup, including the numeric-id subject prefix gotcha.

Testing

  • YAML parses; Cora agent review (prepare + finalize): 0 findings, should_block: false.
  • This repository's job runs on pull_request, so this PR's own Cora Review run exercises the new workflow: the federated path if the Anthropic federation rule allows repo:codecoradev@<id>/tole@<id>:pull_request, otherwise the fallback with a warning.

…the stored key (#448)

The Cora Review job exchanges its GitHub OIDC token for a short-lived
Anthropic access token when the four ANTHROPIC_* federation identifiers
are available, and sends it only to api.anthropic.com. Without them, or
when the exchange fails, it uses the CORA_* secrets as before; an empty
secret now fails the job. Adds the manual anthropic-wif-smoke workflow
and documents the setup in CONTRIBUTING.

Ported from codecoradev/cora-code#700.
@ajianaz ajianaz added this to the 0.10.0 milestone Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

A manual run from any branch would need a federation rule that trusts
every branch subject; pinning it to develop lets the rule allow exactly
ref:refs/heads/develop.
@ajianaz

ajianaz commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

On hold until codecoradev/cora-code#701 is fixed. The federation exchange works (run 40462794838 logs Using a short-lived Anthropic access token), but cora 0.19 always sends temperature, which claude-opus-5-5 rejects, so the review ends as "could not complete". Merging now would remove the real Cora verdict from every PR.

@ajianaz
ajianaz marked this pull request as draft October 27, 2026 06:48
@ajianaz
ajianaz marked this pull request as ready for review October 28, 2026 00:35
@ajianaz
ajianaz merged commit a0bfeab into develop Oct 28, 2026
18 checks passed
@ajianaz ajianaz modified the milestones: 0.10.0, 0.9.0 Oct 28, 2026
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.

ci(review): Anthropic workload identity federation for Cora Review

1 participant