Skip to content

Potential fix for code scanning alert no. 6: Workflow does not contain permissions#307

Merged
robgruen merged 1 commit intomainfrom
alert-autofix-6
Mar 3, 2026
Merged

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

Conversation

@robgruen
Copy link
Contributor

@robgruen robgruen commented Mar 3, 2026

Potential fix for https://github.com/microsoft/TypeChat/security/code-scanning/6

In general, the fix is to explicitly define a permissions: block either at the workflow root (top-level, applying to all jobs) or at the job level (per job). For this workflow there is a single job pyright, so adding permissions: at the job level is sufficient and clearly scoped. Since the job only needs to read the repository contents and does not intentionally write to code, issues, or PRs, we can safely restrict the token to contents: read. If later it turns out that jakebailey/pyright-action or other steps require additional scopes (e.g., checks: write or pull-requests: write), those can be added explicitly.

The single best minimal change, without altering existing functionality, is to add a permissions: section under jobs.pyright (aligned with strategy: and runs-on:). We’ll set:

permissions:
  contents: read

This ensures the workflow has an explicitly read-only token for repository contents, documenting intent and preventing accidental broad write access if repo/org defaults are permissive. No additional imports or external definitions are needed, as this is purely a YAML configuration change in .github/workflows/ci.python.yml.

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>
@robgruen robgruen marked this pull request as ready for review March 3, 2026 19:21
@robgruen robgruen requested a review from gvanrossum March 3, 2026 19:22
@robgruen robgruen marked this pull request as draft March 3, 2026 19:25
Copy link
Collaborator

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

@robgruen robgruen marked this pull request as ready for review March 3, 2026 19:28
@robgruen robgruen merged commit afe7955 into main Mar 3, 2026
12 of 15 checks passed
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.

2 participants