Repository navigation
Run bravebot's security audit before the loop opens a bravebot pull request - #221
Merged
Merged
Conversation
The bravebot profile gains a validation step, after make check-affected, that runs python3 agents/skills/security-audit/security-audit.py --before-pr upstream/main. Exit 0 opens the pull request; exit 1 is a finding to fix first; exit 2 is a failed step. projects/bravebot/docs/testing.md says what the check does, and a test pins the step, its place after the host gates, and that a finding stops the pull request. Part of brave/bravebot#3464
bbondy
approved these changes
Nov 13, 2026
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #219
User impact: a bravebot pull request the loop opens has passed bravebot's mechanical security audit first; a branch with a finding at error is fixed before it opens instead of reaching review.
The problem
bravebot has a check for a branch that is about to become a pull request:
security-audit.py --before-pr, which audits what the branch changes against its rule that untrusted content never decides anything. When the loop works a bravebot story, nothing runs it, so a branch that breaks the rule is first seen by a reviewer, or not at all.Reproduce
config.jsonon the bravebot profile, run./run.sh 1on any bravebot story.data/prd.json.On
masterthe criteria end with the Docker gate step and never name the audit, so the pull request opens without it. Expected: a step that runs the audit aftermake check-affectedand stops the pull request on a finding.pytest tests/test_scripts.py -k test_audits_the_branch_before_the_pull_request_openscovers it. It fails on the parent commit and passes here.The fix
The bravebot profile gets a validation step that runs
python3 agents/skills/security-audit/security-audit.py --before-pr upstream/mainonce the host gates pass. The audit needs no model, so the step reads its exit status: 0 opens the pull request, 1 is a finding to fix first, and 2 means the step failed.projects/bravebot/docs/testing.mdsays what the check covers and what each exit code means. Other profiles are unchanged.Test plan
pytest tests/test_scripts.py -k test_audits_the_branch_before_the_pull_request_openspassed. Shown failing on three wrong profiles: the step removed, the "do not open the pull request until it exits 0" wording removed, and the step moved beforemake check-affected. Each fails the test, and the restored profile passes.ruff check .andruff format --check .passed.pytest tests/passed, 1247 tests.make check-reviewdognot run.