SKY-D323 · CI/CD pipelines
GitLab CI secret that does not name its ID token
A GitLab job can fetch secrets from Vault or another secrets manager by logging in with an ID token from id_tokens:. When the job has more than one ID token, each entry under secrets: should say which one to use with token:. SKY-D323 reports an entry that does not.
- Languages
- GitLab CI
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
- Catalog name
- GitLab CI ambiguous secret token
Why it matters
Each ID token is made for one audience, such as AWS or Vault. If the file does not say which one goes to Vault, a token meant for AWS can be the one sent, and whoever runs or watches that Vault server receives a token AWS will accept for your project's role.
What Skylos flags
stages: [deploy] deploy-production: stage: deploy image: bitnami/kubectl:1.31.2 environment: production timeout: 20 minutes id_tokens: AWS_ID_TOKEN: aud: sts.amazonaws.com VAULT_ID_TOKEN: aud: https://vault.acme.example secrets: DATABASE_PASSWORD: vault: production/db/password@ops file: false script: - kubectl apply -f k8s/What Skylos leaves alone
stages: [deploy] deploy-production: stage: deploy image: bitnami/kubectl:1.31.2 environment: production timeout: 20 minutes id_tokens: VAULT_ID_TOKEN: aud: https://vault.acme.example secrets: DATABASE_PASSWORD: vault: production/db/password@ops file: false script: - kubectl apply -f k8s/Why Skylos leaves it alone
The secret names no token here either, but the job has only one ID token, made for Vault, so there is nothing else GitLab could send.
How Skylos decides
- Runs with
--danger(and-a). Reads every file named exactly.gitlab-ci.ymlin the scanned folder, skipping.git,node_modules,.venv,venv,build,distand cache folders. Files pulled in withinclude:are not read, and a file PyYAML's safe loader cannot read (for example one that uses!reference) is skipped. - Looks at every job, hidden
.templatejobs included, that has its ownsecrets:mapping. - Counts the job's ID tokens (its own
id_tokens, else the one underdefault:). Fewer than two: nothing to report. - An entry under
secrets:is ambiguous when notokenkey appears anywhere inside it. - One MEDIUM finding per job, naming the first ambiguous entry, on the first line of the file where that entry's name is written as a key.
How to fix it
Add token: to every entry under secrets:, pointing at the ID token made for that secrets manager.
stages: [deploy] deploy-production: stage: deploy image: bitnami/kubectl:1.31.2 environment: production timeout: 20 minutes id_tokens: AWS_ID_TOKEN: aud: sts.amazonaws.com VAULT_ID_TOKEN: aud: https://vault.acme.example secrets: DATABASE_PASSWORD: vault: production/db/password@ops file: falseAdded: token: $VAULT_ID_TOKEN script: - kubectl apply -f k8s/When it can be wrong
- Only the first ambiguous entry of a job is named; fix it and the next one is reported.
- If another job earlier in the file uses the same secret name as a key, the finding points at that earlier line.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put
# skylos: ignore[SKY-D323]and a reason on the reported line, or on the line directly above it. Skylos looks for that exact text, so write one rule per marker, with the ID in upper case.YAML secrets: # skylos: ignore[SKY-D323] both tokens have the same audience DATABASE_PASSWORD:[tool.skylos] ignore = ["SKY-D323"]turns the rule off for the whole project.