Skip to content

Commit 86f54a6

Browse files
feat: request CVE reviews from on-call engineers
1 parent dba0049 commit 86f54a6

4 files changed

Lines changed: 30 additions & 2 deletions

File tree

.github/cve-reviewers.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"4252e0fc-68f3-4b81-91d1-b07fd6dd7983": "brendan-kellam",
3+
"82990144-8a05-46bb-9712-775afc04b14d": "BlueBottleLatte"
4+
}

.github/prompts/cve-remediation-system.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Required workflow:
1717
6. Verify the final dependency graph contains no affected version for every issue in the group. Run the repository's relevant tests, lint, typecheck, and build commands in proportion to the change.
1818
7. Open a pull request only when the remediation is complete, scoped, and supported by the verification. If no safe fix exists, or verification fails for reasons caused by the change, do not open a speculative PR.
1919
8. Put every advisory identifier in the PR title or body. Put each Linear issue on its own exact line in the PR body as `Fixes SOU-123`. This is mandatory because it creates the Linear PR attachment and lets Linear close the issue on merge.
20-
9. Do not mark Linear issues complete yourself. Do not merge the PR. Do not make unrelated refactors or upgrades.
20+
9. After opening or updating a pull request, re-fetch every Linear issue covered by that PR and collect its current `assigneeId`. Read the trusted Linear-to-GitHub mapping from `.cve-remediation-workflow/.github/cve-reviewers.json`, then request review from every distinct mapped assignee with `gh pr edit "$PR_URL" --add-reviewer "$REVIEWER"`. Do not infer a GitHub username from a name or email address. If an issue is unassigned, its assignee is not mapped, or a review request fails, keep the completed PR open and report the omission clearly instead of failing or deleting the PR.
21+
10. Do not mark Linear issues complete yourself. Do not merge the PR. Do not make unrelated refactors or upgrades.
2122

2223
When more than one package group is supplied, complete each safe group independently. A failure or lack of a safe fix for one group must not force unrelated changes into another group's PR.

.github/scripts/test-cve-remediation.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ FILTER="$SCRIPT_DIR/filter-unlinked-cve-issues.jq"
66
DISCOVERY_SCRIPT="$SCRIPT_DIR/find-unlinked-cve-issues.sh"
77
WORKFLOW_FILE="$SCRIPT_DIR/../workflows/_cve-remediation.yml"
88
CALLER_WORKFLOW_FILE="$SCRIPT_DIR/../workflows/cve-remediation.yml"
9+
SYSTEM_PROMPT_FILE="$SCRIPT_DIR/../prompts/cve-remediation-system.md"
10+
REVIEWER_MAP_FILE="$SCRIPT_DIR/../cve-reviewers.json"
911

1012
assert_json() {
1113
local description="$1"
@@ -262,6 +264,11 @@ assert_json \
262264
"$(jq -c '.variables.after' "$FAKE_CURL_PAYLOAD_DIR/3.json")" \
263265
'"next-page"'
264266

267+
assert_json \
268+
"maps Linear on-call assignees to GitHub reviewers" \
269+
"$(jq -c . "$REVIEWER_MAP_FILE")" \
270+
'{"4252e0fc-68f3-4b81-91d1-b07fd6dd7983":"brendan-kellam","82990144-8a05-46bb-9712-775afc04b14d":"BlueBottleLatte"}'
271+
265272
assert_workflow_contains \
266273
"uses the deterministic discovery script before Claude" \
267274
'.cve-remediation-workflow/.github/scripts/find-unlinked-cve-issues.sh'
@@ -289,6 +296,20 @@ assert_workflow_contains \
289296
assert_workflow_contains \
290297
"loads the CVE system prompt" \
291298
'--append-system-prompt-file'
299+
assert_workflow_contains \
300+
"checks out the trusted reviewer map" \
301+
'.github/cve-reviewers.json'
302+
assert_workflow_contains \
303+
"requires reviewer assignment after PR creation" \
304+
'gh pr edit "$PR_URL" --add-reviewer "$REVIEWER"' \
305+
"$SYSTEM_PROMPT_FILE"
306+
assert_workflow_contains \
307+
"uses the Linear assignee as the reviewer source" \
308+
'current `assigneeId`' \
309+
"$SYSTEM_PROMPT_FILE"
310+
assert_workflow_contains \
311+
"allows the agent to request GitHub reviewers" \
312+
'Bash(gh pr *)'
292313
assert_workflow_contains \
293314
"allows enough turns for multi-issue remediation batches" \
294315
'--max-turns 250'

.github/workflows/_cve-remediation.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ jobs:
119119
with:
120120
repository: ${{ inputs.workflow_asset_repository || github.repository }}
121121
ref: ${{ inputs.workflow_asset_ref || github.sha }}
122-
sparse-checkout: .github/prompts/cve-remediation-system.md
122+
sparse-checkout: |
123+
.github/prompts/cve-remediation-system.md
124+
.github/cve-reviewers.json
123125
path: .cve-remediation-workflow
124126
persist-credentials: false
125127

0 commit comments

Comments
 (0)