Skip to content

Resolve codeql issues#100

Open
arielkr256 wants to merge 1 commit intomainfrom
codeql-fixes
Open

Resolve codeql issues#100
arielkr256 wants to merge 1 commit intomainfrom
codeql-fixes

Conversation

@arielkr256
Copy link
Contributor

Description
If a GitHub Actions job or workflow has no explicit permissions set, then the repository permissions are used. Repositories created under organizations inherit the organization permissions. The organizations or repositories created before February 2023 have the default permissions set to read-write. Often these permissions do not adhere to the principle of least privilege and can be reduced to read-only, leaving the write permission only to a specific types as issues: write or pull-requests: write.

Recommendations
Add the permissions key to the job or the root of workflow (in this case it is applied to all jobs in the workflow that do not have their own permissions key) and assign the least privileges required to complete the task:

name: "My workflow"
permissions:
contents: read
pull-requests: write
or

jobs:
my-job:
permissions:
contents: read
pull-requests: write
References
Assigning permissions to jobs

@arielkr256 arielkr256 requested a review from a team as a code owner May 9, 2025 14:59
@arielkr256 arielkr256 enabled auto-merge (squash) May 9, 2025 15:00
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