-
Notifications
You must be signed in to change notification settings - Fork 0
CANARY — DO NOT MERGE: verify the review standard fires #59
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: jules-review | ||
|
|
||
| # Optional: auto-invoke Jules for a security-focused review on every PR. | ||
| # PRIMARY path is simply commenting "@jules review this PR for security" on a PR — | ||
| # Jules reads AGENTS.md + .github/agents/security-reviewer.agent.md and responds. | ||
| # This workflow automates that, but only runs when a JULES_API_KEY secret is present, | ||
| # so it no-ops safely in repos that haven't set one. | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| jules: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Guard — only run when a Jules key is configured | ||
| id: guard | ||
| run: | | ||
| if [ -n "${{ secrets.JULES_API_KEY }}" ]; then | ||
| echo "enabled=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "enabled=false" >> "$GITHUB_OUTPUT" | ||
| echo "No JULES_API_KEY set — skipping automated Jules review. Use @jules on the PR instead." | ||
| fi | ||
| - name: Jules security review | ||
| if: steps.guard.outputs.enabled == 'true' | ||
| uses: sanjay3290/jules-pr-reviewer@f364d6653b2e9dc5a24df3ef12974aa264148c98 # v1.0.1 | ||
| with: | ||
| jules_api_key: ${{ secrets.JULES_API_KEY }} | ||
| github_token: ${{ github.token }} | ||
| extra_instructions: > | ||
| Review this pull request as an adversarial application-security reviewer. | ||
| Follow .github/agents/security-reviewer.agent.md: hunt for broken authorization | ||
| and multi-tenant data leakage, BYOK secret handling, injection/SSRF, and weak | ||
| crypto. Default to "this is a finding" when unsure. Cite file:line and propose the fix. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| package canary | ||||||
|
|
||||||
| import "log" | ||||||
|
|
||||||
| // CANARY — deliberate defects to verify the review standard fires. DO NOT MERGE. | ||||||
|
|
||||||
| // hardcoded credential | ||||||
| const billingToken = "b7f3d91e4c2a8056f1d3e7a94c0b2856d4f9a1e3" | ||||||
|
Comment on lines
+7
to
+8
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. 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win Remove and rotate the hardcoded billing credential. Line 8 commits a billing credential to source control. Revoke or rotate this credential immediately. Load the replacement from a secret manager or runtime configuration. Proposed fix-// hardcoded credential
-const billingToken = "b7f3d91e4c2a8056f1d3e7a94c0b2856d4f9a1e3"🧰 Tools🪛 Betterleaks (1.7.3)[high] 8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||
|
|
||||||
| type Invoice struct { | ||||||
| ID string | ||||||
| OwnerID string | ||||||
| Amount int | ||||||
| } | ||||||
|
|
||||||
| var invoices = []Invoice{{ID: "in_1", OwnerID: "u_1", Amount: 4200}} | ||||||
|
|
||||||
| // GetInvoice looks up by id with no ownership or tenant scoping — any caller can | ||||||
| // read any tenant's invoice. | ||||||
| func GetInvoice(id string) *Invoice { | ||||||
|
Comment on lines
+18
to
+20
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. 🚨 issue (security): Missing authorization/tenant scoping on invoice lookup enables cross-tenant data exposure.
|
||||||
| log.Printf("billing lookup id=%s key=%s", id, billingToken) // secret in log | ||||||
|
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. 🚨 issue (security): Do not log secret material; logs are often less protected than primary storage. Logging 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. 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win Do not write the billing credential to logs. Line 21 sends Proposed fix- log.Printf("billing lookup id=%s key=%s", id, billingToken) // secret in log
+ log.Printf("billing lookup id=%s", id)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| for i := range invoices { | ||||||
| if invoices[i].ID == id { | ||||||
| return &invoices[i] | ||||||
|
Comment on lines
+18
to
+24
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. 🔒 Security & Privacy | 🔴 Critical | 🏗️ Heavy lift Enforce invoice ownership before returning the invoice.
🤖 Prompt for AI Agents |
||||||
| } | ||||||
| } | ||||||
| return nil | ||||||
| } | ||||||
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.
🚨 issue (security): Avoid hardcoded secrets in source; use a secret manager or configuration instead.
Even for canary code, realistic-looking tokens can be picked up by scanners or copied into real code. For production, load credentials from environment variables or a secret store, and keep canaries using clearly fake, non-credential-like values.