Keyless CI Authentication (OIDC)
OpenID Connect (OIDC) lets your CI jobs authenticate with Meticulous without storing a long-lived METICULOUS_API_TOKEN secret in your CI provider.
How it works
- Your CI job requests a short-lived signed OIDC identity JWT from its CI provider (for example, GitHub Actions or GitLab CI).
- The Meticulous GitHub Action or CLI sends that JWT to
POST /api/ci-auth/oidc/exchange. - Meticulous verifies the JWT signature against the issuer's JWKS endpoint, checks the project's CI trust policies, and enforces single-use
jtireplay protection. - Meticulous returns a short-lived scoped token (45-minute lifetime) restricted to CI operations such as uploading builds, checking base runs, launching
ci agent-test, and reporting custom check results.
Compared to a static project API token:
- No static secret to rotate or leak: Every job gets a fresh short-lived credential tied to that specific run.
- Least-privilege CI scope: Exchanged tokens can upload builds and report CI results, but cannot read recorded sessions, download source archives, or call agent/MCP endpoints.
- Auditable: Token exchanges are recorded with repository, ref, commit SHA, workflow, and actor claims.
GitHub Actions Quick Start
1. Ensure a GitHub Actions trust policy is enabled
- New GitHub.com projects: The default GitHub Actions trust policy is enabled automatically when an organization owner creates the project or links a GitHub.com repository.
- Existing projects (or projects linked by a non-owner): Open your project in the Meticulous dashboard, go to Settings → API tokens (open), and click Enable GitHub Actions OIDC under CI OIDC trust policies if not already enabled.
The built-in GitHub Actions preset trusts jobs from your linked repository's immutable repository_id (so repository renames or transfers cannot hijack it) on safe trigger events: push, pull_request, workflow_dispatch, merge_group, and schedule. Events that can run untrusted code with repository privileges (pull_request_target, issue_comment, workflow_run) are blocked by default.
2. Grant id-token: write in your workflow
Add id-token: write to your workflow or job permissions: and omit api-token: from your Meticulous steps:
permissions:
actions: write
contents: read
id-token: write
issues: write
pull-requests: write
statuses: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: alwaysmeticulous/report-diffs-action/ensure-base@v1
with:
ref: ${{ env.METICULOUS_COMMIT_SHA }}
- uses: actions/checkout@v4
with:
ref: ${{ env.METICULOUS_COMMIT_SHA }}
# ... install dependencies and build your app ...
- uses: alwaysmeticulous/report-diffs-action/upload-assets@v1
with:
app-directory: "dist"
For complete workflows covering static asset uploads, container uploads, and base-build handling, see Setting up Meticulous tests to run in your CI provider.
Monorepos and Multi-Project Repositories
When only one Meticulous project with CI OIDC enabled is linked to a GitHub repository, Meticulous infers the target project from the OIDC token's repository_id claim automatically.
When multiple Meticulous projects share the same repository (such as a monorepo with separate frontend apps), pass the target project explicitly as organization/project:
- GitHub Actions (
ensure-base,upload-assets,upload-container): pass theprojectinput:
- uses: alwaysmeticulous/report-diffs-action/upload-assets@v1
with:
project: "my-org/dashboard"
app-directory: "apps/dashboard/dist"
- CLI or custom checks: set the
METICULOUS_PROJECTenvironment variable:
env:
METICULOUS_PROJECT: "my-org/dashboard"
Restricting Trust Policies
You can tighten any trust policy in Settings → API tokens → CI OIDC trust policies by adding claim rules. All rules within a policy must match (AND), and if a project has multiple enabled policies, any matching policy authorizes the job (OR).
Each rule compares a JWT claim as a string using one of three operators:
| Operator | Behaviour | Example |
|---|---|---|
equals | Exact string match | environment equals ci |
in | Matches any value in a list | ref in refs/heads/main, refs/heads/release |
glob | Wildcard match (* matches any characters) | job_workflow_ref matches my-org/my-repo/.github/workflows/meticulous*.yml@* |
Common claims to restrict on GitHub Actions include ref, job_workflow_ref, environment, and event_name.
Custom OIDC Issuers (GitLab CI, CircleCI, Buildkite, GHES)
Meticulous supports any HTTPS OIDC issuer that publishes a standard .well-known/openid-configuration discovery document and JWKS endpoint.
1. Add a custom trust policy
In Settings → API tokens → CI OIDC trust policies, add a custom issuer policy:
- Issuer URL: Your CI provider's HTTPS issuer URL (for example,
https://gitlab.comor your GitHub Enterprise Server Actions issuer URL). - Audience (optional): Leave blank to use the default audience
https://app.meticulous.ai, or enter a custom audience if your CI provider requires one. - Claim rules (required): Custom issuers have no default rules, so add at least one rule pinning the repository or project claim (for example,
project_pathequalsmy-group/my-appon GitLab CI).
2. Pass the OIDC token and project in CI
For providers other than GitHub.com Actions, supply the job's OIDC JWT via METICULOUS_OIDC_TOKEN and specify the target project via METICULOUS_PROJECT:
GitLab CI example:
meticulous:
stage: test
image: node:24-alpine
id_tokens:
METICULOUS_OIDC_TOKEN:
aud: https://app.meticulous.ai
variables:
METICULOUS_PROJECT: "my-org/my-project"
script:
- npx @alwaysmeticulous/cli ci upload-assets --appDirectory="dist" --commitSha="$CI_COMMIT_SHA" --waitForBase
If your custom trust policy uses a custom audience, configure the matching aud in your CI provider (and set METICULOUS_OIDC_AUDIENCE or the oidc-audience action input on GitHub Actions).
Using OIDC with the CLI and Custom Checks
The Meticulous CLI (@alwaysmeticulous/cli) and SDK client (@alwaysmeticulous/client v3.13.0+) automatically resolve CI OIDC credentials whenever no static --apiToken or METICULOUS_API_TOKEN is provided:
- On GitHub Actions, they request an OIDC token from
ACTIONS_ID_TOKEN_REQUEST_URLautomatically when the job hasid-token: write. - On other CI providers, they read
METICULOUS_OIDC_TOKEN. - For custom checks running in CI with
@alwaysmeticulous/custom-checks, grantid-token: writeon the job and setMETICULOUS_PROJECTif the repo has multiple projects.
See the CLI Commands Reference and Environment Variables Reference for all supported flags and variables.
Using a Static API Token Instead
Passing api-token / --apiToken or setting METICULOUS_API_TOKEN always takes precedence over OIDC. Use a static API token if:
- Your CI provider does not issue OIDC identity tokens.
- You are using the legacy root action (
alwaysmeticulous/report-diffs-action@v1) instead ofupload-assets@v1orupload-container@v1. - Your workflow runs on an event blocked by the default GitHub Actions trust policy and you do not want to allow it via a custom issuer policy.
Troubleshooting
Missing id-token: write permission
If the action or CLI logs that GitHub Actions OIDC environment variables (ACTIONS_ID_TOKEN_REQUEST_URL) are unavailable, add id-token: write under permissions: on the workflow or job. Note that GitHub does not issue OIDC tokens to pull requests opened from external forks.
Exchange rejected: no enabled trust policy
Verify that a trust policy is enabled for the project under Settings → API tokens → CI OIDC trust policies and that the project is linked to the expected GitHub repository.
Exchange rejected: multiple projects match this repository
Pass project: "organization/project" on each Meticulous action step (or set METICULOUS_PROJECT="organization/project" for CLI and custom check steps).
Exchange rejected: event not allowed
The GitHub Actions preset allows push, pull_request, workflow_dispatch, merge_group, and schedule. Workflows triggered by pull_request_target, issue_comment, or workflow_run are intentionally excluded by default for security.