File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ function conservativeYamlBlock(lines) {
9090 if (
9191 ! mapping ||
9292 mapping . quoted ||
93+ mapping . key === 'permissions' ||
9394 / ^ [ { [ ] / . test ( mapping . value ) ||
9495 / ^ [ ! & * ] / . test ( mapping . value )
9596 ) {
@@ -109,7 +110,8 @@ function historicalWorkflowIsLowPrivilege(source) {
109110 ( line ) =>
110111 line . includes ( '\t' ) ||
111112 / ^ \s * < < \s * : / . test ( line ) ||
112- / ^ \s * [ ? : ] \s / . test ( line ) ,
113+ / ^ \s * [ ? : ] \s / . test ( line ) ||
114+ / ^ (?: - - - | \. \. \. ) \s * (?: # .* ) ? $ / . test ( line ) ,
113115 )
114116 ) {
115117 return false
Original file line number Diff line number Diff line change @@ -5099,6 +5099,18 @@ test('historical active-run targets can validate without newer trusted runtime f
50995099 {permissions: write-all, runs-on: ubuntu-latest, steps: []}
51005100` ,
51015101 ) ,
5102+ historicalWorkflow . replace (
5103+ ' runs-on: ubuntu-latest\n' ,
5104+ ' &permission_key permissions: write-all\n runs-on: ubuntu-latest\n' ,
5105+ ) ,
5106+ historicalWorkflow . replace (
5107+ ' runs-on: ubuntu-latest\n' ,
5108+ ' !!str permissions: write-all\n runs-on: ubuntu-latest\n' ,
5109+ ) ,
5110+ historicalWorkflow . replace (
5111+ ' runs-on: ubuntu-latest\n' ,
5112+ ' - permissions: write-all\n runs-on: ubuntu-latest\n' ,
5113+ ) ,
51025114 ]
51035115 for ( const unsafeWorkflow of unsafeWorkflows ) {
51045116 await writeFile ( workflowPath , unsafeWorkflow , 'utf8' )
You can’t perform that action at this time.
0 commit comments