Skip to content

fix: move CI permissions and env to job-level scope#141

Merged
jdutton merged 2 commits intomainfrom
fix/job-level-permissions
Mar 14, 2026
Merged

fix: move CI permissions and env to job-level scope#141
jdutton merged 2 commits intomainfrom
fix/job-level-permissions

Conversation

@jdutton
Copy link
Owner

@jdutton jdutton commented Mar 14, 2026

Summary

  • Move ci.permissions and ci.env from workflow-level to job-level in the generated validate.yml
  • Only the validate and coverage jobs receive these settings — the all-validation-passed gate job inherits nothing it doesn't need
  • concurrency remains at workflow level (governs the whole workflow)

Why

Security scanners (SonarQube, etc.) flag workflow-level permissions blocks as a vulnerability because they grant access to all jobs indiscriminately. The gate job only runs a bash if check on job results — it needs no special permissions, env vars, or registry access.

This makes the generated workflow more surgical: each job declares exactly what it needs, and the gate job runs with minimal defaults.

Breaking change?

No. The generated workflow produces identical CI behavior. The only difference is where permissions and env appear in the YAML (job-level vs workflow-level). Downstream repos will see a diff when they run generate-workflow after upgrading, but the workflow behavior is unchanged.

Test plan

  • All 2,471 unit tests pass (68 in generate-workflow.test.ts)
  • vv validate passes (Pre-Qualification + Testing)
  • Updated tests verify permissions/env are on validate job, NOT at workflow level
  • New tests verify gate job has no permissions or env
  • New tests verify coverage job gets permissions when enabled

🤖 Generated with Claude Code

…erated CI

Security scanners (e.g., SonarQube) flag workflow-level permissions as a
vulnerability because they grant access to all jobs, including the gate
job which only checks results and needs no special access.

Move ci.permissions and ci.env from workflow-level to individual job
definitions (validate and coverage jobs). The all-validation-passed gate
job inherits no unnecessary permissions or env vars. Concurrency remains
at workflow level as it governs the whole workflow.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.81%. Comparing base (c49c20e) to head (9f40a2e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #141   +/-   ##
=======================================
  Coverage   85.81%   85.81%           
=======================================
  Files         115      115           
  Lines       14990    14997    +7     
  Branches     3241     3242    +1     
=======================================
+ Hits        12863    12870    +7     
  Misses       2127     2127           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Consolidate generate-workflow fixes (job-level permissions, indentation,
build auto-detection) into a single changelog entry. Bump all packages
from 0.19.1-rc.1 to 0.19.1-rc.2.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@sonarqubecloud
Copy link

@jdutton jdutton merged commit 7683a37 into main Mar 14, 2026
9 checks passed
@jdutton jdutton deleted the fix/job-level-permissions branch March 14, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant