Skip to content

Declare contents: read on python-validation and yaml-validation#1176

Open
arpitjain099 wants to merge 1 commit into
Azure:mainfrom
arpitjain099:ci/add-permissions
Open

Declare contents: read on python-validation and yaml-validation#1176
arpitjain099 wants to merge 1 commit into
Azure:mainfrom
arpitjain099:ci/add-permissions

Conversation

@arpitjain099
Copy link
Copy Markdown

Two lint-only workflows currently rely on the default GITHUB_TOKEN scope, which can include write access to several scopes depending on org/repo defaults. This PR pins both jobs to contents: read, matching the per-job permissions style already used in terraform-validation.yml.

  • python-validation.yml: only runs pylint + pytest on changed files.
  • yaml-validation.yml: only runs yamllint.

Neither touches issues, PRs, releases, packages, or pages, so contents: read is sufficient. Validated by yaml.safe_load on each edited file.

Both workflows only checkout the repo and run lint/test commands locally,
so the default GITHUB_TOKEN's scope can be pinned to read-only. Uses the
per-job permissions style already in terraform-validation.yml.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces the default GITHUB_TOKEN privileges for two lint-only GitHub Actions workflows by explicitly scoping job permissions to contents: read, aligning them with the existing least-privilege pattern used elsewhere (e.g., terraform-validation.yml).

Changes:

  • Set permissions: contents: read for the yaml-validation job.
  • Set permissions: contents: read for the python-validation job.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/yaml-validation.yml Pins the YAML lint job’s token permissions to contents: read.
.github/workflows/python-validation.yml Pins the Python lint/test job’s token permissions to contents: read.

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