Skip to content

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

Merged
davep merged 1 commit into
mainfrom
alert-autofix-1
Feb 7, 2026
Merged

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

Conversation

@davep

@davep davep commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/davep/textual-enhanced/security/code-scanning/1

In general, the fix is to add an explicit permissions block that grants only the minimal required scopes to the GITHUB_TOKEN. For a code-quality workflow that only needs to read the repository contents, contents: read at the workflow or job level is sufficient. This ensures the workflow does not inherit broader default permissions from the repository or organization settings.

The best way to fix this specific workflow without changing functionality is to add permissions: contents: read at the workflow root, so it applies to all jobs (currently just style-lint-and-test). This keeps the job behavior unchanged (it only needs to read code and install dependencies) while constraining the token. Concretely, edit .github/workflows/code-checks.yaml near the top: after the name: Code quality tests line, insert a permissions: block. No imports or additional methods are needed, as this is pure GitHub Actions YAML configuration.

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

…ain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@davep davep added the Housekeeping General codebase housekeeping label Feb 7, 2026
@davep
davep marked this pull request as ready for review February 7, 2026 10:20
@davep
davep merged commit 11d9a2c into main Feb 7, 2026
8 checks passed
@davep
davep deleted the alert-autofix-1 branch February 7, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Housekeeping General codebase housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants