Skip to content

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

Merged
remdui merged 1 commit intomainfrom
alert-autofix-1
Mar 24, 2026
Merged

Potential fix for code scanning alert no. 1: Workflow does not contain permissions#3
remdui merged 1 commit intomainfrom
alert-autofix-1

Conversation

@remdui
Copy link
Copy Markdown
Member

@remdui remdui commented Mar 24, 2026

Potential fix for https://github.com/HauntedMC/DataProvider/security/code-scanning/1

In general, the fix is to add an explicit permissions block either at the workflow root (to apply to all jobs) or directly under the lint job (to scope permissions per job). Since there is only one job shown and it only needs to read the repository code, we can set contents: read. This both documents the intended privilege level and prevents the GITHUB_TOKEN from having unnecessary write access if repository defaults are permissive.

The best targeted fix without changing existing functionality is to add a job-level permissions block under jobs.lint with contents: read. actions/checkout@v6 works with contents: read, and the Maven Checkstyle run does not require any GitHub write permissions. Concretely, in .github/workflows/ci-lint.yml, insert:

    permissions:
      contents: read

immediately after the runs-on: ubuntu-latest line (line 16 in the snippet). No imports or additional methods are required; this is purely a YAML workflow configuration change.

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>
Signed-off-by: Remy Duijsens <remyduijsens@gmail.com>
@remdui remdui marked this pull request as ready for review March 24, 2026 21:15
@remdui remdui merged commit f4ca5a6 into main Mar 24, 2026
7 checks passed
@remdui remdui deleted the alert-autofix-1 branch March 24, 2026 21:15
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.

1 participant