FP613 · ungranted-permissions
A job of a called workflow requests a permission the call does not grant.
| Code | Name | Category | Default severity | Reported by |
|---|---|---|---|---|
FP613 | ungranted-permissions | Graph structure | 🔴 error | lint, check, the action, the editor |
What you see
In the call-permissions fixture:
✖ ERROR FP613 ungranted-permissions
.github/workflows/publish.yml › jobs.npm requests contents: write, packages: write, but jobs.publish grants contents: read, packages: none
▶ .github/workflows/release.yml:5:1Why it matters
A called workflow's jobs run with the caller's GITHUB_TOKEN and can only keep or lower its permissions. GitHub refuses the whole run when it starts ("The nested job … is requesting 'contents: write', but is only allowed 'contents: read'").
How to fix
Grant the permission in the calling job's permissions:; a job's permissions: replaces the workflow's for that job only. If the called job does not need it, lower its permissions: instead.
Example
permissions:
contents: read
jobs:
release:
uses: ./.github/workflows/release.yml # its job publish requests contents: writeScope
What a call grants is the calling job's permissions:, else its workflow's. With neither, it gets the repository's or organization's default, which flowpact cannot see, so the call is not checked; when the calling workflow is itself called, the workflows it calls are checked against what its callers grant instead. What a called job requests is its permissions:, else its workflow's (reported once for every job that uses them); a job with neither gets what the call grants. A called job that calls another workflow requests its permissions for all of it, and the jobs of that workflow are checked against them at that call. Jobs are checked whatever their if:, as GitHub checks them before any job starts. A remote reusable workflow is checked against what the remote interfaces lockfile records: its jobs' permissions:, and its own for the jobs that have none (an entry written before flowpact recorded them has neither until flowpact remotes update). A job of it that calls another workflow without permissions is not followed. Whether a job requests more than it needs is not checked.
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[FP613] why):
# flowpact: ignore[FP613] why it is acceptable here
permissions:In the config, with an override, which can expire:
overrides:
- rule: FP613
target: ".github/workflows/release.yml#jobs.publish.permissions"
reason: Why it is acceptable here, at least 10 characters.
expires: YYYY-MM-DD # optionaltarget is the symbol the finding is about; to list them:
flowpact lint --format json | jq -r '.findings[] | select(.code == "FP613") | .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:
rules:
FP613: off
# or: ungranted-permissions: errorExplain it in the terminal:
flowpact explain FP613Related
FP609callee-not-reusable: A job calls a local workflow that has noon.workflow_calltrigger.FP503schema-violation: The file does not match GitHub’s workflow / action schema (validated with GitHub’s own parser).- Remote interfaces
FP612 · remotes-lock-outdated
The remote interfaces lockfile lacks a remote workflow or action the repository uses, has one it no longer uses, or records another commit than the one a reference pins or GitHub’s actions.lock runs.
FP614 · actions-lock-unreadable
GitHub’s `.github/workflows/actions.lock` does not parse, or has a schema version flowpact does not read.