Skip to content

Potential fix for code scanning alert no. 4: Workflow does not contain permissions#15

Merged
prashanthvarma merged 1 commit intomainfrom
alert-autofix-4
Feb 4, 2026
Merged

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

Conversation

@prashanthvarma
Copy link
Collaborator

Potential fix for https://github.com/Graphiant-Inc/graphiant-sdk-python/security/code-scanning/4

In general, this issue is fixed by explicitly declaring a permissions block that limits the GITHUB_TOKEN to the least privilege necessary. For a linting/type-checking workflow that only needs to check out and read code, contents: read is normally sufficient. Declaring this at the workflow root applies to all jobs that do not override it; if some jobs need additional scopes they can define their own permissions blocks.

For this specific workflow, the simplest and safest fix without changing behavior is to add a root-level permissions block specifying read-only access to repository contents. This will apply to both flake8 and mypy jobs. No steps in the shown code need write access to the repo, issues, or pull requests, so we only grant contents: read. Concretely, in .github/workflows/lint.yml, insert:

permissions:
  contents: read

after the on: block and before jobs:. No additional imports or other definitions are required.

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: Prashanth Varma Manthena <me@prashanthvarma.com>
@prashanthvarma prashanthvarma marked this pull request as ready for review February 4, 2026 07:36
@prashanthvarma prashanthvarma requested a review from a team February 4, 2026 07:36
@prashanthvarma prashanthvarma merged commit 0d246d5 into main Feb 4, 2026
8 checks passed
@prashanthvarma prashanthvarma deleted the alert-autofix-4 branch February 4, 2026 07:36
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