Skip to content

Add workflow permissions#19

Merged
tnotheis merged 3 commits intomainfrom
alert-autofix-3
Apr 10, 2026
Merged

Add workflow permissions#19
tnotheis merged 3 commits intomainfrom
alert-autofix-3

Conversation

@tnotheis
Copy link
Copy Markdown
Member

@tnotheis tnotheis commented Apr 9, 2026

Potential fix for https://github.com/js-soft/ts-utils/security/code-scanning/3

Add an explicit permissions block at the workflow root so it applies to all jobs (run-checks and test) unless overridden. The minimal safe permission for this workflow is:

  • contents: read

This preserves existing behavior (checkout/read operations still work) while enforcing least privilege for GITHUB_TOKEN.
Change .github/workflows/test.yml near the top-level keys: insert permissions: between on: and jobs: (or anywhere at workflow root level).

No imports, methods, or extra definitions are needed—just YAML config update.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@tnotheis tnotheis changed the title Potential fix for code scanning alert no. 3: Workflow does not contain permissions Add workflow permissions Apr 9, 2026
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@tnotheis tnotheis marked this pull request as ready for review April 9, 2026 15:26
Copilot AI review requested due to automatic review settings April 9, 2026 15:26
@tnotheis tnotheis added the ci label Apr 9, 2026
@tnotheis tnotheis self-assigned this Apr 9, 2026
@tnotheis tnotheis requested a review from stnmtz April 9, 2026 15:27
@tnotheis tnotheis enabled auto-merge (squash) April 9, 2026 15:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit GITHUB_TOKEN permission scoping in GitHub Actions workflows to address a code-scanning recommendation and enforce least privilege.

Changes:

  • Add workflow-level permissions: contents: read to the test workflow so it applies to all jobs.
  • Add job-level permissions: contents: read to the run-checks job in the publish workflow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/test.yml Adds workflow-root contents: read permissions for all jobs.
.github/workflows/publish.yml Adds explicit contents: read permission to the run-checks job (publish job already has explicit permissions).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/publish.yml Outdated
auto-merge was automatically disabled April 9, 2026 15:31

Head branch was pushed to by a user without write access

@tnotheis tnotheis enabled auto-merge (squash) April 10, 2026 06:32
@tnotheis tnotheis merged commit b9da8e7 into main Apr 10, 2026
2 checks passed
@tnotheis tnotheis deleted the alert-autofix-3 branch April 10, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants