Skip to content

Conversation

@abelcheung
Copy link
Owner

Potential fix for https://github.com/abelcheung/types-lxml/security/code-scanning/9

To fix the problem, explicitly restrict the GITHUB_TOKEN permissions for this workflow. Since all jobs only need to read repository contents (for actions/checkout) and do local type checking, we can add a workflow-level permissions block with contents: read. This will apply to all jobs that don’t override it, satisfying the least-privilege requirement and the CodeQL rule.

The single best fix without changing functionality is:

  • In .github/workflows/compat.yml, add a top-level permissions: section after the name: (or before on:) with contents: read.
  • This ensures that all jobs (mypy_compat, pyright_compat, basedpyright_compat, and pyrefly_compat) run with a read-only token, which is sufficient for actions/checkout and does not affect the existing logic of installing dependencies and running type checkers.

No imports or additional methods are needed; this is purely a YAML 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>
@abelcheung abelcheung self-assigned this Jan 9, 2026
@abelcheung abelcheung added the build/ci Issues related to building or CI/CD label Jan 9, 2026
@abelcheung abelcheung marked this pull request as ready for review January 9, 2026 13:42
@abelcheung abelcheung merged commit 05cfe2b into main Jan 9, 2026
4 checks passed
@abelcheung abelcheung deleted the alert-autofix-9 branch January 9, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/ci Issues related to building or CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants