Skip to content

feat: add the settings of the CI OIDC exchange for record keys and API tokens, off by default [P-ENG-146] - #46

Open
agoldis wants to merge 10 commits into
mainfrom
agoldis/oidc-token-exchange-settings
Open

agoldis wants to merge 10 commits into
mainfrom
agoldis/oidc-token-exchange-settings

Conversation

@agoldis

@agoldis agoldis commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Owner: @agoldis
Linear: P-ENG-146

What

Adds the settings of the CI OIDC exchange to the compose setup, for record keys (POST /oidc/token) and for API tokens (POST /oidc/api/token), both on the director. All are commented out in .env.example, so both exchanges stay off and nothing changes for an install that does not set them. Every service reads .env through env_file, so no compose file changes.

Variable Read by Default
OIDC_TOKEN_EXCHANGE_ENABLED director unset (off) Turns the record key exchange on. Off, /oidc/token answers 404
OIDC_TOKEN_AUDIENCE director unset Required when the record key exchange is on. A name you choose, such as currents:record-key:acme, not a URL. The CI jobs set the same value as CURRENTS_OIDC_AUDIENCE
OIDC_API_TOKEN_EXCHANGE_ENABLED director unset (off) Turns the API token exchange on, independent of the record key one. Off, /oidc/api/token answers 404; /oidc/api/revoke is served either way
OIDC_API_TOKEN_AUDIENCE director unset Required when the API token exchange is on. Must differ from OIDC_TOKEN_AUDIENCE: the director does not start when they are equal, also while the exchange is off
OIDC_API_POLICIES_ENABLED api unset (off) Lets organization admins add API trust policies in the dashboard; existing policies stay listed and removable either way. The dashboard has no setting of its own: it learns the value from the API. Does not turn the exchange on
OIDC_EXTRA_ISSUERS director, api unset (cloud providers only) Self-managed GitLab and GitHub Enterprise Server instances whose jobs may exchange tokens: comma-separated provider=issuer entries, at most 20. Both services refuse to start with an invalid value
OIDC_TRUST_FORWARDED_FOR director unset true only behind a proxy that appends the client address to X-Forwarded-For and passes on none the caller wrote. Otherwise a caller can fake its address and get around the limit per address. Applies to both exchanges

docs/configuration.md has a section with the variables and the requirements, docs/quickstart.md points to it, and on-prem/CHANGELOG.md has an entry under Unreleased.

The API token settings were read from the code at tag release/2026-11-20-001: packages/director/src/config.ts, packages/director/src/oidc/app.ts and packages/api/src/config.ts.

Checked before writing

Indexes. On-prem builds them itself. The scheduler runs runMigrations({ syncIndexes: true }) at startup (packages/scheduler/src/init.ts), which creates every index the release declares. For recordKeys the release declares the unique partial index on recordKeyHash (the lookup by hash), the TTL index on expiresAt (expireAfterSeconds: 0) and the partial index on issuedFor.policyId, and for oidcTrustPolicies its unique index. So there is no manual step, and the docs list the four indexes. Keys from the exchange expire after six hours, and MongoDB's TTL cleanup removes their documents later. The next release's upgrade notes should list the new recordKeys indexes.

Reporter audience. The reporters' default audience is currents:record-key, and on GitHub Actions, where the reporter requests the token itself, they take another from CURRENTS_OIDC_AUDIENCE (the CLI also has --oidc-audience). The reporter also shows CURRENTS_OIDC_AUDIENCE in its missing-key hint when it is set. On GitLab CI, CircleCI, Buildkite and Bitbucket Pipelines the job supplies the token, so the audience is whatever the job asks its provider for. An install picks its own name, so on-prem does need a client setting: the docs say to use the install's name in each of those places, and not to pick currents:record-key itself, because a token made for the cloud would then be accepted. Reporters: currents-reporter#511, currents-playwright#1107.

Do not merge this before the server change and the reporter releases that use the fixed audience name.

Network. The director must reach the providers' public discovery and key endpoints over https: GitHub Actions, GitLab.com, CircleCI, Buildkite and Bitbucket Pipelines. Air-gapped installs are not supported. Self-managed GitLab and GitHub Enterprise Server are supported through OIDC_EXTRA_ISSUERS: the director must reach each listed host, which can be private or internal, and an issuer with a certificate from an internal CA needs NODE_EXTRA_CA_CERTS on the director. The docs show a docker-compose.override.yml that mounts the CA file.

Release. The OIDC_EXTRA_ISSUERS part needs images of a currents release that contains currents#5011 (the director accepts the issuers) and currents#5012 (the API reads the setting and stores a policy for a listed issuer). The dashboard form for such a policy follows in a later change. The rest of this PR needs the release with the exchange.

Related

Checklist

  • PR title is Changelog-friendly: (fix|feat|chore): title [CSR-xxx]
  • User-friendly and meaningful description of the changes
  • Documentation was updated

Checks run: docker compose config --quiet on the three compose files, as validate-compose.yml does (compose files are unchanged); .env.example has no uncommented OIDC_ line.

🤖 Generated with Claude Code

https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE

@baz-reviewer

baz-reviewer Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Review this PR on Baz

Baz Summary

Document the optional CI OIDC exchange settings for record keys and API tokens, including audiences, trust policies, issuer configuration, rate limits, networking, and certificate requirements. Guide operators through configuration in the reference and quickstart docs, provide commented .env.example settings, and announce the feature in the on-prem changelog.

Topics

TopicDetails
CI OIDC Exchange Configure the optional record-key and API-token OIDC exchanges, including independent enablement, audiences, trust policies, issuers, rate limits, networking, and security requirements.
Modified files (3)
  • docs/configuration.md
  • docs/quickstart.md
  • on-prem/.env.example
Latest Contributors(2)
UserCommitDate
agoldis@gmail.comdocs: state the lifeti...November 20, 2026
dj@currents.devdocs: install and upgr...November 17, 2026
Release Communication Announce the opt-in OIDC exchange and link operators to its configuration requirements and release prerequisites.
Modified files (1)
  • on-prem/CHANGELOG.md
Latest Contributors(2)
UserCommitDate
agoldis@gmail.comfeat: add the settings...November 20, 2026
agoldis@users.noreply....feat: add settings to ...November 17, 2026

Merger   ✅ Ready to Merge

MERGE: the PR adds the documented, commented-off OIDC settings and configuration guidance, with CI checks run and no unresolved discussions.



Skills  Activate Skill Maintainer to keep your skills up to date

Planner  This PR would have been improved with Baz Planner - Try it now

agoldis and others added 8 commits November 20, 2026 12:33
…[P-ENG-132]

The director's `POST /oidc/token` gives a CI job a record key for 6 hours in
exchange for the OIDC token of its CI provider. It is off unless
`OIDC_TOKEN_EXCHANGE_ENABLED=true`. The director reads its settings from
`.env` (`env_file`), so no compose file changes.

- `.env.example` lists `OIDC_TOKEN_EXCHANGE_ENABLED`, `OIDC_TOKEN_AUDIENCE` and
  `OIDC_TRUST_FORWARDED_FOR`, commented out.
- `docs/configuration.md` has a section with the three variables and what the
  exchange needs: outbound access to the CI providers, the audience, the
  indexes the scheduler creates, and the limits.
- `docs/quickstart.md` points to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE
The audience of the CI OIDC token is a fixed string, not a URL: Currents cloud
uses `currents:record-key`, and an install uses a name of its own, such as
`currents:record-key:acme`. `OIDC_TOKEN_AUDIENCE` is required when the
exchange is on and has no default, and the CI jobs set the same value as
`CURRENTS_OIDC_AUDIENCE`. The docs no longer say that an install needs no
client setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE
The reporter uses `CURRENTS_OIDC_AUDIENCE` only to request the token on GitHub
Actions, and to show it in its missing-key hint. When the job supplies the
token (GitLab CI, CircleCI, Buildkite, Bitbucket Pipelines), the audience is
whatever the job asked its provider for, so the job uses the install's name
there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE
…ization [P-ENG-132]

The project a job names only selects the organization and its trust policy. The
key it gets works for the whole organization for 6 hours, so the docs no longer
say that it is limited to that project. Keys expire after six hours, and
MongoDB's TTL cleanup removes their documents later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE
…prise [P-ENG-132]

The director and the API read OIDC_EXTRA_ISSUERS, a list of provider=issuer
entries. Add it to .env.example and the configuration reference, say that the
director must reach the listed hosts, and show how to mount an internal CA
with NODE_EXTRA_CA_CERTS. The notes that said tokens from self-hosted GitLab
and GitHub Enterprise are not accepted now say they work with the setting.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3jW7wFPFbKF1o7FCeC
… [P-ENG-132]

The scheduler now builds the unique partial index on recordKeyHash, so the
note that on-prem looks keys up by hash without an index is gone. In an issuer
only the host is lowercase; the path keeps its case.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3jW7wFPFbKF1o7FCeC
…TS_OIDC_AUDIENCE [P-ENG-132]

Checked the OIDC_EXTRA_ISSUERS rules, NODE_EXTRA_CA_CERTS and the required
audience against the currents code; this is the only difference.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3jW7wFPFbKF1o7FCeC
…ult [P-ENG-146]

- OIDC_API_TOKEN_EXCHANGE_ENABLED and OIDC_API_TOKEN_AUDIENCE (director)
- OIDC_API_POLICIES_ENABLED (api)
- document them in .env.example, the configuration reference, quickstart and changelog

All services read .env, so no compose file changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE
@agoldis
agoldis force-pushed the agoldis/oidc-token-exchange-settings branch from 27dcdf7 to bef5ddb Compare November 20, 2026 19:35
@agoldis agoldis changed the title feat: add the settings of the CI OIDC token exchange, off by default [P-ENG-132] feat: add the settings of the CI OIDC exchange for record keys and API tokens, off by default [P-ENG-146] Nov 20, 2026
@agoldis
agoldis marked this pull request as ready for review November 20, 2026 19:35
baz-app[bot]
baz-app Bot previously approved these changes Nov 20, 2026
- say the exchange routes are served by the director, not the api
- 6 hours is the default key lifetime; a policy can set 15 minutes to 24 hours
- add Google Cloud to the providers and the network requirements
- the dashboard shows a Server selector for listed issuers
- document OIDC_ADDRESS_LIMIT_PER_MINUTE and OIDC_ORG_LIMIT_PER_MINUTE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE
@baz-app
baz-app Bot dismissed their stale review November 20, 2026 19:43

Baz withdrew its approval because this pull request is no longer ready to merge.

…-146]

- an API token lasts 15 minutes unless the policy sets 5 to 360 minutes
- an API policy names one repository or project, or one Google Cloud service account

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011baD3hG81A9qbFYrSn1ysE

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant