@@ -675,7 +675,11 @@ describe("GitHub Actions hardening", () => {
675675 } ;
676676 type WorkflowJob = Record < string , unknown > & { "runs-on" ?: unknown ; steps ?: WorkflowStep [ ] } ;
677677 type WorkflowShape = Record < string , unknown > & {
678- on ?: { pull_request_target ?: { types ?: string [ ] } } ;
678+ on ?: {
679+ pull_request_target ?: { types ?: string [ ] } ;
680+ pull_request_review ?: { types ?: string [ ] } ;
681+ pull_request_review_comment ?: { types ?: string [ ] } ;
682+ } ;
679683 permissions ?: Record < string , string > | string ;
680684 concurrency ?: Record < string , unknown > & { group ?: string } ;
681685 jobs ?: Record < string , WorkflowJob > ;
@@ -828,13 +832,13 @@ describe("GitHub Actions hardening", () => {
828832 "permissions" ,
829833 ] ) ;
830834
831- // pull_request_target runs with the base repo's token. Checking out or
832- // executing the PR 's code under it is the classic escalation. Review
833- // events are deliberately NOT added: they load the workflow from the PR
834- // head branch (like `pull_request`), which would run head-controlled
835- // workflow YAML under a write token against base-pinned scripts — a
836- // mismatch that crashes the gate and breaks the trusted-base model.
837- expect ( Object . keys ( workflow . on ?? { } ) ) . toEqual ( [ "pull_request_target" ] ) ;
835+ // The review triggers ensure findings posted after the initial target
836+ // event immediately invalidate the gate 's previous verdict.
837+ expect ( Object . keys ( workflow . on ?? { } ) ) . toEqual ( [
838+ "pull_request_target" ,
839+ "pull_request_review" ,
840+ "pull_request_review_comment" ,
841+ ] ) ;
838842
839843 // And the trigger is exactly a `types:` list — nothing else.
840844 //
@@ -946,11 +950,16 @@ describe("GitHub Actions hardening", () => {
946950 "reopened" ,
947951 "synchronize" ,
948952 ] ) ;
949- // Review events must NOT be added: they load the workflow from the PR
950- // head branch, breaking the base-pinned checkout (`pull_request_review`
951- // runs head YAML + base scripts → `parseGateState is not a function`).
952- expect ( workflow . on ?. pull_request_review ) . toBeUndefined ( ) ;
953- expect ( workflow . on ?. pull_request_review_comment ) . toBeUndefined ( ) ;
953+ expect ( workflow . on ?. pull_request_review ?. types ) . toEqual ( [
954+ "submitted" ,
955+ "edited" ,
956+ "dismissed" ,
957+ ] ) ;
958+ expect ( workflow . on ?. pull_request_review_comment ?. types ) . toEqual ( [
959+ "created" ,
960+ "edited" ,
961+ "deleted" ,
962+ ] ) ;
954963
955964 // The verdict is a live PR read plus ancestry/description checks.
956965 expect ( script ) . toContain ( "github.rest.pulls.get" ) ;
0 commit comments