[PR #10456] [MERGED] GitHub Workflows security hardening #13634

Closed
opened 2025-12-29 23:19:58 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/10456
Author: @sashashura
Created: 9/25/2022
Status: Merged
Merged: 9/29/2022
Merged by: @jeremystretch

Base: developHead: patch-1


📝 Commits (3)

  • f3c26ee build: harden lock.yml permissions
  • dac181a build: harden stale.yml permissions
  • 16d8d8c build: harden ci.yml permissions

📊 Changes

3 files changed (+12 additions, -0 deletions)

View changed files

📝 .github/workflows/ci.yml (+2 -0)
📝 .github/workflows/lock.yml (+5 -0)
📝 .github/workflows/stale.yml (+5 -0)

📄 Description

Closes: #10317

This PR adds explicit permissions section to workflows. This is a security best practice because by default workflows run with extended set of permissions (except from on: pull_request from external forks). By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an injection or compromised third party tool or action) is restricted.
It is recommended to have most strict permissions on the top level and grant write permissions on job level case by case.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/10456 **Author:** [@sashashura](https://github.com/sashashura) **Created:** 9/25/2022 **Status:** ✅ Merged **Merged:** 9/29/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `patch-1` --- ### 📝 Commits (3) - [`f3c26ee`](https://github.com/netbox-community/netbox/commit/f3c26ee7cc3dff72795632dc3f5516ba640ddf64) build: harden lock.yml permissions - [`dac181a`](https://github.com/netbox-community/netbox/commit/dac181a3233aaf7eaa4b28e676b59bd104794019) build: harden stale.yml permissions - [`16d8d8c`](https://github.com/netbox-community/netbox/commit/16d8d8c96092a66864cbd332aee1d72002682b0d) build: harden ci.yml permissions ### 📊 Changes **3 files changed** (+12 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+2 -0) 📝 `.github/workflows/lock.yml` (+5 -0) 📝 `.github/workflows/stale.yml` (+5 -0) </details> ### 📄 Description ### Closes: #10317 This PR adds explicit [permissions section](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions) to workflows. This is a security best practice because by default workflows run with [extended set of permissions](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) (except from `on: pull_request` [from external forks](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)). By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an [injection](https://securitylab.github.com/research/github-actions-untrusted-input/) or compromised third party tool or action) is restricted. It is recommended to have [most strict permissions on the top level](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions) and grant write permissions on [job level](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) case by case. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:19:58 +01:00
adam closed this issue 2025-12-29 23:19:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13634