Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: least privileged GITHUB_TOKEN permissions #2395

Merged

Conversation

ricardoapl
Copy link
Contributor

@ricardoapl ricardoapl commented May 22, 2024

What this PR does / why we need it:

The GITHUB_TOKEN is an automatically generated secret to make authenticated calls to the GitHub API. GitHub recommends setting minimum token permissions for the GITHUB_TOKEN, otherwise attackers may use a compromised token with write access to, for example, push malicious code into the project.

Found in CLOMonitor Checks and OpenSSF Scorecard Report.

How does this change affect the cardinality of KSM:

Does not change cardinality

Which issue(s) this PR fixes:

Part of #2274

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 22, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 22, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 22, 2024
@ricardoapl ricardoapl changed the title Least privileged GITHUB_TOKEN permissions ci: least privileged GITHUB_TOKEN permissions May 22, 2024
@mrueg
Copy link
Member

mrueg commented May 28, 2024

If #2398 is getting merged, will this workflow work with only read permissions?

@ricardoapl
Copy link
Contributor Author

If #2398 is getting merged, will this workflow work with only read permissions?

That's a good point, the workflow will not work with read only permissions then.

I suggest we keep default top-level permissions to read-only, but add contents: write permissions at job-level to #2398.

Although perhaps unlikely, there's a chance that a new job is added to this workflow, and its permissions could be left undefined because of human error.

What do you think?

@mrueg
Copy link
Member

mrueg commented Jun 14, 2024

Sounds good to me, let's mark this read-only for now.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 14, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrueg, ricardoapl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 14, 2024
@k8s-ci-robot k8s-ci-robot merged commit 89f0db6 into kubernetes:main Jun 14, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants