Skip to content

Potential fix for code scanning alert no. 1: Workflow does not contain permissions - #16

Merged
aeiwz merged 1 commit into
mainfrom
alert-autofix-1
Apr 28, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#16
aeiwz merged 1 commit into
mainfrom
alert-autofix-1

Conversation

@aeiwz

@aeiwz aeiwz commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/aeiwz/metbit/security/code-scanning/1

Add an explicit permissions block to the workflow so the GITHUB_TOKEN is constrained to least privilege.
The best minimal fix here is to set workflow-level permissions to contents: read, which satisfies checkout and typical read-only operations while avoiding unnecessary write access. This preserves existing behavior for this workflow’s shown steps (checkout, draft build, artifact upload) and addresses the CodeQL finding directly.

Change needed in .github/workflows/draft-pdf.yml:

  • Insert at the workflow root (after on: and before jobs:):
    • permissions:
    • contents: read

No imports, methods, or additional definitions 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>
Copilot AI review requested due to automatic review settings April 28, 2026 02:58
@aeiwz
aeiwz marked this pull request as ready for review April 28, 2026 02:58
@aeiwz
aeiwz merged commit b545b28 into main Apr 28, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

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 a GitHub code scanning alert by explicitly constraining GITHUB_TOKEN permissions in the Draft PDF workflow to follow least-privilege defaults.

Changes:

  • Adds an explicit workflow-level permissions block.
  • Sets contents: read to support checkout and read-only workflow operations while avoiding unnecessary write access.

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

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