Docs menuOIDC for CI

OIDC for CI

OIDC lets an authorized GitHub Actions or GitLab.com CI job pull one environment from a personal Pro or organization project. CI stores no long-lived Registry token.

This flow is an explicit exception to ordinary end-to-end encrypted cloud sync. LPM.dev Registry decrypts the project on the server after it verifies the workflow identity and the policy. Then it returns only the requested environment.

The supported workflow requires:

  • A personal Pro project or an organization project on an active Organization or Enterprise plan.
  • GitHub Actions or GitLab.com CI.
  • A repository checkout that contains the project's lpm.json and vault ID.

Every project requires an explicit opt-in to server decryption with --allow-server-decryption. For an organization project, an owner or admin must give this opt-in. OIDC here authorizes CI workloads. It does not configure organization SSO.

Push the personal vault first

Create the local vault, sign in, and upload its encrypted cloud copy:

lpm env set --env=production API_TOKEN=secret
lpm login
lpm env push

You cannot enable OIDC escrow before that personal cloud vault exists.

Authorize a workflow

Run this command on the LPM CLI installation that holds the personal wrapping key:

lpm env oidc allow \
  --allow-server-decryption \
  --provider=github \
  --repo=owner/repository \
  --workflow=.github/workflows/deploy.yml \
  --branch=main \
  --env=production \
  --events=push

The command sends the policy and this project's key to LPM.dev Registry in one request. The Registry encrypts the key and stores it together with the policy. If the request fails, the Registry keeps the previous policy and escrow state.

After the command succeeds, it prints a server-issued policy ID. Copy this UUID into the CI configuration as LPM_OIDC_POLICY_ID.

The policy ID is a selector, not a bearer credential. It cannot authorize a pull without a valid CI identity token. Protect its integrity because a changed value can select the wrong policy.

A project has one policy for each repository or GitLab project. If that policy exists, the command replaces all of its allowlists and keeps its policy ID. Run lpm env oidc list first, then supply every value that must stay allowed.

By default, LPM CLI gets the immutable numeric repository ID from the GitHub API. Public repository requests do not need GitHub authentication.

If the repository is private, set GITHUB_TOKEN or GH_TOKEN. You can also pass --repository-id=<numeric-id> directly.

The policy binds the repository name and numeric ID. Both values must match during the OIDC exchange and the CI pull.

If you rename or transfer the repository, run lpm env oidc allow again with its current name. The command creates a new policy ID. Update LPM_OIDC_POLICY_ID in CI. A different repository cannot reuse the old policy.

Existing GitHub policies without a repository ID fail closed. If lpm env oidc list reports a missing ID, run lpm env oidc allow again.

Continue only when LPM CLI reports that CI escrow is enabled. If the command fails, correct the error and run the same command again.

List the vault's current policies with:

lpm env oidc list

To stop CI access to a personal project, run lpm env oidc disable. The command rotates the project key, disables the policies, and revokes issued CI credentials. To allow CI access again, run the complete oidc allow command. LPM CLI has no command that deletes a single policy.

Authorize an organization workflow

An owner or admin must first share or pull the current organization revision. Run the complete policy command with an explicit decryption opt-in:

lpm env pull --org=acme
lpm env oidc allow \
  --org=acme \
  --allow-server-decryption \
  --provider=github \
  --repo=owner/repository \
  --workflow=.github/workflows/deploy.yml \
  --branch=main \
  --env=production \
  --events=push
lpm env oidc list --org=acme

The command transfers only this project's current content key over TLS. The Registry encrypts the key before storage. Your sharing private key and personal wrapping key stay on your machine.

For an organization project, the command creates the policy first and then uploads the escrow key. If the upload fails, the policy can exist, but CI pulls are not ready. Correct the error and run the same command again.

The organization owns the policy and CI credentials. Access does not depend on the original policy creator remaining an admin. At each pull, the Registry evaluates current billing, policy restrictions, token validity, and content-key state.

Owners and admins can add, replace, or delete policies on the Access tab of the project in the dashboard. They can also disable CI decryption there or through the CLI:

lpm env oidc disable --org=acme

Disabling decryption revokes issued credentials. Enabling it again does not restore those credentials. Disabling remains available when organization billing lapses.

Content-key rotation or membership key invalidation clears CI escrow and revokes issued credentials. After an owner or admin shares the new key, run the complete oidc allow command again.

The CI pull command is the same for personal and organization projects. Its policy ID selects the ownership scope. The CI job does not need --org.

Policy controls

