Skip to content

Potential fix for code scanning alert no. 2: Workflow does not contain permissions#80

Merged
MayuriXx merged 1 commit into
mainfrom
alert-autofix-2
Apr 27, 2026
Merged

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

Conversation

@MayuriXx
Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/XPEHO/spring_boot_java_random_user/security/code-scanning/2

Add an explicit permissions block in .github/workflows/sonar.yaml at the workflow root level (right after name: is the cleanest location).
For this workflow, the single best minimal non-breaking fix is:

  • contents: read

This satisfies CodeQL’s requirement and documents least privilege without changing behavior of existing steps.
If future runs require extra scopes (e.g., PR write access), those can be added later intentionally.

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>
@sonarqube-xpeho
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@MayuriXx MayuriXx marked this pull request as ready for review April 27, 2026 10:37
Copilot AI review requested due to automatic review settings April 27, 2026 10:37
Copy link
Copy Markdown
Contributor

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 minimal GitHub Actions token permissions to address code scanning alert #2 for the Sonar workflow.

Changes:

  • Define workflow-level permissions in .github/workflows/sonar.yaml
  • Set contents: read to document/enforce least-privilege access

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

@MayuriXx MayuriXx merged commit 545fc4c into main Apr 27, 2026
13 checks passed
@MayuriXx MayuriXx deleted the alert-autofix-2 branch April 27, 2026 14:03
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.

4 participants