SKY-D362 · CI/CD pipelines
GitHub Actions decoded secret printed unmasked
Some teams store several values in one secret as JSON and read a field with fromJSON(secrets.X).field. GitHub hides only the exact text it stored, so the decoded field is a new string the log does not mask. SKY-D362 reports such a value when it sits where GitHub prints it.
- Languages
- GitHub Actions workflows
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
GitHub shows a step's env:, its with: inputs and its script in the job log. A decoded API key in one of them appears in plain text, and anyone who can read the logs, which for a public repository is anyone, can copy it.
What Skylos flags
name: Deployon: push: branches: [main]permissions: contents: readjobs: deploy: runs-on: ubuntu-latest environment: production steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 with: persist-credentials: false - name: Upload the site env: DEPLOY_KEY: ${{ fromJSON(secrets.DEPLOY_CONFIG).api_key }} DEPLOY_HOST: ${{ fromJSON(secrets.DEPLOY_CONFIG).host }} run: ./scripts/deploy.shWhat Skylos leaves alone
name: Deployon: push: branches: [main]permissions: contents: readjobs: deploy: runs-on: ubuntu-latest environment: production steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 with: persist-credentials: false - name: Upload the site if: fromJSON(secrets.DEPLOY_CONFIG).enabled env: DEPLOY_KEY: ${{ secrets.DEPLOY_API_KEY }} DEPLOY_HOST: ${{ fromJSON(vars.DEPLOY_CONFIG).host }} run: ./scripts/deploy.shWhy Skylos leaves it alone
The key is its own secret, so GitHub masks it. The host is decoded from a configuration variable (vars), which is not secret. The one decoded secret sits in if:, which GitHub evaluates but never prints.
How Skylos decides
- Reads
*.ymland*.yamlworkflow files under.github/workflows. Composite actions are not checked for this rule. - Looks at every
${{ … }}in values GitHub prints: a step'srun,with,env,nameandworking-directory; a job'senv,outputs,name,runs-on,environmentandwith; matrix values; container and serviceimage,env,options,entrypointandargs; and the workflow'senv,nameandrun-name. Conditions, timeouts and a reusable call'ssecrets:are skipped. - Reports a
fromJSON()call whose input is a secret, when the decoded value or one of its fields flows out of the expression. The input can besecrets.Xitself orenv.XwhereXis set from a secret in the step, job or workflowenv:(followed up to four steps).secrets.GITHUB_TOKENpassed through a shell variable does not count. - One MEDIUM finding per decoded value, on the line where the expression appears.
How to fix it
Store each value that must stay hidden as its own secret and read it directly. Values that are not secret, such as a host name, can move to a configuration variable (vars).
name: Deployon: push: branches: [main]permissions: contents: readjobs: deploy: runs-on: ubuntu-latest environment: production steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 with: persist-credentials: false - name: Upload the site env:Removed: DEPLOY_KEY: ${{ fromJSON(secrets.DEPLOY_CONFIG).api_key }}Removed: DEPLOY_HOST: ${{ fromJSON(secrets.DEPLOY_CONFIG).host }}Added: DEPLOY_KEY: ${{ secrets.DEPLOY_API_KEY }}Added: DEPLOY_HOST: ${{ vars.DEPLOY_HOST }} run: ./scripts/deploy.shWhen it can be wrong
- A field that is not sensitive, such as a host name, is reported the same as a key, because Skylos cannot see what the JSON holds.
- A script that registers the decoded value with
::add-mask::before it is printed is still 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-D362]and a reason on the reported line or on the line directly above it, one rule per marker. A marker on one line also covers a finding on the line below it.YAML env: # skylos: ignore[SKY-D362] field is a public host name DEPLOY_HOST: ${{ fromJSON(secrets.DEPLOY_CONFIG).host }}[tool.skylos] ignore = ["SKY-D362"]turns the rule off for the whole project.