Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 479dcf5

Browse files
committed
JS: Update to use more inclusive language
1 parent 544b3d9 commit 479dcf5

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

javascript/ql/src/Security/CWE-915/PrototypePollutingFunction.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<p>
3131
Only merge or assign a property recursively when it is an own property of the <em>destination</em> object.
32-
Alternatively, blacklist the property names <code>__proto__</code> and <code>constructor</code>
32+
Alternatively, deny the property names <code>__proto__</code> and <code>constructor</code>
3333
from being merged or assigned to.
3434
</p>
3535
</recommendation>
@@ -54,7 +54,7 @@
5454
<sample src="examples/PrototypePollutingFunction_fixed.js"/>
5555

5656
<p>
57-
Alternatively, blacklist the <code>__proto__</code> and <code>constructor</code> properties:
57+
Alternatively, deny the <code>__proto__</code> and <code>constructor</code> properties:
5858
</p>
5959

6060
<sample src="examples/PrototypePollutingFunction_fixed2.js"/>

javascript/ql/src/Security/CWE-915/PrototypePollutingFunction.ql

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,26 +278,26 @@ class PropNameTracking extends DataFlow::Configuration {
278278
}
279279

280280
override predicate isBarrierGuard(DataFlow::BarrierGuardNode node) {
281-
node instanceof BlacklistEqualityGuard or
282-
node instanceof WhitelistEqualityGuard or
281+
node instanceof DenyListEqualityGuard or
282+
node instanceof AllowListEqualityGuard or
283283
node instanceof HasOwnPropertyGuard or
284284
node instanceof InExprGuard or
285285
node instanceof InstanceOfGuard or
286286
node instanceof TypeofGuard or
287-
node instanceof BlacklistInclusionGuard or
288-
node instanceof WhitelistInclusionGuard or
287+
node instanceof DenyListInclusionGuard or
288+
node instanceof AllowListInclusionGuard or
289289
node instanceof IsPlainObjectGuard
290290
}
291291
}
292292

293293
/**
294294
* Sanitizer guard of form `x === "__proto__"` or `x === "constructor"`.
295295
*/
296-
class BlacklistEqualityGuard extends DataFlow::LabeledBarrierGuardNode, ValueNode {
296+
class DenyListEqualityGuard extends DataFlow::LabeledBarrierGuardNode, ValueNode {
297297
override EqualityTest astNode;
298298
string propName;
299299

300-
BlacklistEqualityGuard() {
300+
DenyListEqualityGuard() {
301301
astNode.getAnOperand().getStringValue() = propName and
302302
propName = unsafePropName()
303303
}
@@ -312,10 +312,10 @@ class BlacklistEqualityGuard extends DataFlow::LabeledBarrierGuardNode, ValueNod
312312
/**
313313
* An equality test with something other than `__proto__` or `constructor`.
314314
*/
315-
class WhitelistEqualityGuard extends DataFlow::LabeledBarrierGuardNode, ValueNode {
315+
class AllowListEqualityGuard extends DataFlow::LabeledBarrierGuardNode, ValueNode {
316316
override EqualityTest astNode;
317317

318-
WhitelistEqualityGuard() {
318+
AllowListEqualityGuard() {
319319
not astNode.getAnOperand().getStringValue() = unsafePropName() and
320320
astNode.getAnOperand() instanceof Literal
321321
}
@@ -429,10 +429,10 @@ class TypeofGuard extends DataFlow::LabeledBarrierGuardNode, DataFlow::ValueNode
429429
/**
430430
* A check of form `["__proto__"].includes(x)` or similar.
431431
*/
432-
class BlacklistInclusionGuard extends DataFlow::LabeledBarrierGuardNode, InclusionTest {
432+
class DenyListInclusionGuard extends DataFlow::LabeledBarrierGuardNode, InclusionTest {
433433
UnsafePropLabel label;
434434

435-
BlacklistInclusionGuard() {
435+
DenyListInclusionGuard() {
436436
exists(DataFlow::ArrayCreationNode array |
437437
array.getAnElement().getStringValue() = label and
438438
array.flowsTo(getContainerNode())
@@ -449,8 +449,8 @@ class BlacklistInclusionGuard extends DataFlow::LabeledBarrierGuardNode, Inclusi
449449
/**
450450
* A check of form `xs.includes(x)` or similar, which sanitizes `x` in the true case.
451451
*/
452-
class WhitelistInclusionGuard extends DataFlow::LabeledBarrierGuardNode {
453-
WhitelistInclusionGuard() {
452+
class AllowListInclusionGuard extends DataFlow::LabeledBarrierGuardNode {
453+
AllowListInclusionGuard() {
454454
this instanceof TaintTracking::PositiveIndexOfSanitizer
455455
or
456456
this instanceof TaintTracking::MembershipTestSanitizer and

0 commit comments

Comments
 (0)