Skip to main content

SKY-D301 · CI/CD pipelines

Container registry password written in the workflow

High

A job that runs inside a private container image, or starts a private service container, gives GitHub a credentials: block with a username and password for the registry. SKY-D301 reports a password written as plain text there instead of read from secrets.

Languages
GitHub Actions workflows
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
GitHub Actions hardcoded container credential
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Everyone who can read the repository, its forks or its Git history can copy the password and pull, or with a write token push, images in your registry. A pushed image then runs in every job and deployment that uses that tag.

What Skylos flags

.github/workflows/integration.yml · YAMLReported on line 14
name: Integration testson:  push:    branches: [main]permissions:  contents: readjobs:  integration:    runs-on: ubuntu-latest    container:      image: acme/ci-runner:2024.10      credentials:        username: acme-ci        password: dckr_pat_Handbook0nlyDemoValue12345    steps:      - run: make integration

What Skylos leaves alone

.github/workflows/integration.yml · YAML
name: Integration testson:  push:    branches: [main]permissions:  contents: readjobs:  integration:    runs-on: ubuntu-latest    container:      image: acme/ci-runner:2024.10      credentials:        username: acme-ci        password: ${{ secrets.DOCKERHUB_TOKEN }}    services:      postgres:        image: postgres:16        env:          POSTGRES_PASSWORD: postgres    steps:      - run: make integration

Why Skylos leaves it alone

The registry password comes from a secret. POSTGRES_PASSWORD is a password too, but it only sets up a throwaway test database inside the job, and the rule reads nothing but the password of a credentials: block.

How Skylos decides

  1. Reads workflow files under .github/workflows, not composite actions.
  2. For each job, looks at container.credentials and at services.<name>.credentials.
  3. Reports the password when it is a text value that does not contain ${{. Any expression counts as safe (secrets.*, vars.*, env.*); a number, or a password left out, is not reported.
  4. One HIGH finding per job container or service, on the first line of the file that contains the password text.

How to fix it

Revoke the exposed token in the registry first, because it stays in Git history. Store a new one as a repository or environment secret and read it with ${{ secrets.NAME }}.

.github/workflows/integration.yml · YAML · the fix, against the flagged file
name: Integration testson:  push:    branches: [main]permissions:  contents: readjobs:  integration:    runs-on: ubuntu-latest    container:      image: acme/ci-runner:2024.10      credentials:        username: acme-ciRemoved:         password: dckr_pat_Handbook0nlyDemoValue12345Added:         password: ${{ secrets.DOCKERHUB_TOKEN }}    steps:      - run: make integration

When it can be wrong

  • A placeholder such as password: changeme in a template workflow is reported like a real one.
  • The line is the first one in the file containing the password text, so a short password that also appears earlier (for example equal to the username) is reported on that earlier line.
  • The flagged example also gets SKY-D296 for its image tagged 2024.10 rather than pinned by digest.

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-D301] on the reported line or on the line directly above it, one rule per marker. Rotating the password is the better answer.

    YAML
    # skylos: ignore[SKY-D301] read-only token for a public mirrorpassword: public-mirror-read
  • [tool.skylos] ignore = ["SKY-D301"] turns the rule off for the whole project.

  • A baseline works, but it records the absolute file path and the line, so it stops matching when the checkout moves or lines above shift.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.