Skip to content

feat: OIDC auth (primary) + static bearer fallback - #2

Merged
baladithyab merged 1 commit into
mainfrom
feat/oidc-auth
May 28, 2026
Merged

baladithyab merged 1 commit into
mainfrom
feat/oidc-auth

Conversation

@baladithyab

Copy link
Copy Markdown
Owner

Summary

The reusable `static-passthrough.yml` workflow now mints a GitHub Actions OIDC token and uses it as the upload bearer. Falls back to `PROJECT_EMBED_UPLOAD_TOKEN` if OIDC env isn't available (e.g. caller forgot `id-token: write`).

Companion to baladithyab/baladithyab.github.io#36 which adds the OIDC verifier on the Worker side.

Caller migration

Caller workflows (e.g. each codeseys-embed repo's `build-web-asset.yml`) need this permissions block:

```yaml
permissions:
contents: write
pull-requests: write
id-token: write # NEW for OIDC mint
```

After the personal-site PR merges and this PR merges:

  • New repos inherit OIDC auth automatically (zero secret config)
  • Existing repos can drop `PROJECT_EMBED_UPLOAD_TOKEN` after one successful OIDC run

Behaviour

  • If `ACTIONS_ID_TOKEN_REQUEST_URL` and `ACTIONS_ID_TOKEN_REQUEST_TOKEN` are present → mint a JWT scoped to `https://codeseys.io\` (configurable via `oidc-audience` input), use it as bearer
  • Otherwise → use `secrets.PROJECT_EMBED_UPLOAD_TOKEN` as bearer
  • If neither → fail with explicit guidance

The Worker auth path (PR #36) accepts both, so the rollout is non-breaking.

🤖 Generated with the help of Claude

The Mint OIDC token step calls the runner-local token broker
($ACTIONS_ID_TOKEN_REQUEST_URL) and exchanges the broker token
for a short-lived ID token scoped to the configured audience.
Failures are non-fatal: if OIDC env vars aren't present (e.g.
caller forgot 'permissions: id-token: write'), we fall back to
the static PROJECT_EMBED_UPLOAD_TOKEN bearer.

The Upload step now picks BEARER from OIDC if available, else
static bearer, else fails with explicit guidance.

Caller workflows must include in their permissions block:

    permissions:
      contents: write
      pull-requests: write
      id-token: write

Static bearer remains supported for repos that don't (or can't)
use OIDC, e.g. manual upload scripts.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b164532311

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

contents: write
pull-requests: write
# Mint OIDC tokens. Required for the OIDC auth path.
id-token: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid elevating id-token in the called workflow

For existing callers that already set a job permissions block without id-token: write (the README example does this), GitHub treats unspecified permissions as none and a reusable workflow can only maintain or reduce the caller's token permissions, not elevate them. Because this called workflow now requests id-token: write, those callers are rejected before any step runs, so the new static-token fallback never executes even when PROJECT_EMBED_UPLOAD_TOKEN is present. This makes the rollout breaking for exactly the “caller forgot id-token” case described in the change.

Useful? React with 👍 / 👎.

@baladithyab
baladithyab merged commit 4375e9d into main May 28, 2026
@baladithyab
baladithyab deleted the feat/oidc-auth branch May 28, 2026 03:47
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