SKY-D311 · CI/CD pipelines
Artifact upload passes when files are missing
actions/upload-artifact only warns when its path matches no files, and the step still succeeds. SKY-D311 reports an upload step that does not set if-no-files-found: error.
- Languages
- GitHub Actions workflows, composite actions
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
- Catalog name
- GitHub Actions lax artifact upload
Why it matters
A build that silently produced nothing then shows green. The release job that downloads the artifact fails far from the cause, or ships without the binary, and a wrong path can go unnoticed for many releases.
What Skylos flags
name: Buildon: push: branches: [main]permissions: contents: readjobs: build: name: Build the CLI runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v4 with: persist-credentials: false - run: go build -o dist/app ./cmd/app - uses: actions/upload-artifact@v4 with: name: app-linux path: dist/appWhat Skylos leaves alone
name: Buildon: push: branches: [main]permissions: contents: readjobs: build: name: Build ${{ matrix.goos }} runs-on: ubuntu-latest timeout-minutes: 20 strategy: matrix: goos: [linux, darwin, windows] steps: - uses: actions/checkout@v4 with: persist-credentials: false - run: GOOS=${{ matrix.goos }} go build -o dist/ ./cmd/app - uses: actions/upload-artifact@v4 with: name: app-${{ matrix.goos }} path: dist/ if-no-files-found: error retention-days: 7Why Skylos leaves it alone
The matrix, the expressions in the name and the broad dist/ path do not matter to this rule. The step sets if-no-files-found: error, so a build that wrote nothing fails the job instead of passing.
How Skylos decides
- Reads workflow files under
.github/workflowsand composite actions (action.yml,action.yaml). - Checks every step whose
uses:isactions/upload-artifactat any version. Other actions, includingactions/upload-artifact/merge, are not read. - Reports the step unless its
with:setsif-no-files-foundtoerror(any letter case).warn,ignore, a missing value and an expression are all reported. - Reports LOW on the first line of the file that contains the step's
uses:text. Steps with the sameuses:text give one finding there.
How to fix it
Add if-no-files-found: error to uploads of build output. Keep warn or ignore only for files that may legitimately be absent, such as logs uploaded after a failure, and mark those steps.
name: Buildon: push: branches: [main]permissions: contents: readjobs: build: name: Build the CLI runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v4 with: persist-credentials: false - run: go build -o dist/app ./cmd/app - uses: actions/upload-artifact@v4 with: name: app-linux path: dist/appAdded: if-no-files-found: errorWhen it can be wrong
- Uploads of optional files, such as test logs after a failure, set
ignoreon purpose and are still reported. - Two upload steps with the same
uses:text, for exampleactions/upload-artifact@v4, give one finding on the first such line, even when that step setserrorand a later one does not. A marker must then go on that first 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-D311] <reason>on the reporteduses:line or on the line directly above it, one rule per marker.YAML # skylos: ignore[SKY-D311] logs exist only when tests fail- uses: actions/upload-artifact@v4 if: failure()[tool.skylos] ignore = ["SKY-D311"]turns the rule off for the whole project. A baseline also works, but it records the absolute file path and line, so it stops matching when the checkout moves or lines above the finding change.