detect caller/callee permission mismatch in reusable workflow calls#670
Open
SeriousBug wants to merge 3 commits into
Open
detect caller/callee permission mismatch in reusable workflow calls#670SeriousBug wants to merge 3 commits into
SeriousBug wants to merge 3 commits into
Conversation
GitHub validates `permissions:` at workflow load time. When a job in a called reusable workflow declares a scope the calling job does not grant, the run aborts with startup_failure before any job (including if: failure() handlers) can run. Add a check under the existing workflow-call rule that compares each callee job's effective permissions against the caller's effective grant and reports each missing scope. The check ignores `if:` on callee jobs because GitHub evaluates permissions regardless of the runtime gate. When the caller declares no permissions: block at all, assume GitHub's restricted default token (contents/packages read). This default can be overridden via the new `assume-default-permissions` config knob, which mirrors the repository-level Workflow permissions setting that actionlint cannot read from the workflow file. Set to `permissive` to skip the comparison when the caller is fully silent.
Drop the 'fully silent' jargon and spell out what it means: caller has no permissions: block at the workflow level and none on the calling job.
- fix permissive mode silently skipping id-token (always requires opt-in) - restore WriteWorkflowCallEvent signature; add WriteWorkflowCallEventFromWorkflow - clamp callee values symmetrically so id-token: read collapses to none - remove dead !callerSilent branch via callerLevel/silentDefaultLevel split - drop unused scope param from permissionLevel - replace sort.Strings with slices.Sort; use n.Kind == 0 for node absence - update docs to call out id-token exception under permissive - add tests for id-token, write-all callee, clamping, unknown scopes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub validates
permissions:at workflow load time. When a job in a called reusable workflow declares a scope the calling job does not grant, the run aborts withstartup_failurebefore any job can run.This PR adds a check under the existing
workflow-callrule that compares each callee job's effective permissions against the caller's effective grant and reports each missing scope.When the caller has no
permissions:block at the workflow level and none on the calling job, the check assumes GitHub's restricted default token (contents: read+packages: read). This mirrors the repo-level "Workflow permissions" setting (Settings → Actions → General), which actionlint can't read from the workflow file. So unfortunately we need to introduce a config for this,assume-default-permissions:restricted(default) — assume the restricted defaultpermissive— assume read+write on everything, which effectively skips the check for callers with no permissions blockCloses #552