Documentation · Usage · Reading credentials

CI integrations

A pipeline reads its credentials in one step, with the job's own OIDC token, so nothing secret is stored in the CI system. There is a GitHub Action, a Buildkite plugin and a GitLab template.

PlatformIntegrationValues masked in the log
GitHub, Forgejo and Gitea Actionscredvane-actionYes, each line of a multi-line value too
Buildkitecredvane-buildkite-pluginYes, with the agent's redactor
GitLab CIA template in credvane-cli to includeNo: GitLab cannot mask values set while a job runs

Each one asks the platform for a token with the audience <url>/w/<identity>, reads the specs from the credentials API, and sets an environment variable per spec for the rest of the job. If any read fails, the step fails before any variable is set. The action makes the calls itself and downloads nothing. The Buildkite plugin and the GitLab template install a release of the command line, check its SHA-256, and run it.

The integrations are tested against stand-ins (a fake Credvane, runner and agent), not yet on real GitHub, Forgejo or Gitea runners, Buildkite agents or GitLab runners. See the roadmap.

Before you start

Credvane must trust the job: an identity holding the specs, with a trust policy for the platform's issuer and the pipeline. Note the identity's id, on its page: every integration needs it, or the policy's audience.

InputMeaning
urlCredvane's address
identityThe identity's id; the token's audience is <url>/w/<identity>. On GitLab the audience goes in id_tokens: instead
credentialsSpec keys, each optionally spec-key=ENV_NAME. The default name is the key in capitals with - and . as _: deploy-key becomes DEPLOY_KEY
policyThe trust policy's name, when several match
audienceInstead of identity, when the policy's audience is something else

GitLab takes the same inputs as CREDVANE_* variables.

GitHub, Forgejo and Gitea Actions

permissions:
  id-token: write                 # lets the job ask for an OIDC token
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: commitwisedev/credvane-action@v1      # pin a commit SHA in production
        with:
          url: https://credvane.example.com
          identity: 0f3b6c1e-...
          credentials: |
            deploy-key
            npm-token=NPM_TOKEN
      - run: ./deploy.sh                          # sees DEPLOY_KEY and NPM_TOKEN
  • Forgejo and Gitea: use the full address, uses: https://github.com/commitwisedev/credvane-action@v1. Forgejo also needs enable-openid-connect: true on the workflow or job. Gitea's Actions OIDC is not in a Gitea release yet; the same action works once it is.
  • Pull requests from forks get no OIDC token on any of the three, so the step fails and says so.
  • Versions: v1 of the action calls Credvane's API v1, so @v1 keeps working. Pin a commit SHA in production and let a dependency bot update it.

Buildkite

steps:
  - command: ./deploy.sh                  # sees DEPLOY_KEY and NPM_TOKEN
    plugins:
      - commitwisedev/credvane#v1.0.0:
          url: https://credvane.example.com
          identity: 0f3b6c1e-...
          credentials:
            - deploy-key
            - npm-token=NPM_TOKEN
  • Needs buildkite-agent 3.70.0 or later. Without its redactor the step fails rather than read a value it cannot hide.
  • Write each credential as a string (npm-token=NPM_TOKEN), not a map entry.
  • The trust policy must require the pipeline as well as the Buildkite organization: every Buildkite customer shares the same issuer.
  • Options pick the CLI release, its expected SHA-256, a mirror, or a CLI already on the agent.

GitLab CI

include:
  - remote: https://raw.githubusercontent.com/commitwisedev/credvane-cli/<release>/integrations/gitlab/credvane.gitlab-ci.yml

deploy:
  extends: .credvane:read
  id_tokens:
    CREDVANE_ID_TOKEN:
      aud: https://credvane.example.com/w/0f3b6c1e-...   # the trust policy's audience
  variables:
    CREDVANE_URL: https://credvane.example.com
    CREDVANE_CREDENTIALS: deploy-key npm-token=NPM_TOKEN
  script:
    - ./deploy.sh                                         # sees DEPLOY_KEY and NPM_TOKEN
  • The aud: must be the policy's audience. A mismatch is the most common failure.
  • A job with its own before_script replaces the template's; start yours with - !reference [.credvane:read, before_script].
  • GitLab does not mask these values. Do not print them, keep CI_DEBUG_TRACE off, and never write them to an artifact or a dotenv report. Where one command needs them, credvane run --oidc gitlab deploy-key -- ./deploy.sh keeps them out of the job's shell.

When something goes wrong

MessageWhat to do
this job has no OIDC tokenAdd permissions: id-token: write (Forgejo: enable-openid-connect: true). Fork pull requests cannot read
$CREDVANE_ID_TOKEN is emptyGitLab: add the id_tokens: stanza with the policy's audience
Credvane did not trust the OIDC tokenCheck the issuer on Identities → Issuers
no trust policy lets this token read …Compare the issuer, audience and claims the message lists with the policy
several trust policies match this tokenSet policy