Skip to content

Commit 01fb1e3

Browse files
committed
Python: Get rid of deprecated terms in code and .qhelp.
1 parent 2081d0c commit 01fb1e3

File tree

11 files changed

+18
-18
lines changed

11 files changed

+18
-18
lines changed

python/ql/src/Classes/ConflictingAttributesInBaseClasses.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ predicate calls_super(FunctionObject f) {
3131
)
3232
}
3333

34-
/** Holds if the given name is white-listed for some reason */
35-
predicate whitelisted(string name) {
34+
/** Holds if the given name is allowed for some reason */
35+
predicate allowed(string name) {
3636
/*
3737
* The standard library specifically recommends this :(
3838
* See https://docs.python.org/3/library/socketserver.html#asynchronous-mixins
@@ -53,7 +53,7 @@ where
5353
not name.matches("\\_\\_%\\_\\_") and
5454
not calls_super(o1) and
5555
not does_nothing(o2) and
56-
not whitelisted(name) and
56+
not allowed(name) and
5757
not o1.overrides(o2) and
5858
not o2.overrides(o1) and
5959
not c.declaresAttribute(name)

python/ql/src/Metrics/FLinesOfDuplicatedCode.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ where
2020
count(int line |
2121
exists(DuplicateBlock d | d.sourceFile() = f |
2222
line in [d.sourceStartLine() .. d.sourceEndLine()] and
23-
not whitelistedLineForDuplication(f, line)
23+
not allowlistedLineForDuplication(f, line)
2424
)
2525
)
2626
select f, n order by n desc

python/ql/src/Metrics/FLinesOfSimilarCode.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ where
2020
count(int line |
2121
exists(SimilarBlock d | d.sourceFile() = f |
2222
line in [d.sourceStartLine() .. d.sourceEndLine()] and
23-
not whitelistedLineForDuplication(f, line)
23+
not allowlistedLineForDuplication(f, line)
2424
)
2525
)
2626
select f, n order by n desc

python/ql/src/Security/CWE-020/IncompleteUrlSubstringSanitization.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<p>
6969

7070
The second two examples show safe checks.
71-
In <code>safe1</code>, a white-list is used. Although fairly inflexible,
71+
In <code>safe1</code>, an allowlist is used. Although fairly inflexible,
7272
this is easy to get right and is most likely to be safe.
7373
</p>
7474
<p>

python/ql/src/Security/CWE-020/examples/IncompleteUrlSubstringSanitization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ def unsafe2(request):
2121

2222

2323

24-
#Simplest and safest approach is to use a white-list
24+
#Simplest and safest approach is to use an allowlist
2525

2626
@app.route('/some/path/good1')
2727
def safe1(request):
28-
whitelist = [
28+
allowlist = [
2929
"example.com/home",
3030
"example.com/login",
3131
]
3232
target = request.args.get('target', '')
33-
if target in whitelist:
33+
if target in allowlist:
3434
return redirect(target)
3535

3636
#More complex example allowing sub-domains.

python/ql/src/Security/CWE-022/PathInjection.qhelp

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

python/ql/src/Security/CWE-078/CommandInjection.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ safe before using it.</p>
2525

2626
<p>The following example shows two functions. The first is unsafe as it takes a shell script that can be changed
2727
by a user, and passes it straight to <code>subprocess.call()</code> without examining it first.
28-
The second is safe as it selects the command from a predefined white-list.</p>
28+
The second is safe as it selects the command from a predefined allowlist.</p>
2929

3030
<sample src="examples/command_injection.py" />
3131

python/ql/src/Security/CWE-078/examples/command_injection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ def command_execution_unsafe(request):
1919
def command_execution_safe(request):
2020
if request.method == 'POST':
2121
action = request.POST.get('action', '')
22-
#GOOD -- Use a whitelist
22+
#GOOD -- Use an allowlist
2323
subprocess.call(["application", COMMANDS[action]])

python/ql/src/Variables/ShadowBuiltin.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import python
1616
import Shadowing
1717
import semmle.python.types.Builtins
1818

19-
predicate white_list(string name) {
19+
predicate allow_list(string name) {
2020
/* These are rarely used and thus unlikely to be confusing */
2121
name = "iter" or
2222
name = "next" or
@@ -51,7 +51,7 @@ predicate shadows(Name d, string name, Function scope, int line) {
5151
) and
5252
d.getScope() = scope and
5353
d.getLocation().getStartLine() = line and
54-
not white_list(name) and
54+
not allow_list(name) and
5555
not optimizing_parameter(d)
5656
}
5757

python/ql/src/external/CodeDuplication.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,6 @@ predicate similarScopes(Scope s, Scope other, float percent, string message) {
268268
* Holds if the line is acceptable as a duplicate.
269269
* This is true for blocks of import statements.
270270
*/
271-
predicate whitelistedLineForDuplication(File f, int line) {
271+
predicate allowlistedLineForDuplication(File f, int line) {
272272
exists(ImportingStmt i | i.getLocation().getFile() = f and i.getLocation().getStartLine() = line)
273273
}

0 commit comments

Comments
 (0)