Skip to content

Conversation

@rgelinas-polygon
Copy link
Contributor

No description provided.

Comment on lines +15 to +31
runs-on: ubuntu-latest
outputs:
env: ${{ steps.set-env.outputs.env }}
steps:
- id: set-env
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
export ENV=production
fi

if [ "${{ github.ref_name }}" == "dev" ]; then
export ENV=staging
fi

echo "env=$ENV" >> "$GITHUB_OUTPUT"

build-and-deploy:

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 address this security issue, add a permissions block to the workflow to restrict the GITHUB_TOKEN permissions. Since the workflow jobs shown do not perform any write operations to the repository (no pushes, issue/PR management, or artifact storage), the minimal permission required is likely contents: read, allowing it to check out code. This can be set at the workflow root (so it applies to all jobs) by inserting

permissions:
  contents: read

between the top metadata and the on: block. This edit sets the least privilege and follows GitHub's official recommendation. No new methods, imports, or definitions are needed.


Suggested changeset 1
.github/workflows/deploy.yaml

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/deploy.yaml b/.github/workflows/deploy.yaml
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -1,5 +1,8 @@
 run-name: Deploy ${{ github.ref_name }}
 
+permissions:
+  contents: read
+
 on:
   push:
     branches:
EOF
@@ -1,5 +1,8 @@
run-name: Deploy ${{ github.ref_name }}

permissions:
contents: read

on:
push:
branches:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +32 to +44
needs: [get-env]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- run: npm ci
- run: npm run build
- name: Deploy bundle
uses: cloudflare/wrangler-action@v3
with:
environment: ${{ needs.get-env.outputs.env }}
apiToken: ${{ secrets.CF_WORKER_API_TOKEN }}
accountId: ${{ secrets.CF_WORKER_ACCOUNT_ID }}

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: {contents: read}

Copilot Autofix

AI about 2 months ago

To resolve this problem, you should add a permissions block at either the workflow root (to apply to all jobs) or to jobs individually if they need distinct privileges. The most secure approach is to apply the minimum permissions required by the workflow as a whole—typically contents: read is sufficient for most deploy workflows, unless explicit interactions with issues, pull requests, or other resources are needed. In your workflow, there are no steps that require write access to the repository, so the minimal starting point is appropriate. Therefore, you should add the following directly beneath the top-level fields (e.g., after run-name or before/on) in .github/workflows/deploy.yaml:

permissions:
  contents: read

No imports or additional dependencies are required.

Suggested changeset 1
.github/workflows/deploy.yaml

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/deploy.yaml b/.github/workflows/deploy.yaml
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -1,4 +1,6 @@
 run-name: Deploy ${{ github.ref_name }}
+permissions:
+  contents: read
 
 on:
   push:
EOF
@@ -1,4 +1,6 @@
run-name: Deploy ${{ github.ref_name }}
permissions:
contents: read

on:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
@rgelinas-polygon rgelinas-polygon merged commit 4f0cfe6 into dev Sep 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants