Skip to content

Commit 1713080

Browse files
Potential fix for code scanning alert no. 4: Workflow does not contain permissions (#1136)
Potential fix for [https://github.com/e2b-dev/E2B/security/code-scanning/4](https://github.com/e2b-dev/E2B/security/code-scanning/4) In general, the fix is to explicitly declare a `permissions:` block that grants only the minimal required scopes. Since this workflow only needs to read repository contents (to check out code and inspect git status/diff) and does not perform any writes via the GitHub API, `contents: read` is sufficient. The best minimally invasive fix is to add a `permissions:` block at the workflow root (top level, alongside `on:` and `jobs:`) so that it applies to all jobs in this workflow. Concretely, in `.github/workflows/generated_files.yml`, insert: ```yaml permissions: contents: read ``` between the `on:` block (lines 3–5) and the `jobs:` block (line 6). No changes to steps, images, or other configuration are required, and no additional imports or tools are needed. This documents the workflow’s needs and prevents it from gaining unintended write powers if repository defaults change. _Suggested fixes powered by Copilot Autofix. Review carefully before merging._ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Workflow-only change that restricts token permissions; no application logic or data paths are affected. > > **Overview** > Tightens the GitHub Actions `Generated files` workflow by explicitly setting top-level `permissions` to `contents: read`. > > This addresses code-scanning guidance by ensuring the workflow token is read-only while still allowing `actions/checkout` and the generated-file checks to run. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 225a3ee. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 2b91ada commit 1713080

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

.github/workflows/generated_files.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Generated files
33
on:
44
pull_request:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
check-generated:
811
name: Generated files

0 commit comments

Comments
 (0)