Skip to Content
flowpact

FP205 · undeclared-secret-ref

A reusable workflow reads a secret it does not declare, and some caller does not use `secrets: inherit`.

CodeNameCategoryDefault severityReported by
FP205undeclared-secret-refSecrets🔴 errorlint, check, the action, the editor

Why it matters

Inside a called workflow only declared (or inherited) secrets exist. Reading anything else yields an empty string, so authentication steps fail late or, worse, fall back to anonymous access.

How to fix

Declare the secret under on.workflow_call.secrets and pass it from every caller, or use secrets: inherit. Callers whose with: values make the reading job's or step's if: false (e.g. an omitted input in if: contains(inputs.registries, 'docker.io')) are not counted: the read never runs for them. Neither are reads under an if: that is always false (if: false). For a remote reusable workflow, which you cannot change: call it with secrets: inherit (it passes secrets within one organization or enterprise), ask its maintainers to declare the secret, or add an override.

Example

on:
  workflow_call: {}   # declares no secrets
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - run: ./deploy.sh
        env:
          TOKEN: ${{ secrets.DEPLOY_TOKEN }}   # empty unless the caller uses secrets: inherit

Scope

Reads where GitHub allows no secrets (an input default, a workflow_call output, jobs.<id>.with, if or name) are refused rather than empty, and not reported. For a remote reusable workflow, the secrets come from the remote interfaces lockfile, which flowpact remotes update fills only with reads that run on every call: none under an if: (on the step, the job, or a job it needs), none in a condition. A secret the call passes by name is left to FP202.

Accept one finding

When a finding is intended, accept it with a reason rather than turning the rule off. It is listed apart from the other findings, and does not fail the build.

On its line, with an ignore comment alone on the line above it (the editor's quick fix adds it there) or at the end of the line, after any other comment such as a version (# v4.3.0 # flowpact: ignore[FP205] why):

.github/workflows/ci.yml
# flowpact: ignore[FP205] why it is acceptable here
<the line of the finding>

In the config, with an override, which can expire:

.github/flowpact/flowpact.config.yml
overrides:
  - rule: FP205
    target: <the finding's symbol>
    reason: Why it is acceptable here, at least 10 characters.
    expires: YYYY-MM-DD   # optional

target is the symbol the finding is about; to list them:

flowpact lint --format json | jq -r '.findings[] | select(.code == "FP205") | .symbol'

* matches within a path segment and ** across segments, so one entry accepts every finding whose symbol matches: target: '**#inputs.app-id' is that input in every workflow and action.

Change the severity

Change the severity (or turn the rule off) in .github/flowpact/flowpact.config.yml, by code or by name:

.github/flowpact/flowpact.config.yml
rules:
  FP205: off
  # or: undeclared-secret-ref: error

Explain it in the terminal:

flowpact explain FP205
  • FP204 secrets-inherit: secrets: inherit hands every repository secret to the callee; flowpact lists what is actually needed.
  • FP201 missing-required-secret: A reusable workflow is called without one of its required secrets.
  • Remote interfaces

On this page