Skip to content

Potential fix for code scanning alert no. 36: Workflow does not contain permissions#2380

Open
dscpinheiro wants to merge 1 commit into
devfrom
alert-autofix-36
Open

Potential fix for code scanning alert no. 36: Workflow does not contain permissions#2380
dscpinheiro wants to merge 1 commit into
devfrom
alert-autofix-36

Conversation

@dscpinheiro
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/aws/aws-lambda-dotnet/security/code-scanning/36

Add an explicit top-level permissions block in .github/workflows/change-file-in-pr.yml so the workflow does not inherit potentially broad defaults.
Best fix without changing functionality: set:

  • contents: read

This is sufficient for the displayed steps (actions/checkout, reading changed files, and shell checks) and aligns with CodeQL’s minimal recommendation.
Change location: near the top of the workflow, after the on: trigger block and before jobs:.

No imports, methods, or external dependencies are needed.

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

…in 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 May 15, 2026 14:29
@dscpinheiro dscpinheiro requested review from a team as code owners May 15, 2026 14:29
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 Actions token permissions to the PR change-file validation workflow to reduce inherited default permissions.

Changes:

  • Adds a top-level permissions block to .github/workflows/change-file-in-pr.yml.
  • Grants contents: read for checkout and repository content access.

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

types: [opened, synchronize, reopened, labeled]

permissions:
contents: read
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure this is accurate... The action ran successfully: https://github.com/aws/aws-lambda-dotnet/actions/runs/25923334173/job/76197870515

(The failure is because my branch doesn't have a change file, but seems to be working as expected)

@GarrettBeatty
Copy link
Copy Markdown
Contributor

similar to this pr #2368 i didnt realize there was an issue

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