Skip to content

Commit 0261696

Browse files
Set read-only permissions for publish action (#58)
Potential fix for [https://github.com/esphome-libs/micro-opus/security/code-scanning/1](https://github.com/esphome-libs/micro-opus/security/code-scanning/1) Add an explicit `permissions` block to the `publish-platformio` job in `.github/workflows/publish.yml`, scoped to the minimal permission needed: `contents: read`. Best single fix without changing functionality: - Edit `.github/workflows/publish.yml` - In job `publish-platformio` (right after `environment` is a clear location), add: - `permissions:` - `contents: read` This preserves current behavior while enforcing least privilege for `GITHUB_TOKEN` in that job. No imports, methods, or additional definitions are needed. _Suggested fixes powered by Copilot Autofix. Review carefully before merging._ --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 18c22ea commit 0261696

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
release:
55
types: [published]
66

7+
# Least privilege: jobs only read the repo to check out and publish. Jobs that need more should
8+
# add a narrower job-level permissions block rather than widening this default.
9+
permissions:
10+
contents: read
11+
712
jobs:
813
publish-platformio:
914
name: Publish to PlatformIO
@@ -29,6 +34,7 @@ jobs:
2934
runs-on: ubuntu-latest
3035
environment: espressif
3136
permissions:
37+
contents: read
3238
id-token: write
3339
steps:
3440
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

0 commit comments

Comments
 (0)