Skip to main content

SKY-D363 · CI/CD pipelines

GitHub Actions obfuscated action path or expression

Medium

MEDIUM for an action path with ., .. or empty segments. LOW for an expression that folds to a fixed value or only wraps another value.

A uses: path can contain .. or . segments, and a ${{ … }} expression can hide a fixed value or a plain reference behind format() or other functions. GitHub resolves both to something simpler than what the file shows. SKY-D363 reports these spellings.

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

Why it matters

Reviewers, allow lists and pinning rules match the text they see. A step written as actions/cache/restore/../save reads like a cache restore but runs actions/cache/save, which writes the cache; an action an allow list would block can be slipped past it the same way.

What Skylos flags

.github/workflows/ci.yml · YAMLReported on line 13
name: CIon:  pull_request:permissions:  contents: readjobs:  test:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955        with:          persist-credentials: false      - uses: actions/cache/restore/../save@5a3ec84eff668545956fd18022155c47e93e2684        with:          path: ~/.cache/pip          key: pip-${{ hashFiles('requirements.txt') }}      - run: python -m pip install -r requirements.txt      - run: python -m pytest

What Skylos leaves alone

.github/workflows/ci.yml · YAML
name: CIon:  pull_request:permissions:  contents: readjobs:  test:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955        with:          persist-credentials: false      - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684        with:          path: ~/.cache/pip          key: pip-${{ hashFiles('requirements.txt') }}      - run: python -m pip install -r requirements.txt      - run: python -m pytest

Why Skylos leaves it alone

An action in a subfolder of its repository, such as actions/cache/restore, is normal. Only ., .. and empty segments make the path say something other than what runs.

More languages

YAML

Flagged

.github/actions/npm-auth/action.yml · YAMLReported on line 8
name: npm authdescription: Writes the npm token for later stepsruns:  using: composite  steps:    - shell: bash      env:        TOKEN: ${{ format('{0}', inputs.npm-token) }}      run: echo "//registry.npmjs.org/:_authToken=${TOKEN}" > ~/.npmrc

Not flagged

.github/actions/npm-auth/action.yml · YAML
name: npm authdescription: Writes the npm token for later stepsruns:  using: composite  steps:    - shell: bash      env:        TOKEN: ${{ inputs.npm-token }}      run: echo "//registry.npmjs.org/:_authToken=${TOKEN}" > ~/.npmrc

Why Skylos leaves it alone

The input is read directly. format('{0}', x) gives the same text as x, so wrapping it only makes a search for inputs.npm-token miss it; that finding is LOW.

How Skylos decides

  1. Reads workflow files under .github/workflows and action.yml / action.yaml composite actions.
  2. Checks every job-level and step-level uses: that names a repository (owner/repo/path@ref, not ./local, not docker:// and not one built from ${{ … }}). A path segment that is ., .. or empty is reported as MEDIUM, with the plain path GitHub resolves it to when there is one.
  3. Reads every ${{ … }} in the file, and if: conditions written without one. It works out the parts that use no context (literals, operators and format, join, contains, startsWith, endsWith, case, toJSON, fromJSON). A part that always gives the same value is reported as LOW, unless it is a plain literal or fromJSON('…') of a literal, which is how lists and numbers are written.
  4. Also reports format('{0}', x) and fromJSON(toJSON(x)) as LOW: both only give back x. An expression too large to work out within a fixed budget is skipped.
  5. Reports on the line of the uses: value or of the expression.

How to fix it

Write the action path GitHub really runs, and write fixed values and references directly instead of wrapping them.

.github/workflows/ci.yml · YAML · the fix, against the flagged file
name: CIon:  pull_request:permissions:  contents: readjobs:  test:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955        with:          persist-credentials: falseRemoved:       - uses: actions/cache/restore/../save@5a3ec84eff668545956fd18022155c47e93e2684Added:       - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684        with:          path: ~/.cache/pip          key: pip-${{ hashFiles('requirements.txt') }}      - run: python -m pip install -r requirements.txt      - run: python -m pytest

When it can be wrong

  • A switch such as if: ${{ !true }}, used to pause a step for a while, is reported as LOW.
  • format('{0}', x) used on purpose to turn a number into text 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-D363] and a reason on the reported line or on the line directly above it, one rule per marker.

    YAML
    # skylos: ignore[SKY-D363] paused until the 2.0 migration landsif: ${{ !true }}
  • [tool.skylos] ignore = ["SKY-D363"] turns the rule off for the whole project.

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