ModernCI
Sign in

Docs · Security

Job identity (OIDC) and signing

ModernCI is an OpenID Connect identity provider for jobs. A running job can ask for a short-lived token that says exactly which repository, ref, commit, check and run it is. Use the token for keyless signing with Sigstore, and for cloud federation (AWS, GCP, Azure) without stored secrets. This is the same pattern as GitHub Actions OIDC.

  • Issuer: https://oidc.modernci.dev (one global issuer).
  • Discovery: https://oidc.modernci.dev/.well-known/openid-configuration.
  • Keys (JWKS): https://oidc.modernci.dev/.well-known/jwks.
  • Signing algorithm: ES256.

Getting a token inside a job

The runner puts two variables in the job's environment:

VariableMeaning
MCI_ID_TOKEN_REQUEST_URLthe token endpoint of the region running the job
MCI_ID_TOKEN_REQUEST_TOKENa credential for this job only; it is a secret and is redacted from logs
curl -sH "Authorization: Bearer $MCI_ID_TOKEN_REQUEST_TOKEN" \
     "$MCI_ID_TOKEN_REQUEST_URL?audience=sigstore" | jq -r .value

The answer is {"value": "<jwt>", "expires_at": <unix seconds>}. audience is required: use sigstore for Sigstore, sts.amazonaws.com for AWS, and so on.

Token claims

ClaimExampleMeaning
isshttps://oidc.modernci.devissuer
subrepo:git.example.com/acme/widgets:ref:refs/heads/mainrepo:<host>/<owner>/<repo>:ref:<ref>
audsigstorethe audience the job asked for
exp, iat, nbf1794300300lifetime: at most 10 minutes (5 by default)
jti9f2c…unique token id
tenant, projectt_acme, p_widgetsModernCI tenant and project
server_urlhttps://git.example.comthe git host
repositoryacme/widgetsowner and repository
repository_owneracmeowner
repository_id, repository_owner_id1042, 17the git host's stable ids (survive renames)
repository_visibilitypublicpublic, private or internal
refrefs/heads/mainthe ref being built
sha4b825dc6…the commit being built
checkreleasethe check
run_id, run_attempt, job_idr_01JC2Z, 1, j_01JC30the run, its attempt, the job
runner_environmentmodernci-hostedmodernci-hosted or self-hosted
config_refacme/widgets/.ci/checks.yaml@refs/heads/mainthe check configuration that defined the job
config_sha4b825dc6…the commit the configuration was read from
triggerpushpull_request, merge_queue, push, manual or schedule
landedtruethe commit is on a branch only ModernCI lands to
run_urlhttps://app.modernci.dev/acme/widgets/runs/r_01JC2Zthe run's page

Example token body:

{
  "iss": "https://oidc.modernci.dev",
  "sub": "repo:git.example.com/acme/widgets:ref:refs/heads/main",
  "aud": "sigstore",
  "exp": 1794300300, "iat": 1794300000, "nbf": 1794300000,
  "jti": "9f2c4be1d0a34f7e8b1c2d3e4f506172",
  "tenant": "t_acme", "project": "p_widgets",
  "server_url": "https://git.example.com",
  "repository": "acme/widgets", "repository_owner": "acme",
  "repository_id": "1042", "repository_owner_id": "17",
  "repository_visibility": "public",
  "ref": "refs/heads/main", "sha": "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
  "check": "release", "run_id": "r_01JC2Z", "run_attempt": "1", "job_id": "j_01JC30",
  "runner_environment": "modernci-hosted",
  "config_ref": "acme/widgets/.ci/checks.yaml@refs/heads/main",
  "config_sha": "4b825dc642cb6eb9a060e54bf8d69288fbee4904",
  "trigger": "push", "landed": true,
  "run_url": "https://app.modernci.dev/acme/widgets/runs/r_01JC2Z"
}

Fulcio certificate extensions

A Sigstore certificate issued for a ModernCI token carries these extensions (OIDs under 1.3.6.1.4.1.57264.1). Templates use Fulcio's syntax: a bare name is that claim's value. The certificate's subject alternative name (a URI) is {{ .server_url }}/{{ .config_ref }}, e.g. https://git.example.com/acme/widgets/.ci/checks.yaml@refs/heads/main.

