Skip to content

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

Draft
simonwgill wants to merge 1 commit into
mainfrom
alert-autofix-10
Draft

Potential fix for code scanning alert no. 10: Workflow does not contain permissions#327
simonwgill wants to merge 1 commit into
mainfrom
alert-autofix-10

Conversation

@simonwgill

Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/citizensadvice/ca-cdk-constructs/security/code-scanning/10

Add an explicit top-level permissions block in .github/workflows/test.yaml so every job inherits minimal token scope by default.

Best fix here:

  • Insert at workflow root (after on is fine) :
    • permissions:
    • contents: read

Why this is best:

  • It addresses the CodeQL finding directly.
  • It keeps behavior unchanged for current jobs (they mainly need repository read access for checkout).
  • It applies consistently across all jobs (typecheck, test, checks-successful) without duplicating config.
  • If a future job needs write access, that specific job can override with a job-level permissions block.

No imports, methods, or dependencies are needed.

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

…in permissions

GitHub was catching the lack of permission definitions as a CodeQL issue and suggested this change.

Looks sensible to me.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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