Skip to content

Harden permissions and setup-node caching in typescript_tests.yml - #41499

Merged
derrickaw merged 2 commits into
masterfrom
codescan/gha-typescript-tests-hardening
Nov 23, 2026
Merged

derrickaw merged 2 commits into
masterfrom
codescan/gha-typescript-tests-hardening

Conversation

@derrickaw

@derrickaw derrickaw commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Note: this PR was auto-generated by tooling. Before moving it out of draft, the author has done a full review of the PR, specifically evaluating it on the following criteria:

  • The PR remediates confirmed, live Code Scanning finding(s) (CodeQL / zizmor) on master without altering intended public API or workflow semantics
  • The fix is minimal, idiomatic, and avoids suppressing alerts or masking underlying defects
  • Relevant unit tests, linters, and CI checks have been verified

If you have concerns with the PR or with the underlying methodology used to generate this, please comment below - they will be addressed by the author not the tooling :)

Summary

  • Resolves 12 open Code Scanning findings (CodeQL + zizmor) in .github/workflows/typescript_tests.yml:
    • CodeQL actions/missing-workflow-permissions (#38, #40, #41, #42) & zizmor/excessive-permissions (#1754, #1755, #1756, #1757, #1758): adds explicit least-privilege top-level permissions: contents: read across all four read-only test jobs.
    • zizmor/cache-poisoning (High / error, #3490, #3491, #3492): sets package-manager-cache: false on all three actions/setup-node@v7 steps so default automatic npm cache sharing is disabled on tag/push workflow triggers.

Verification

@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR hardens .github/workflows/typescript_tests.yml by setting explicit top-level contents: read permissions and disabling automatic package manager caching in actions/setup-node@v7 steps. The changes are minimal, safe, and appropriately remediate the CodeQL and zizmor security findings.

🔍 General Feedback

  • All jobs in typescript_tests.yml only require read access to repository contents, making top-level permissions: contents: read the right least-privilege setting.
  • Note (nit): permissions: was inserted right between the # This allows a subsequently queued workflow run to interrupt previous runs comment and concurrency:, slightly detaching the comment from the concurrency: block it describes.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

Comment thread .github/workflows/typescript_tests.yml Resolved
@github-actions github-actions Bot added build size/xs XS: <10 lines changed labels Nov 20, 2026
@derrickaw

Copy link
Copy Markdown
Collaborator Author

/gemini review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR hardens .github/workflows/typescript_tests.yml by declaring top-level permissions: contents: read and disabling automatic npm caching via package-manager-cache: false across all three actions/setup-node@v7 steps. The previous review comment regarding the placement of permissions: relative to the concurrency: comment has been cleanly resolved.

🔍 General Feedback

  • The workflow permissions follow the principle of least privilege, as all four jobs only require read access to check out the repository and run tests.
  • Setting package-manager-cache: false appropriately mitigates zizmor/cache-poisoning findings on push/tag triggers without altering test execution semantics.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@derrickaw derrickaw added ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review and removed ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review labels Nov 20, 2026
@derrickaw
derrickaw marked this pull request as ready for review November 21, 2026 02:26
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @Abacn for label build.
Backup reviewer: damccorm (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@derrickaw

Copy link
Copy Markdown
Collaborator Author

Verified via sample workflow_dispatch run against codescan/gha-typescript-tests-hardening: https://github.com/apache/beam/actions/runs/45211008153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants