Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit a88bf4c

Browse files
authored
Merge pull request #177 from sauyon/whitelist
Use allow or allowlist instead of whitelist
2 parents 282b8cb + 66f733d commit a88bf4c

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

ql/src/RedundantCode/CompareIdenticalValues.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ from ComparisonExpr cmp, Expr l
1717
where
1818
l = cmp.getLeftOperand() and
1919
l.getGlobalValueNumber() = cmp.getRightOperand().getGlobalValueNumber() and
20-
// whitelist floats, where self-comparison may be used for NaN checks
20+
// allow floats, where self-comparison may be used for NaN checks
2121
not l.getType().getUnderlyingType() instanceof FloatType and
22-
// whitelist comparisons of symbolic constants to literal constants; these are often feature flags
22+
// allow comparisons of symbolic constants to literal constants; these are often feature flags
2323
not exists(DeclaredConstant decl |
2424
cmp.getAnOperand() = decl.getAReference() and
2525
cmp.getAnOperand() instanceof BasicLit

ql/src/RedundantCode/UnreachableStatement.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ControlFlow::Node nonGuardPredecessor(ControlFlow::Node nd) {
2121
)
2222
}
2323

24-
predicate whitelist(Stmt s) {
24+
predicate allowlist(Stmt s) {
2525
// `panic("unreachable")` and similar
2626
exists(CallExpr ce | ce = s.(ExprStmt).getExpr() or ce = s.(ReturnStmt).getExpr() |
2727
ce.getTarget().mustPanic() or ce.getCalleeName().toLowerCase() = "error"
@@ -49,5 +49,5 @@ from Stmt s, ControlFlow::Node fst
4949
where
5050
fst = s.getFirstControlFlowNode() and
5151
not exists(nonGuardPredecessor(fst)) and
52-
not whitelist(s)
52+
not allowlist(s)
5353
select s, "This statement is unreachable."

ql/src/Security/CWE-022/TaintedPath.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Ideally, follow these rules:
2424
<li>Do not allow directory separators such as "/" or "\" (depending on the file system).</li>
2525
<li>Do not rely on simply replacing problematic sequences such as "../". For example, after
2626
applying this filter to ".../...//", the resulting string would still be "../".</li>
27-
<li>Use a whitelist of known good patterns.</li>
27+
<li>Use an allowlist of known good patterns.</li>
2828
</ul>
2929
</recommendation>
3030

ql/src/Security/CWE-798/HardcodedCredentials.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ predicate isSensitive(DataFlow::Node sink, SensitiveExpr::Classification type) {
2323
exists(Write write, string name |
2424
write.getRhs() = sink and
2525
name = write.getLhs().getName() and
26-
// whitelist obvious test password variables
26+
// allow obvious test password variables
2727
not name.regexpMatch(HeuristicNames::notSensitive())
2828
|
2929
name.regexpMatch(HeuristicNames::maybeSensitive(type))
@@ -35,7 +35,7 @@ where
3535
exists(string val | val = source.getStringValue() and val != "" |
3636
isSensitive(sink, type) and
3737
DataFlow::localFlow(source, sink) and
38-
// whitelist obvious dummy/test values
38+
// allow obvious dummy/test values
3939
not PasswordHeuristics::isDummyPassword(val) and
4040
not sink.asExpr().(Ident).getName().regexpMatch(HeuristicNames::notSensitive())
4141
) and

ql/src/experimental/CWE-807/SensitiveConditionBypass.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ predicate isSensitive(DataFlow::Node sink, SensitiveExpr::Classification type) {
99
exists(Write write, string name |
1010
write.getRhs() = sink and
1111
name = write.getLhs().getName() and
12-
// whitelist obvious test password variables
12+
// allow obvious test password variables
1313
not name.regexpMatch(HeuristicNames::notSensitive())
1414
|
1515
name.regexpMatch(HeuristicNames::maybeSensitive(type))

ql/src/semmle/go/Scopes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ class DeclaredFunction extends Function, DeclaredEntity, @declfunctionobject {
507507
body.mayHaveSideEffects()
508508
or
509509
// functions declared in files with build constraints may be defined differently
510-
// for different platforms, so whitelist them to avoid false positives
510+
// for different platforms, so allow them to avoid false positives
511511
body.getFile().hasBuildConstraints()
512512
)
513513
}

0 commit comments

Comments
 (0)