ControlCLI optionMeaning
Repository--repo=owner/repositoryGitHub repository allowed to request access
Repository ID--repository-id=123456789This option sets an explicit immutable ID. LPM CLI gets the ID from GitHub by default
Workflow--workflow=.github/workflows/deploy.ymlExact workflow file allowed to request access. It accepts a comma-separated list
Branch--branch=mainThis option sets the allowed branches. It accepts a comma-separated list. A pattern such as release/* matches every branch with that prefix. The default is main
Environment--env=productionThis option sets the envs that a job can receive. It accepts a comma-separated list
Event--events=pushThis option sets the allowed GitHub event names: push, pull_request, pull_request_target, workflow_dispatch, schedule, or release. The default is push
Forks--allow-forksThis option is required for the pull_request_target event, which can run for pull requests from forks. It is off by default

GitHub policies require a workflow file. A policy can have at most 50 branch patterns, 50 environments, and 20 workflow files. Keep production access restricted to the smallest repository, workflow, branch, event, and environment set that needs it.

GitHub Actions

The job needs id-token: write so GitHub can issue its signed identity token:

name: Deploy

on:
  push:
    branches: [main]

permissions:
  id-token: write
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22

      - name: Install LPM CLI
        run: npm install -g @lpm-registry/cli

      - name: Pull production environment
        run: lpm env pull --oidc --env=production --output=.env
        env:
          LPM_OIDC_POLICY_ID: ${{ vars.LPM_OIDC_POLICY_ID }}

      - name: Run the deployment
        run: node --env-file=.env ./scripts/deploy.mjs

--output accepts a file path and writes a plaintext dotenv file. Without --output, LPM CLI reports how many values it received, but it does not give them to later workflow steps. --output=- creates a file named -. It does not write to stdout.

Use a deployment command that explicitly loads the generated file. LPM CLI gives the file owner-only permissions if the runner supports POSIX file modes.

The checked-out lpm.json must contain the vault ID of the project that the policy belongs to. If the checkout has no lpm.json, set LPM_VAULT_ID to that vault ID.

Create LPM_OIDC_POLICY_ID as a GitHub repository variable for this job. If you store it as a variable of a GitHub environment, add environment: <name> to the job. GitHub does not expose the variables of an environment to a job that does not target that environment.

You can pass --policy-id=<uuid> instead. The command flag takes precedence over LPM_OIDC_POLICY_ID.

GitLab.com CI

Authorize the numeric GitLab project ID from a logged-in development machine:

lpm env oidc allow \
  --allow-server-decryption \
  --provider=gitlab \
  --project-id=12345 \
  --branch=main \
  --env=production

GitLab policies do not accept the GitHub options --repo, --repository-id, --workflow, --events, or --allow-forks.

Create LPM_OIDC_POLICY_ID as a GitLab CI/CD variable. Mark it protected only when every branch that the OIDC policy allows is also protected. GitLab does not expose protected variables to unprotected refs.

deploy:
  id_tokens:
    LPM_OIDC_TOKEN:
      aud: https://lpm.dev
  script:
    - npm install -g @lpm-registry/cli
    - lpm env pull --oidc --env=production --output=.env
    - node --env-file=.env ./scripts/deploy.mjs

Trust boundary

The CI job gets an OIDC identity token at run time. LPM CLI sends that token, the policy ID, the vault ID, and the requested environment.

LPM.dev Registry then:

  1. Verifies the signature, issuer, audience, and claims of the OIDC token. A GitHub Actions token must be at most five minutes old. A GitLab ID token must not be expired, and must be at most 6 hours old. GitLab sets its expiry to the timeout of the job.
  2. Selects the exact server-issued policy ID.
  3. Matches the provider identity, repository or project ID, workflow, branch, event, and environment against the policy.
  4. Issues a credential that is valid for five minutes and is scoped to that vault and environment.
  5. Uses the escrowed key to decrypt the project.
  6. Returns only the authorized environment as plaintext over TLS.

The Registry accepts each OIDC token for one exchange only. When the CI job pulls, the Registry matches the policy again. A policy change during those five minutes applies to the pull.

OperationCan LPM.dev Registry read vault values?
Ordinary lpm env push or developer-machine pullNo
lpm env oidc allow escrow uploadReceives the project key and stores it encrypted for later server decryption
Authorized lpm env pull --oidcYes

If the security requirements of the project do not allow server-side decryption, do not enable OIDC escrow.

Escrow errors

If a CI pull reports a stale escrow key, repeat setup on the machine that holds the current project key. Setup requires --allow-server-decryption. Organization setup also requires --org=<slug>.

If a CI pull reports an unavailable escrow key version, the Registry configuration needs operator action. The pull fails and returns no secret values.

The Registry protects escrow material with a versioned server key. A server-key rotation does not change the policy or require a new escrow upload.

Current limitations

  • OIDC env pull requires a personal Pro project or an organization project with CI decryption enabled.
  • Initial organization decryption setup requires an owner or admin with the current shared key.
  • GitLab.com policies use the stable numeric project ID. LPM.dev Registry does not accept tokens from self-managed GitLab issuers.
  • Policies allow branch runs only. The Registry rejects a token for a tag, even if the tag name matches an allowed branch.
  • The dashboard does not manage OIDC policies for personal projects.

For detailed CLI behavior, see the LPM CLI environment reference.

See also

  • Cloud sync explains the personal encrypted vault and the escrow exception.
  • Organization sharing explains the separate organization key model.
  • CI/CD explains how to configure package installation and publishing in CI.