Skip to content

ci: declare contents:read on the lint job#1077

Open
arpitjain099 wants to merge 2 commits into
nodejs:mainfrom
arpitjain099:chore/lint-permissions
Open

ci: declare contents:read on the lint job#1077
arpitjain099 wants to merge 2 commits into
nodejs:mainfrom
arpitjain099:chore/lint-permissions

Conversation

@arpitjain099

@arpitjain099 arpitjain099 commented May 14, 2026

Copy link
Copy Markdown

Pins the lint job to contents: read. The job only runs actions/checkout, actions/setup-node, npm install, and npm run lint. No GitHub API write.

Block sits on the job rather than at workflow scope on purpose: the second job (test) uses pkgjs/action's reusable node-test.yaml@v0, and a caller-level permissions block intersects with the callee's grant (which might need codecov-action's id-token write or similar). Scoping the new declaration to lint leaves the test job untouched.

Defense-in-depth motivation is the CVE-2025-30066 precedent: a compromised third-party action runs inside the existing job context with whatever scope the token was issued at; the explicit cap bounds the blast radius. Matches the workflow-level contents: read in commitlint.yml and the id-token: write + contents: read in release-please.yml. YAML validated locally with yaml.safe_load.

BEGIN_COMMIT_OVERRIDE
chore: declare contents:read on the GHA test workflow (#1077)
END_COMMIT_OVERRIDE

Comment thread .github/workflows/nodejs.yml Outdated
The lint job only runs eslint after checkout + setup-node. No GitHub
API write. The block sits on the job rather than at workflow scope
because the `test` job uses pkgjs/action's reusable node-test
workflow, and adding a caller-level permissions block would
intersect with the callee's grant.

Style matches the workflow-level permissions block in commitlint.yml
(contents:read) and release-please.yml (id-token:write + contents:read).

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099
arpitjain099 force-pushed the chore/lint-permissions branch from 21e6ded to 3aa779d Compare June 10, 2026 07:23
Per review, hoist the permissions block from the lint job to the
workflow scope so it applies as the default for all jobs.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099

Copy link
Copy Markdown
Author

Moved it to the top level, thanks.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.01%. Comparing base (37cc6f0) to head (263a4f5).
⚠️ Report is 38 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (37cc6f0) and HEAD (263a4f5). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (37cc6f0) HEAD (263a4f5)
8 6
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1077      +/-   ##
==========================================
- Coverage   71.72%   62.01%   -9.71%     
==========================================
  Files          41       46       +5     
  Lines        5895     7505    +1610     
==========================================
+ Hits         4228     4654     +426     
- Misses       1667     2851    +1184     

☔ View full report in Codecov by Harness.
📢 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.

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.

3 participants