-
Notifications
You must be signed in to change notification settings - Fork 6
ci: run integration tests on forks #2
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
cf28a5e
3eaa71d
6db57cd
f9fcf87
b100e93
f7d22eb
87741f6
ed16a4a
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 |
|---|---|---|
|
|
@@ -56,41 +56,24 @@ jobs: | |
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Check if fork PR | ||
| id: fork-check | ||
| run: | | ||
| # Use default empty string to handle edge cases (deleted branches, malformed events) | ||
| HEAD_REPO="${{ github.event.pull_request.head.repo.full_name || '' }}" | ||
| if [[ "${{ github.event_name }}" == "pull_request" && "$HEAD_REPO" != "${{ github.repository }}" && -n "$HEAD_REPO" ]]; then | ||
| echo "⏭️ Skipping - fork PR (secrets not available)" | ||
| echo "is_fork=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_fork=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Checkout code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup pnpm | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
|
|
||
| - name: Build action | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: pnpm install --frozen-lockfile && pnpm build | ||
|
|
||
| - name: Run test | ||
|
derekmisler marked this conversation as resolved.
|
||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] The Today (with Note that |
||
| id: pirate | ||
| uses: ./ | ||
| with: | ||
|
|
@@ -99,7 +82,6 @@ jobs: | |
| openai-api-key: ${{ secrets.OPENAI_API_KEY }} | ||
|
|
||
| - name: Validate output and exit code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| OUTPUT_FILE="${{ steps.pirate.outputs.output-file }}" | ||
|
|
||
|
|
@@ -205,45 +187,27 @@ jobs: | |
| env: | ||
| TEST_PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} | ||
| steps: | ||
| - name: Check if fork PR | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Fork-detection guards removed from The "Check if fork PR" step and all However, the same concern applies: if the job-level guard is ever relaxed (e.g., to run on The |
||
| id: fork-check | ||
| run: | | ||
| # Use default empty string to handle edge cases (deleted branches, malformed events) | ||
| HEAD_REPO="${{ github.event.pull_request.head.repo.full_name || '' }}" | ||
| if [[ "${{ github.event_name }}" == "pull_request" && "$HEAD_REPO" != "${{ github.repository }}" && -n "$HEAD_REPO" ]]; then | ||
| echo "⏭️ Skipping - fork PR (secrets not available)" | ||
| echo "is_fork=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_fork=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Checkout code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup pnpm | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
|
|
||
| - name: Build action | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: pnpm install --frozen-lockfile && pnpm build | ||
|
|
||
| - name: Setup credentials | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: docker/cagent-action/setup-credentials@367a30ddb41e0156459d03750f508eac03f3c38a # v1.5.5 | ||
|
|
||
| - name: Create anchor issue comment on current PR | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: create-anchor | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -256,7 +220,6 @@ jobs: | |
| echo "test_comment_id=$COMMENT_ID" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Write synthetic issue_comment event | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| COMMENT_ID="${{ steps.create-anchor.outputs.test_comment_id }}" | ||
| jq -n \ | ||
|
|
@@ -282,7 +245,6 @@ jobs: | |
| }' > /tmp/test-event-toplevel.json | ||
|
|
||
| - name: Run mention-reply handler | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: mention-handler | ||
| env: | ||
| INPUT_GITHUB-TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -293,7 +255,6 @@ jobs: | |
| node "$GITHUB_WORKSPACE/dist/mention-reply.js" | ||
|
|
||
| - name: Assert should-reply output | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| SHOULD_REPLY="${{ steps.mention-handler.outputs.should-reply }}" | ||
| echo "should-reply=$SHOULD_REPLY" | ||
|
|
@@ -307,7 +268,7 @@ jobs: | |
| fi | ||
|
|
||
| - name: Run mention reply | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| id: run-reply | ||
| uses: ./review-pr/mention-reply | ||
| with: | ||
|
|
@@ -323,7 +284,7 @@ jobs: | |
| skip-auth: "true" | ||
|
|
||
| - name: Verify reply was posted | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
| run: | | ||
|
|
@@ -336,7 +297,7 @@ jobs: | |
| echo "✅ Reply posted successfully ($FOUND comment(s) found)" | ||
|
|
||
| - name: Cleanup test comments | ||
| if: always() && steps.fork-check.outputs.is_fork != 'true' | ||
| if: always() | ||
| continue-on-error: true | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -366,44 +327,27 @@ jobs: | |
| env: | ||
| TEST_PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} | ||
| steps: | ||
| - name: Check if fork PR | ||
| id: fork-check | ||
| run: | | ||
| HEAD_REPO="${{ github.event.pull_request.head.repo.full_name || '' }}" | ||
| if [[ "${{ github.event_name }}" == "pull_request" && "$HEAD_REPO" != "${{ github.repository }}" && -n "$HEAD_REPO" ]]; then | ||
| echo "⏭️ Skipping - fork PR (secrets not available)" | ||
| echo "is_fork=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_fork=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Checkout code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup pnpm | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
|
|
||
| - name: Build action | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: pnpm install --frozen-lockfile && pnpm build | ||
|
|
||
| - name: Setup credentials | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: docker/cagent-action/setup-credentials@367a30ddb41e0156459d03750f508eac03f3c38a # v1.5.5 | ||
|
|
||
| - name: Create anchor review comment on current PR | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: create-anchor | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -428,7 +372,6 @@ jobs: | |
| echo "test_comment_id=$COMMENT_ID" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Write synthetic pull_request_review_comment event | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| COMMENT_ID="${{ steps.create-anchor.outputs.test_comment_id }}" | ||
| jq -n \ | ||
|
|
@@ -455,7 +398,6 @@ jobs: | |
| }' > /tmp/test-event-inline.json | ||
|
|
||
| - name: Run mention-reply handler | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: mention-handler | ||
| env: | ||
| INPUT_GITHUB-TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -466,7 +408,6 @@ jobs: | |
| node "$GITHUB_WORKSPACE/dist/mention-reply.js" | ||
|
|
||
| - name: Assert should-reply output | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| SHOULD_REPLY="${{ steps.mention-handler.outputs.should-reply }}" | ||
| echo "should-reply=$SHOULD_REPLY" | ||
|
|
@@ -478,7 +419,7 @@ jobs: | |
| fi | ||
|
|
||
| - name: Assert inline outputs | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| run: | | ||
| IS_INLINE="${{ steps.mention-handler.outputs.is-inline }}" | ||
| IN_REPLY_TO_ID="${{ steps.mention-handler.outputs.in-reply-to-id }}" | ||
|
|
@@ -495,7 +436,7 @@ jobs: | |
| echo "✅ in-reply-to-id=$IN_REPLY_TO_ID (matches anchor comment)" | ||
|
|
||
| - name: Run mention reply | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| id: run-reply | ||
| uses: ./review-pr/mention-reply | ||
| with: | ||
|
|
@@ -511,7 +452,7 @@ jobs: | |
| skip-auth: "true" | ||
|
|
||
| - name: Verify inline reply was posted in thread | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
| ANCHOR_ID: ${{ steps.create-anchor.outputs.test_comment_id }} | ||
|
|
@@ -526,7 +467,7 @@ jobs: | |
| echo "✅ Inline reply posted successfully" | ||
|
|
||
| - name: Cleanup anchor comment and thread replies | ||
| if: always() && steps.fork-check.outputs.is_fork != 'true' | ||
| if: always() | ||
| continue-on-error: true | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
||
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.
[HIGH] Fork-detection guards removed from
test-pirate-agent— dangerous step toward pwn-request if trigger changesThis PR removes the "Check if fork PR" step and all
if: steps.fork-check.outputs.is_fork != 'true'conditions fromtest-pirate-agent. While the currentpull_requesttrigger means fork PRs already receive empty secrets (GitHub's built-in protection), the PR description explicitly states the intent to switch topull_request_target.Under
pull_request_target+ checkout ofgithub.event.pull_request.head.sha+uses: ./, this guard was the only step-level protection against a fork contributor executing their own code with liveOPENAI_API_KEYcredentials. After this deletion, there is no step-level, job-level, or environment-level gate remaining on this job.This creates a single-commit path to a critical secret exfiltration vulnerability: applying the stated
pull_request_targettrigger change without adding new guards would allow any fork PR to run arbitraryaction.yml/dist/*.jscode with live API keys.Suggested mitigation: Before or alongside the trigger change, add either:
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request_target'