SKY-D363 · CI/CD pipelines
GitHub Actions obfuscated action path or expression
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
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
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 pytestWhat Skylos leaves alone
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 pytestWhy 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
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}" > ~/.npmrcNot flagged
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}" > ~/.npmrcWhy 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
- Reads workflow files under
.github/workflowsandaction.yml/action.yamlcomposite actions. - Checks every job-level and step-level
uses:that names a repository (owner/repo/path@ref, not./local, notdocker://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. - Reads every
${{ … }}in the file, andif:conditions written without one. It works out the parts that use no context (literals, operators andformat,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 orfromJSON('…')of a literal, which is how lists and numbers are written. - Also reports
format('{0}', x)andfromJSON(toJSON(x))as LOW: both only give backx. An expression too large to work out within a fixed budget is skipped. - 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.
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 pytestWhen 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.