Skip to content

Create the token

The Security Gate step needs a token to download the publication-date database. The variable name in the pipeline is always LEAVORY_TOKEN.

The LEAVORY_TOKEN has a single purpose and no scopes to choose: it is exchanged for a temporary link (15 minutes) to download the signed date database.

The token allows The token does not allow
Downloading the publication-date database Reading or changing anything in your Leavory account
Accessing Azure DevOps, the repository or the registry
Sending the report or the pipeline code to Leavory

So if a token leaks, the risk is someone using up its daily limit. Even so, treat it as a secret and revoke it if it shows up in a log or a repository.

Rule Value
Calls per day, per token 30 (each step run makes one). Past the limit, the step skips the check with a warning
Active tokens per account 2, so you can rotate without stopping pipelines
  1. Go to hub.leavory.com/security-gate.
  2. Click New token and give it a name that says where it runs, such as payments-api · main pipeline.
  3. Copy the value right away. Once you close the screen it isn’t shown again.

The Use it in your pipeline card, on the same page, gives you a ready step to paste right after the Trivy scan. First it asks Which branches block the pipeline?:

Environment Default branches Block
Production main, master on
Staging release/*, staging, homolog on
Development develop, dev, feature/* off
Other branches any branch not listed off
  • Block on: a vulnerability over the deadline fails the pipeline, and the steps after it (image push, deploy) don’t run.
  • Block off: the step only warns. The run ends as Succeeded with issues, with each old vulnerability in the build summary, so the team keeps working while the fix is on the way.
  • Edit the lists with your own branches, comma-separated. * matches anything, including / (feature/* covers feature/a/b).
  • Pull requests follow the target branch: a pull request to main is checked as production, before the merge.
  • A branch in more than one list gets the first one that matches, from production down.

To stop vulnerabilities even in development, turn Block on there too. The snippet updates as you change the answers: just copy it.

To store the token you need one of the permissions below. Nothing else is required, and the pipeline needs no extra permission to use the token.

Where to store it Minimum permission for whoever sets it up When to use
Pipeline variable Edit build pipeline on the pipeline A single pipeline
Variable group (Library) Creator role in Pipelines → Library to create the group; Administrator on the group to grant pipelines Several pipelines with the same token

Pipelines → open the pipeline → Edit → Variables → New variable.

Field Value
Name LEAVORY_TOKEN
Value the copied token
Keep this value secret checked
Let users override this value when running this pipeline unchecked
  1. Pipelines → Library → + Variable group.
  2. Add the LEAVORY_TOKEN variable and click the lock to make it secret.
  3. Under Pipeline permissions, grant access only to the pipelines that run the Security Gate. Avoid Open access, which opens the group to any pipeline in the project.
  4. In the pipeline, reference the group:
variables:
- group: leavory

To rotate the token without any pipeline skipping the check:

  1. Create the new token (that’s what the second one is for).
  2. Update the LEAVORY_TOKEN variable with the new value.
  3. Revoke the old token in the Hub.

Pipelines with a revoked token keep running, but skip the check with a token-rejected warning until the variable is updated.