-
Notifications
You must be signed in to change notification settings - Fork 55
feat(#2095): add verified/unchecked variable fields to review findings schema #2363
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
base: main
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ | |
| "$defs": { | ||
| "finding": { | ||
| "type": "object", | ||
| "required": ["severity", "category", "file", "description"], | ||
| "required": ["severity", "category", "file", "description", "verified_variables", "unchecked_variables"], | ||
| "properties": { | ||
| "severity": { "type": "string", "enum": ["critical", "high", "medium", "low", "info"] }, | ||
| "category": { "type": "string", "minLength": 1 }, | ||
|
|
@@ -64,6 +64,16 @@ | |
| "actionable": { | ||
| "type": "boolean", | ||
| "description": "True when this non-blocking finding should be tracked as a follow-up issue if the review approves." | ||
| }, | ||
| "verified_variables": { | ||
| "type": "array", | ||
|
Member
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. [medium] These fields aren't in the finding's I think the simplest fix is making both fields unconditionally required, with |
||
| "items": { "type": "string", "minLength": 1 }, | ||
| "description": "Variables in the security-sensitive context that were verified as having the security control applied." | ||
| }, | ||
| "unchecked_variables": { | ||
| "type": "array", | ||
| "items": { "type": "string", "minLength": 1 }, | ||
| "description": "Variables in the security-sensitive context that were not verified as having the security control applied." | ||
| } | ||
| }, | ||
| "additionalProperties": false | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,13 +162,37 @@ run_test_custom_filename "custom-output-file-invalid" \ | |
| "false" | ||
|
|
||
| run_test_custom_filename "review-approve-actionable-finding-valid" \ | ||
| '{"action":"approve","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Approved with follow-ups.","findings":[{"severity":"low","category":"docs","file":"README.md","line":3,"description":"Document the flag.","remediation":"Add a short usage note.","actionable":true}]}' \ | ||
| '{"action":"approve","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Approved with follow-ups.","findings":[{"severity":"low","category":"docs","file":"README.md","line":3,"description":"Document the flag.","remediation":"Add a short usage note.","actionable":true,"verified_variables":[],"unchecked_variables":[]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "true" | ||
|
|
||
| run_test_custom_filename "review-finding-additional-property-rejected" \ | ||
| '{"action":"approve","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Approved.","findings":[{"severity":"low","category":"docs","file":"README.md","description":"Document the flag.","unexpected":true}]}' \ | ||
| '{"action":"approve","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Approved.","findings":[{"severity":"low","category":"docs","file":"README.md","description":"Document the flag.","unexpected":true,"verified_variables":[],"unchecked_variables":[]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
|
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. [info] test-adequacy Tests cover empty-string rejection for verified_variables but not for unchecked_variables. Both arrays use identical JSON Schema constraints, so schema validation is identical. |
||
| "false" | ||
|
|
||
| run_test_custom_filename "review-finding-with-verified-variables-valid" \ | ||
| '{"action":"request-changes","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Sanitization gap.","findings":[{"severity":"high","category":"gha-injection","file":"action.yml","description":"Partial sanitization.","verified_variables":["message"],"unchecked_variables":["source","subtype"]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "true" | ||
|
|
||
| run_test_custom_filename "review-finding-all-variables-verified-valid" \ | ||
| '{"action":"request-changes","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"All checked.","findings":[{"severity":"low","category":"gha-injection","file":"action.yml","description":"Full coverage.","verified_variables":["message","source","subtype"],"unchecked_variables":[]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "true" | ||
|
|
||
| run_test_custom_filename "review-finding-missing-required-variables-rejected" \ | ||
| '{"action":"request-changes","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Missing fields.","findings":[{"severity":"high","category":"gha-injection","file":"action.yml","description":"No variable arrays."}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "false" | ||
|
|
||
| run_test_custom_filename "review-finding-verified-variables-empty-string-rejected" \ | ||
| '{"action":"request-changes","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Bad var.","findings":[{"severity":"high","category":"gha-injection","file":"action.yml","description":"Bad.","verified_variables":[""],"unchecked_variables":["source"]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
|
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. [info] test-adequacy Tests cover empty-string rejection for verified_variables but not unchecked_variables. Both arrays share identical JSON Schema constraints, so validation is identical. |
||
| "false" | ||
|
|
@@ -215,11 +239,11 @@ run_test_custom_filename_output() { | |
| } | ||
|
|
||
| run_test_custom_filename_output "nested-additional-property-shows-allowed" \ | ||
| '{"action":"approve","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Approved.","findings":[{"severity":"low","category":"docs","file":"README.md","description":"Document the flag.","unexpected":true}]}' \ | ||
| '{"action":"approve","pr_number":42,"repo":"owner/repo","head_sha":"abcdef0123456789abcdef0123456789abcdef01","body":"Approved.","findings":[{"severity":"low","category":"docs","file":"README.md","description":"Document the flag.","unexpected":true,"verified_variables":[],"unchecked_variables":[]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "false" \ | ||
| "allowed properties: actionable, category, description, file, line, remediation, severity" | ||
| "allowed properties: actionable, category, description, file, line, remediation, severity, unchecked_variables, verified_variables" | ||
|
|
||
| # --- Structural failures --- | ||
|
|
||
|
|
@@ -347,7 +371,7 @@ run_test_custom_filename "path-traversal-stripped" \ | |
| REVIEW_SCHEMA="${SCRIPT_DIR}/../schemas/review-result.schema.json" | ||
|
|
||
| run_test_custom_filename "review-reject-valid" \ | ||
| '{"action":"reject","pr_number":1,"repo":"org/repo","head_sha":"abc1234","body":"Wrong approach.","findings":[{"severity":"high","category":"intent-alignment","file":"main.go","description":"Wrong design."}]}' \ | ||
| '{"action":"reject","pr_number":1,"repo":"org/repo","head_sha":"abc1234","body":"Wrong approach.","findings":[{"severity":"high","category":"intent-alignment","file":"main.go","description":"Wrong design.","verified_variables":[],"unchecked_variables":[]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "true" | ||
|
|
@@ -359,7 +383,7 @@ run_test_custom_filename "review-reject-missing-findings" \ | |
| "false" | ||
|
|
||
| run_test_custom_filename "review-reject-missing-body" \ | ||
| '{"action":"reject","pr_number":1,"repo":"org/repo","head_sha":"abc1234","findings":[{"severity":"high","category":"intent-alignment","file":"main.go","description":"Wrong design."}]}' \ | ||
| '{"action":"reject","pr_number":1,"repo":"org/repo","head_sha":"abc1234","findings":[{"severity":"high","category":"intent-alignment","file":"main.go","description":"Wrong design.","verified_variables":[],"unchecked_variables":[]}]}' \ | ||
| "agent-result.json" \ | ||
| "${REVIEW_SCHEMA}" \ | ||
| "false" | ||
|
|
||
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.
[low] misleading-label
The PR body describes the fields as optional but the schema adds them to the required array. The implementation correctly matches issue #2095; the PR description is imprecise.