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.
What the token allows
Section titled “What the token allows”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 |
Create the token
Section titled “Create the token”- Go to hub.leavory.com/security-gate.
- Click New token and give it a name that says where it runs, such as
payments-api · main pipeline. - Copy the value right away. Once you close the screen it isn’t shown again.
Minimum permissions in Azure DevOps
Section titled “Minimum permissions in Azure DevOps”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 |
Option 1: pipeline variable
Section titled “Option 1: pipeline variable”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 |
Option 2: variable group
Section titled “Option 2: variable group”- Pipelines → Library → + Variable group.
- Add the
LEAVORY_TOKENvariable and click the lock to make it secret. - 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.
- In the pipeline, reference the group:
variables: - group: leavoryRevoke and rotate
Section titled “Revoke and rotate”To rotate the token without any pipeline skipping the check:
- Create the new token (that’s what the second one is for).
- Update the
LEAVORY_TOKENvariable with the new value. - 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.