SKY-D321 · CI/CD pipelines
GitLab CI release or OIDC job without a timeout
A GitLab job's timeout: says how long it may run before GitLab stops it. SKY-D321 reports a job that releases, deploys or receives OIDC tokens and sets no timeout, neither on the job nor under default:.
- Languages
- GitLab CI
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
- Catalog name
- GitLab CI privileged job missing timeout
Why it matters
Such a job then runs until the project's limit, which is one hour unless someone raised it. A deploy that hangs, or a job an attacker has taken over, keeps its deploy credentials and tokens usable for that whole time, and holds back the next release.
What Skylos flags
stages: [deploy] deploy-production: stage: deploy image: bitnami/kubectl:1.31.2 environment: production rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH script: - kubectl apply -f k8s/ - kubectl rollout status deployment/webWhat Skylos leaves alone
stages: [deploy] default: timeout: 20 minutes deploy-production: stage: deploy image: bitnami/kubectl:1.31.2 environment: production rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH script: - kubectl apply -f k8s/ - kubectl rollout status deployment/webWhy Skylos leaves it alone
The job sets no timeout of its own, but it inherits the 20 minutes from default:, and Skylos reads that.
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. - Checks jobs that are release-like or have
id_tokens/identity(their own or fromdefault:), hidden.templatejobs excluded. A job is release-like when its name containsdeploy,releaseorpublish, itsstageisdeploy,deployment,release,publishorproduction, itsenvironmentisprodorproduction, it hasrelease, or a command starts with a publish or deploy tool such askubectl apply,helm upgrade,terraform applyornpm publish. - Reports the job when neither it nor
default:setstimeout. Any value counts, however long; a top-leveltimeout:key is not read. - One LOW finding per job, on the first line that contains the job name followed by
:.
How to fix it
Give the job a timeout a little longer than its slowest normal run, or set one for every job under default:.
stages: [deploy] deploy-production: stage: deploy image: bitnami/kubectl:1.31.2 environment: productionAdded: timeout: 15 minutes rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH script: - kubectl apply -f k8s/Removed: - kubectl rollout status deployment/webAdded: - kubectl rollout status deployment/web --timeout=10mWhen it can be wrong
- A project whose CI/CD settings set a short timeout is still reported; Skylos reads only the file.
- A job is release-like by name alone, so
release-notes-previewwithout a timeout is reported.
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-D321]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 # skylos: ignore[SKY-D321] project timeout is 15 minutesdeploy-production:[tool.skylos] ignore = ["SKY-D321"]turns the rule off for the whole project.