Skip to content

Commit 264d6db

Browse files
committed
Rename AllowListGuard to AllowedPrefixGuard
1 parent 90020b6 commit 264d6db

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

java/ql/lib/semmle/code/java/security/PathSanitizer.qll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ private class ExactPathMatchSanitizer extends PathInjectionSanitizer {
6969
}
7070
}
7171

72-
private class AllowListGuard extends Guard instanceof MethodAccess {
73-
AllowListGuard() {
72+
private class AllowedPrefixGuard extends Guard instanceof MethodAccess {
73+
AllowedPrefixGuard() {
7474
(isStringPrefixMatch(this) or isPathPrefixMatch(this)) and
7575
not isDisallowedWord(super.getAnArgument())
7676
}
@@ -79,27 +79,27 @@ private class AllowListGuard extends Guard instanceof MethodAccess {
7979
}
8080

8181
/**
82-
* Holds if `g` is a guard that considers a path safe because it is checked against an allowlist of partial trusted values.
82+
* Holds if `g` is a guard that considers a path safe because it is checked against trusted prefixes.
8383
* This requires additional protection against path traversal, either another guard (`PathTraversalGuard`)
8484
* or a sanitizer (`PathNormalizeSanitizer`), to ensure any internal `..` components are removed from the path.
8585
*/
86-
private predicate allowListGuard(Guard g, Expr e, boolean branch) {
86+
private predicate allowedPrefixGuard(Guard g, Expr e, boolean branch) {
8787
branch = true and
88-
TaintTracking::localExprTaint(e, g.(AllowListGuard).getCheckedExpr()) and
88+
TaintTracking::localExprTaint(e, g.(AllowedPrefixGuard).getCheckedExpr()) and
8989
exists(Expr previousGuard |
9090
TaintTracking::localExprTaint(previousGuard.(PathNormalizeSanitizer),
91-
g.(AllowListGuard).getCheckedExpr())
91+
g.(AllowedPrefixGuard).getCheckedExpr())
9292
or
9393
previousGuard
9494
.(PathTraversalGuard)
9595
.controls(g.getBasicBlock().(ConditionBlock), previousGuard.(PathTraversalGuard).getBranch())
9696
)
9797
}
9898

99-
private class AllowListSanitizer extends PathInjectionSanitizer {
100-
AllowListSanitizer() {
101-
this = DataFlow::BarrierGuard<allowListGuard/3>::getABarrierNode() or
102-
this = ValidationMethod<allowListGuard/3>::getAValidatedNode()
99+
private class AllowedPrefixSanitizer extends PathInjectionSanitizer {
100+
AllowedPrefixSanitizer() {
101+
this = DataFlow::BarrierGuard<allowedPrefixGuard/3>::getABarrierNode() or
102+
this = ValidationMethod<allowedPrefixGuard/3>::getAValidatedNode()
103103
}
104104
}
105105

@@ -111,7 +111,7 @@ private predicate dotDotCheckGuard(Guard g, Expr e, boolean branch) {
111111
branch = g.(PathTraversalGuard).getBranch() and
112112
TaintTracking::localExprTaint(e, g.(PathTraversalGuard).getCheckedExpr()) and
113113
exists(Guard previousGuard |
114-
previousGuard.(AllowListGuard).controls(g.getBasicBlock().(ConditionBlock), true)
114+
previousGuard.(AllowedPrefixGuard).controls(g.getBasicBlock().(ConditionBlock), true)
115115
or
116116
previousGuard.(BlockListGuard).controls(g.getBasicBlock().(ConditionBlock), false)
117117
)

0 commit comments

Comments
 (0)