Skip to content

Commit f513a19

Browse files
author
Alvaro Muñoz
committed
fix: restrict EnvCtxAccessExpr to Env decarlations on the same file
1 parent 68f15f2 commit f513a19

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

ql/lib/codeql/actions/Ast.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,10 @@ class InputsCtxAccessExpr extends CtxAccessExpr {
500500
override string getFieldName() { result = fieldName }
501501

502502
override Expression getRefExpr() {
503-
exists(ReusableWorkflowStmt w |
504-
w.getLocation().getFile() = this.getLocation().getFile() and
505-
w.getInputsStmt().getInputExpr(fieldName) = result
506-
)
503+
result.getLocation().getFile() = this.getLocation().getFile() and
504+
exists(ReusableWorkflowStmt w | w.getInputsStmt().getInputExpr(fieldName) = result)
507505
or
508-
exists(CompositeActionStmt a |
509-
a.getLocation().getFile() = this.getLocation().getFile() and
510-
a.getInputsStmt().getInputExpr(fieldName) = result
511-
)
506+
exists(CompositeActionStmt a | a.getInputsStmt().getInputExpr(fieldName) = result)
512507
}
513508
}
514509

@@ -528,6 +523,7 @@ class EnvCtxAccessExpr extends CtxAccessExpr {
528523
override string getFieldName() { result = fieldName }
529524

530525
override Expression getRefExpr() {
526+
result.getLocation().getFile() = this.getLocation().getFile() and
531527
exists(JobUsesExpr s | s.getEnvExpr(fieldName) = result)
532528
or
533529
exists(StepUsesExpr s | s.getEnvExpr(fieldName) = result)

0 commit comments

Comments
 (0)