Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#2320

Open
andyleejordan wants to merge 1 commit into
mainfrom
alert-autofix-3
Open

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#2320
andyleejordan wants to merge 1 commit into
mainfrom
alert-autofix-3

Conversation

@andyleejordan

Copy link
Copy Markdown
Member

Potential fix for https://github.com/PowerShell/PowerShellEditorServices/security/code-scanning/3

Add an explicit permissions block to the workflow so GITHUB_TOKEN is least-privileged by default.

Best fix here (without changing functionality): add at workflow root (after on and before jobs) a minimal permission set:

  • contents: read

This applies to all jobs unless overridden and is sufficient for this workflow’s current steps (not creating releases, commenting on PRs, or pushing commits).

File to edit:

  • .github/workflows/emacs-test.yml
  • Insert new lines between existing line 10 and line 12 (between trigger config and jobs:).

No imports, methods, or dependencies are needed.

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>
@andyleejordan andyleejordan marked this pull request as ready for review June 18, 2026 21:06
@andyleejordan andyleejordan requested a review from a team as a code owner June 18, 2026 21:06
Copilot AI review requested due to automatic review settings June 18, 2026 21:07
@andyleejordan andyleejordan enabled auto-merge (squash) June 18, 2026 21:07

Copilot AI 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.

Pull request overview

This PR addresses code scanning alert #3 ("Workflow does not contain permissions") by adding an explicit least-privilege permissions block to the emacs-test.yml GitHub Actions workflow. By default, GITHUB_TOKEN is granted broad permissions; scoping it to contents: read follows the principle of least privilege without changing the workflow's behavior, since all steps (checkout, build, run Emacs tests) only read repository contents.

Changes:

  • Added a root-level permissions: block with contents: read between the on triggers and the jobs definition.

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.

2 participants