Skip to content

[CRCR] Add multi-issuer OIDC support to jwt_helper for Buildkite - #8453

Draft
subinz1 wants to merge 8 commits into
mainfrom
crcr-buildkite-oidc
Draft

[CRCR] Add multi-issuer OIDC support to jwt_helper for Buildkite#8453
subinz1 wants to merge 8 commits into
mainfrom
crcr-buildkite-oidc

Conversation

@subinz1

@subinz1 subinz1 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds multi-issuer OIDC support to the CRCR relay, enabling downstream repos running on any supported CI platform (currently GitHub Actions + Buildkite) to authenticate callbacks.

Architecture

ci_providers.yml (in test-infra)        allowlist.yml (in pytorch/pytorch)
    ┌─────────────────────┐                ┌─────────────────┐
    │ buildkite:          │                │ L1: [...]        │
    │   vllm/ci: vllm/vllm│               │ L2: [...]        │
    │ # gitlab:           │                │ L3: {device: ..} │
    │ #   grp/proj: o/r   │                │ L4: [...]        │
    └────────┬────────────┘                └────────┬────────┘
             │ CI_PROVIDERS_URL                      │ ALLOWLIST_URL
             ▼                                       ▼
    ┌─────────────────────────────────────────────────────────┐
    │                  CRCR Lambda                            │
    │  jwt_helper.py    →  verify OIDC token (any issuer)     │
    │  allowlist.py     →  check repo trust level             │
    │  lambda_function  →  orchestrate                        │
    └─────────────────────────────────────────────────────────┘

Changes

File What
config/ci_providers.yml New — external CI provider pipeline-to-repo mapping, extensible per provider
utils/jwt_helper.py Multi-issuer OIDC: detect issuer → select JWKS → extract repo. Loads mappings from ci_providers.yml via URL + Redis cache
utils/config.py Add optional ci_providers_url field
utils/redis_helper.py Add get_cached_ci_providers / set_cached_ci_providers with separate Redis key
callback/lambda_function.py Call load_ci_providers(config) before token verification
utils/allowlist.py Unchanged (reverted)
tests/test_jwt_helper.py Expanded from 5 → 17 tests

Onboarding a new Buildkite repo

Edit config/ci_providers.yml — no Lambda redeployment needed:

buildkite:
  vllm/ci: vllm-project/vllm
  acme/build: acme/repo

Onboarding a new CI provider (future)

  1. Add the provider's JWKS endpoint to _ISSUER_CONFIG in jwt_helper.py
  2. Add an _extract_repo_<provider> function
  3. Add a section reader in load_ci_provider_mappings
  4. Add the provider section to ci_providers.yml

Closes #8326

Test plan

  • All 17 unit tests pass locally
  • CI passes (lintrunner, python-tests)
  • Set CI_PROVIDERS_URL env var and deploy to staging
  • Verify with a test Buildkite OIDC token

Make verify_oidc_token() issuer-aware so downstream repos running on
Buildkite can authenticate callbacks alongside existing GitHub Actions
repos.  The unverified `iss` claim selects the correct JWKS client, and
an issuer-specific extractor normalizes the caller identity to the
GitHub-style `owner/repo` format that the rest of the pipeline expects.

For Buildkite, identity comes from a static (org_slug, pipeline_slug)
→ repo mapping in BUILDKITE_REPO_MAP since Buildkite OIDC tokens carry
no `repository` claim.  Unregistered pipelines get a 403; unknown
issuers get a 401.

lambda_function.py requires no changes — it reads claims["repository"]
which verify_oidc_token now guarantees for every supported issuer.

Closes #8326
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 6, 2026
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
torchci Ignored Ignored Preview Aug 6, 2026 11:25am

Request Review

@subinz1
subinz1 requested a review from atalman August 6, 2026 09:00
subinz1 added 5 commits August 6, 2026 14:32
Collapse short multi-line expressions to single lines per the Python
formatter's preferences.
Instead of hardcoding Buildkite (org_slug, pipeline_slug) -> repo
mappings in jwt_helper.py, load them from the allowlist YAML's
buildkite_repos section.  This means onboarding a new Buildkite-based
downstream repo only requires adding a line to allowlist.yml — no
Lambda redeployment needed.

Expected allowlist format:

    buildkite_repos:
      vllm/ci: vllm-project/vllm
      acme/build: acme/repo
Replace the allowlist-coupled approach with a standalone ci_providers.yml
config file in test-infra.  The Lambda fetches it at runtime via
CI_PROVIDERS_URL and caches it in Redis, so onboarding a new Buildkite
(or future GitLab/Jenkins) downstream repo only requires editing the
config file — no Lambda redeployment and no changes to allowlist.yml.
@subinz1
subinz1 requested a review from jewelkm89 August 6, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CRCR] Add multi-issuer OIDC support to jwt_helper for Buildkite

1 participant