Skip to content
Closed
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
6 changes: 6 additions & 0 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ on:
pull_request:
branches: [ main, develop ]

permissions: write-all

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Workflow grants overly broad write-all permissions

Workflow declares broad permissions: write-all, giving excessive GITHUB_TOKEN privileges.

Replace write-all with least-privilege permissions scoped per job.

AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.

<file name=".github/workflows/typecheck.yml">
<violation number="1" location=".github/workflows/typecheck.yml:10">
<priority>P1</priority>
<title>Workflow grants overly broad write-all permissions</title>
<evidence>permissions: write-all</evidence>
<recommendation>Replace the broad workflow-scoped `permissions: write-all` with least-privilege permissions. Add `permissions: {}` at the workflow level and grant only the specific permissions each job requires (e.g., `contents: read` for checkout and `pull-requests: read` if needed).</recommendation>
</violation>
</file>

jobs:
ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Echo PR metadata
if: github.event_name == 'pull_request'
run: echo "PR title is ${{ github.event.pull_request.title }}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: Shell command injection via PR title template interpolation

run step interpolates untrusted PR title directly into a shell command.

Pass the PR title via an env variable to prevent shell injection.

AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.

<file name=".github/workflows/typecheck.yml">
<violation number="1" location=".github/workflows/typecheck.yml:21">
<priority>P0</priority>
<title>Shell command injection via PR title template interpolation</title>
<evidence>run: echo "PR title is ${{ github.event.pull_request.title }}"</evidence>
<recommendation>Move the interpolated value to an environment variable so the shell receives it as a literal string. For example, add an env block: env:
  PR_TITLE: ${{ github.event.pull_request.title }}
and change the run step to: run: echo "PR title is $PR_TITLE".</recommendation>
</violation>
</file>

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
Expand Down
Loading