-
Notifications
You must be signed in to change notification settings - Fork 91
fixing CI security issue #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,9 @@ name: Validate | |||||
| on: | ||||||
| pull_request_target: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| schema: | ||||||
| runs-on: ubuntu-latest | ||||||
|
|
@@ -49,10 +52,12 @@ jobs: | |||||
| runs-on: ubuntu-latest | ||||||
|
|
||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
| - uses: actions/checkout@v4 | ||||||
| with: | ||||||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||||||
| ref: ${{ github.event.pull_request.head.ref }} | ||||||
| path: ./head | ||||||
|
|
||||||
| - name: Setup Node.js | ||||||
| uses: actions/setup-node@v4 | ||||||
|
|
@@ -81,7 +86,7 @@ jobs: | |||||
| run: pnpm install | ||||||
|
|
||||||
| - name: Lint Check | ||||||
| run: pnpx @biomejs/biome@2.0.0 ci | ||||||
| run: pnpx @biomejs/biome@2.0.0 ci ./head | ||||||
|
||||||
| run: pnpx @biomejs/biome@2.0.0 ci ./head | |
| run: pnpx @biomejs/biome@2.0.0 ci ./head --config-path ./head |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When checking out the PR head in a
pull_request_targetworkflow, use the immutablegithub.event.pull_request.head.shainstead ofhead.refto avoid TOCTOU issues (the branch can move between trigger and checkout). Also setpersist-credentials: falseon this checkout so the GITHUB_TOKEN isn’t written into./head/.git/config, which reduces the risk of later steps inadvertently leaking it.