Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

jobs:
lint:
uses: 8hobbies/workflows/.github/workflows/npm-lint.yml@067ef9a5f26017da21acc0f647d0f505951dcdf5
uses: 8hobbies/workflows/.github/workflows/npm-lint.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI about 2 months ago

To fix this, explicitly declare least-privilege permissions for the workflow so that the GITHUB_TOKEN used by the lint job is limited. Since this workflow just invokes an npm lint reusable workflow and does not appear to need to write to the repository or other resources, we can safely set read-only permissions on repository contents (and optionally packages, which is also read-only by default). The best, minimal change is to add a permissions block at the workflow root level (between on: and jobs:), which will apply to all jobs that do not override it, including lint.

Concretely, in .github/workflows/lint.yml, insert:

permissions:
  contents: read
  packages: read

after the on: section and before jobs:. This does not alter the workflow’s behavior from a functional perspective (linting still runs as before) but ensures the token cannot perform unintended writes. No additional imports, methods, or other definitions are required; this is purely a YAML configuration change in the workflow file.

Suggested changeset 1
.github/workflows/lint.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -20,6 +20,10 @@
   pull_request:
     branches: ["master"]
 
+permissions:
+  contents: read
+  packages: read
+
 jobs:
   lint:
     uses: 8hobbies/workflows/.github/workflows/npm-lint.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060
EOF
@@ -20,6 +20,10 @@
pull_request:
branches: ["master"]

permissions:
contents: read
packages: read

jobs:
lint:
uses: 8hobbies/workflows/.github/workflows/npm-lint.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060
Copilot is powered by AI and may make mistakes. Always verify output.
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
permissions:
pages: write
id-token: write
uses: 8hobbies/workflows/.github/workflows/npm-doc-pages.yml@067ef9a5f26017da21acc0f647d0f505951dcdf5
uses: 8hobbies/workflows/.github/workflows/npm-doc-pages.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060
2 changes: 1 addition & 1 deletion .github/workflows/publish-dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

jobs:
run:
uses: 8hobbies/workflows/.github/workflows/npm-publish-dry-run.yml@067ef9a5f26017da21acc0f647d0f505951dcdf5
uses: 8hobbies/workflows/.github/workflows/npm-publish-dry-run.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI about 2 months ago

In general, the fix is to add an explicit permissions block that applies least-privilege GITHUB_TOKEN permissions to this workflow/job. Because this workflow only invokes a reusable workflow and is named “Publish Dry Run,” it likely only needs read access to repository contents; a dry run of npm publish should not require pushing commits, creating releases, or modifying issues/PRs. The safest minimal starting point is contents: read, and we can define this at the job level for the run job.

Concretely, in .github/workflows/publish-dry-run.yml, under jobs:, in the run: job, add a permissions: block before uses:. This keeps existing behavior (the job still calls the same reusable workflow) but ensures the GITHUB_TOKEN has read-only access to repository contents unless the reusable workflow explicitly requires more. No imports or extra methods are needed; this is a pure YAML configuration change.

Suggested changeset 1
.github/workflows/publish-dry-run.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/publish-dry-run.yml b/.github/workflows/publish-dry-run.yml
--- a/.github/workflows/publish-dry-run.yml
+++ b/.github/workflows/publish-dry-run.yml
@@ -22,4 +22,6 @@
 
 jobs:
   run:
+    permissions:
+      contents: read
     uses: 8hobbies/workflows/.github/workflows/npm-publish-dry-run.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060
EOF
@@ -22,4 +22,6 @@

jobs:
run:
permissions:
contents: read
uses: 8hobbies/workflows/.github/workflows/npm-publish-dry-run.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060
Copilot is powered by AI and may make mistakes. Always verify output.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
tags: ["v*"]
jobs:
build:
uses: 8hobbies/workflows/.github/workflows/npm-publish.yml@067ef9a5f26017da21acc0f647d0f505951dcdf5
uses: 8hobbies/workflows/.github/workflows/npm-publish.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060
secrets:
npm-auth-token: ${{ secrets.NPM_TOKEN }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
2 changes: 1 addition & 1 deletion .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

jobs:
test:
uses: 8hobbies/workflows/.github/workflows/npm-runtime.yml@067ef9a5f26017da21acc0f647d0f505951dcdf5
uses: 8hobbies/workflows/.github/workflows/npm-runtime.yml@b912c36872c2ee7c67d5a8a8478382301e9e3060

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI about 2 months ago

To fix the problem, explicitly define a permissions block to scope the GITHUB_TOKEN to the least privileges needed. Since this file only orchestrates a reusable workflow and doesn’t show any operations requiring write access, the safest default is read-only repository contents (contents: read). If the reusable workflow needs more (e.g., contents: write, packages: read, etc.), those can be added later where truly required.

The best minimal fix without changing existing functionality is to add a root-level permissions block under the name field (or equivalently between on: and jobs:). This sets default permissions for all jobs in this workflow, including the test job that uses the reusable workflow, and satisfies CodeQL’s requirement. Concretely, in .github/workflows/runtime.yml, insert:

permissions:
  contents: read

right after the name: Runtime line. No imports or other definitions are needed; this is pure GitHub Actions YAML configuration.

Suggested changeset 1
.github/workflows/runtime.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml
--- a/.github/workflows/runtime.yml
+++ b/.github/workflows/runtime.yml
@@ -14,6 +14,9 @@
 
 name: Runtime
 
+permissions:
+  contents: read
+
 on:
   push:
     branches: ["master"]
EOF
@@ -14,6 +14,9 @@

name: Runtime

permissions:
contents: read

on:
push:
branches: ["master"]
Copilot is powered by AI and may make mistakes. Always verify output.