Skip to content

[Integration test — do not merge] PR scanning and graph comments - #83

Draft
homanp wants to merge 1 commit into
mainfrom
codex/test-pr-graph-comments
Draft

homanp wants to merge 1 commit into
mainfrom
codex/test-pr-graph-comments

Conversation

@homanp

@homanp homanp commented Nov 9, 2026 •

Copy link
Copy Markdown

Description

Isolated end-to-end test of the locally connected Superagent GitHub App, PR scanning, Security Graph persistence/classification, and reviewer comment history.

This branch deliberately introduces a CI trust-boundary regression in the welcome workflow: a privileged pull_request_target job checks out and installs the PR head. The application's intentional CTF vulnerabilities are unchanged.

Test fixture only. Do not merge this PR. The base-branch welcome workflow remains unchanged while this PR is open.

Type of change

  • Other: temporary scanner integration fixture

Testing done

The Superagent scan should investigate the diff, search the existing graph, save any finding through MCP, publish an inline review comment, and preserve subsequent reviewer feedback in graph context. Results will be verified against the local database and hosted graph MCP.

Checklist

  • No real-world secrets introduced
  • Existing CTF behavior preserved
  • This PR will remain unmerged

Verified end-to-end results

  • The development GitHub App delivered events to the locally running App.
  • The PR agent searched the hosted Security Graph MCP.
  • One CI finding was saved through MCP and published inline by superagent-security-dev[bot].
  • A maintainer's inline reply was persisted as attributed reviewer history and returned by graph search.
  • A native MCP finding comment was saved as a linked comment node and read back through the App MCP gateway.
  • A repeat scan searched graph history, respected the review, finished clean, and posted no duplicate finding.
  • Both completed scans finished durable GitHub publication.

Successful finding run: 0b494150-4d44-4776-8b76-1d8502d8c003.
Clean repeat run: dbd40ed3-92eb-4f91-9e4e-a02599efa1a5.
Finding: 6a9ab93b-79a3-464b-a32e-297e7fb7d3cd.
Native graph comment: 7c087e3e-98c0-4eda-a0e5-80db548f0ae3.

The first run exposed a real native persistence contract mismatch; fixes and regression coverage are in https://github.com/superagent-ai/app/pull/927 (commit b4034490).

Classification executed with Julia-1, but its SQL-injection suggestion was below threshold (~24%) and is not an accurate category for this CI issue. That model/catalog limitation is recorded separately from the successful integration checks.

This deliberately unsafe test branch remains unmerged.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Thank you @homanp for contributing once again!

📊 PR overview

Files changed Additions Deletions Size
1 +6 -0 XS

📝 Before review

To help maintainers review your changes efficiently, please ensure that:

  • The PR description clearly explains what was changed and why
  • The PR checklist has been filled out
  • All existing tests continue to pass
  • New tests have been added for any new functionality

📖 Please review our Contributing Guidelines and Code of Conduct.

✅ Continuous Integration

Two CI workflows will run automatically on this PR:

  • Code Quality — linting and formatting checks
  • Exploitation Tests — ensures vulnerabilities and flags work as expected

You can follow their progress in the Checks tab.

🤝 A note on collaboration

We value respectful and constructive interactions. Whether you are a contributor or a reviewer, please be patient, kind, and open to feedback.


A maintainer will review your changes as soon as possible. If you have any questions, feel free to ask in this thread.

kOaDT

@github-actions github-actions Bot added the size/XS PR size: XS label Nov 9, 2026
@homanp

homanp commented Nov 9, 2026

Copy link
Copy Markdown
Author

@superagent review

@superagent-security-dev superagent-security-dev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Superagent found 1 security concern(s).

with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Prepare PR welcome assets
run: npm ci

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: Privileged pull_request_target now installs fork-controlled code

pull_request_target checks out the PR head and runs npm ci with write-scoped token permissions.

Never install fork code in pull_request_target; use pull_request/read-only CI or trusted base assets.

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/welcome-pr.yml">
<violation number="1" location=".github/workflows/welcome-pr.yml:21">
<priority>P0</priority>
<title>Privileged pull_request_target now installs fork-controlled code</title>
<evidence>The workflow is triggered by pull_request_target and grants pull-requests: write and issues: write at lines 4-9. The added checkout selects github.event.pull_request.head.sha at line 19, and the added npm ci command at line 21 executes the checked-out PR's package installation. The repository's package.json defines a prepare lifecycle script ("prepare": "husky"), and npm dependency installation can also run dependency lifecycle scripts. A fork author can therefore supply package metadata, lifecycle code, or dependency-controlled install code that runs on a privileged runner with the workflow's writable GITHUB_TOKEN; actions/checkout also retains credentials by default unless disabled.</evidence>
<recommendation>Do not execute PR-head code in this privileged pull_request_target workflow. Remove the PR-head checkout and npm ci, or move untrusted validation to a pull_request workflow with read-only permissions. If trusted-repository assets are required for the welcome comment, check out the base/default-branch revision explicitly and do not install dependencies; set persist-credentials: false unless credential persistence is required.</recommendation>
</violation>
</file>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Maintainer review for integration test PR #83: this is an isolated, unmerged scanner fixture. Accept the risk for this test PR only; it must never be merged. Preserve this rationale as reviewer context. Tracking marker: graph-pr83-review-20261109.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Acknowledged: accepted as intentional, isolated scanner fixture for integration test PR #83. Confirmed must not merge to default branch. Ensure PR remains closed/unmerged and workflow never reaches privileged execution context outside of this controlled test.

@superagent-security-dev

Copy link
Copy Markdown

Superagent scan complete — found 1 security concern(s). See the inline review comments above.

@homanp

homanp commented Nov 9, 2026

Copy link
Copy Markdown
Author

@superagent review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant