Skip to content

Commit 48f9e0e

Browse files
Adress review comments: Add missing deprecation + additional test case
1 parent 7aa2816 commit 48f9e0e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

python/ql/lib/semmle/python/security/dataflow/UrlRedirectCustomizations.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,15 @@ module UrlRedirect {
140140
}
141141

142142
/**
143-
* A comparison with a constant string, considered as a sanitizer-guard.
143+
* A comparison with a constant, considered as a sanitizer-guard.
144144
*/
145-
class StringConstCompareAsSanitizerGuard extends Sanitizer, ConstCompareBarrier {
145+
class ConstCompareAsSanitizerGuard extends Sanitizer, ConstCompareBarrier {
146146
override predicate sanitizes(FlowState state) {
147147
// sanitize all flow states
148148
any()
149149
}
150150
}
151+
152+
/** DEPRECATED: Use ConstCompareAsSanitizerGuard instead. */
153+
deprecated class StringConstCompareAsSanitizerGuard = ConstCompareAsSanitizerGuard;
151154
}

python/ql/test/library-tests/dataflow/tainttracking/commonSanitizer/test_const_compare.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ def test_in_list_with_constants():
106106
else:
107107
ensure_tainted(ts) # $ tainted
108108

109+
if ts in ["safe", not_constant(), None]:
110+
ensure_tainted(ts) # $ tainted
111+
112+
def not_constant():
113+
return "x"
109114

110115
SAFE = ["safe", "also_safe"]
111116

0 commit comments

Comments
 (0)