OIDExtensionTemplateExample
1.3.6.1.4.1.57264.1.8Issuer (V2)isshttps://oidc.modernci.dev
1.3.6.1.4.1.57264.1.9Build Signer URI{{ .server_url }}/{{ .config_ref }}https://git.example.com/acme/widgets/.ci/checks.yaml@refs/heads/main
1.3.6.1.4.1.57264.1.10Build Signer Digestconfig_sha4b825dc642cb6eb9a060e54bf8d69288fbee4904
1.3.6.1.4.1.57264.1.11Runner Environmentrunner_environmentmodernci-hosted
1.3.6.1.4.1.57264.1.12Source Repository URI{{ .server_url }}/{{ .repository }}https://git.example.com/acme/widgets
1.3.6.1.4.1.57264.1.13Source Repository Digestsha4b825dc642cb6eb9a060e54bf8d69288fbee4904
1.3.6.1.4.1.57264.1.14Source Repository Refrefrefs/heads/main
1.3.6.1.4.1.57264.1.15Source Repository Identifierrepository_id1042
1.3.6.1.4.1.57264.1.16Source Repository Owner URI{{ .server_url }}/{{ .repository_owner }}https://git.example.com/acme
1.3.6.1.4.1.57264.1.17Source Repository Owner Identifierrepository_owner_id17
1.3.6.1.4.1.57264.1.18Build Config URI{{ .server_url }}/{{ .config_ref }}https://git.example.com/acme/widgets/.ci/checks.yaml@refs/heads/main
1.3.6.1.4.1.57264.1.19Build Config Digestconfig_sha4b825dc642cb6eb9a060e54bf8d69288fbee4904
1.3.6.1.4.1.57264.1.20Build Triggertriggerpush
1.3.6.1.4.1.57264.1.21Run Invocation URIrun_urlhttps://app.modernci.dev/acme/widgets/runs/r_01JC2Z
1.3.6.1.4.1.57264.1.22Source Repository Visibility At Signingrepository_visibilitypublic

ModernCI checks have no reusable-configuration indirection, so the build signer and the build config are the same file.

Security model

  • Who can get a token. Only a running job. At launch ModernCI creates a random credential for that job, keeps only its hash, and gives the secret to the runner over the job's secret channel (never on a command line; redacted from logs). The token endpoint answers only while the job is running; once it finishes the credential is refused.
  • Isolation between tenants. A credential resolves to exactly one job, and the token describes only that job: tenant, project, repository and commit come from ModernCI's records, never from the request. sub includes the git host, so the same owner/repository on two hosts never collide.
  • No signing keys in jobs. Token-signing keys live behind the signing seam (a key file now; cloud KMS or HSM in production) in a separate process. Keyless signing in a job uses an ephemeral key and the job's token.
  • Short lifetime. Tokens live at most 10 minutes (5 by default) and are audience-scoped.

Key rotation

Each key has a start time. A new key is published in the JWKS 30 minutes before it starts signing, so verifiers that cache the JWKS already know it. A replaced key stays published for at least the longest token lifetime after it stops signing, so every token it signed still verifies. Cache the JWKS for no longer than 5 minutes (the endpoint sends Cache-Control: max-age=300).

Verifying ModernCI-signed artifacts

mci attestation verify widget.tar.gz \
  --bundle widget.tar.gz.sigstore.json --policy policy.json \
    [--trusted-root trusted_root.json]

It checks the signature, the certificate identity (issuer and subject pattern), the transparency log inclusion proof and signed entry timestamp, and the SLSA provenance policy. Without --trusted-root it uses the public Sigstore instance. A keyless policy:

{
  "signer": {"keyless": {"issuer": "https://oidc.modernci.dev",
                         "subject_regex": "https://git\\.example\\.com/acme/widgets/\\.ci/.*@refs/heads/main"}},
  "transparency_log": "required",
  "certificate": {"source-repository-ref": "refs/heads/main", "runner-environment": "modernci-hosted"},
  "provenance": {"builder_id": "https://modernci.dev/builder/v1",
                 "source_repository": "https://git.example.com/acme/widgets",
                 "source_refs": ["refs/heads/main"], "landed": true}
}

ModernCI's own releases are signed with the platform key; verify them with a key policy (transparency_log may be optional for offline, air-gapped verification):

{"signer": {"key": {"public_keys": ["ed25519:<64 hex>"]}},
 "provenance": {"builder_id": "https://modernci.dev/builder/v1", "source_refs": ["refs/heads/main"], "landed": true}}

Bundles are standard Sigstore bundles, so cosign verify-blob --bundle … --certificate-oidc-issuer https://oidc.modernci.dev --certificate-identity-regexp … also works once the issuer is trusted by the Fulcio that issued the certificate.

View this page as Markdown