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

Skip to content

Commit e026b9e

Browse files
committed
JS: Mark regressions due to lack of local field steps
1 parent e5bee19 commit e026b9e

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

  • javascript/ql/test/query-tests/Security
    • CWE-078/UnsafeShellCommandConstruction/lib
    • CWE-079/UnsafeHtmlConstruction
    • CWE-094/CodeInjection/lib
    • CWE-915/PrototypePollutingAssignment

javascript/ql/test/query-tests/Security/CWE-078/UnsafeShellCommandConstruction/lib/lib.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ function MyTrainer(opts) {
363363

364364
MyTrainer.prototype = {
365365
train: function() {
366-
var command = "learn " + this.learn_args + " " + model; // $ Alert
367-
cp.exec(command);
366+
var command = "learn " + this.learn_args + " " + model; // $ MISSING: Alert - lack of local field step
367+
cp.exec(command);
368368
}
369369
};
370370
module.exports.MyTrainer = MyTrainer;

javascript/ql/test/query-tests/Security/CWE-079/UnsafeHtmlConstruction/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Foo {
4444

4545
doXss() {
4646
// not called here, but still bad.
47-
document.querySelector("#class").innerHTML = "<span>" + this.step + "</span>"; // $ Alert
47+
document.querySelector("#class").innerHTML = "<span>" + this.step + "</span>"; // $ MISSING: Alert - needs localFieldStep
4848
}
4949

5050
}

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection/lib/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function Template(text, opts) {
4848
Template.prototype = {
4949
compile: function () {
5050
var opts = this.opts;
51-
eval(" var " + opts.varName + " = something();"); // $ Alert
51+
eval(" var " + opts.varName + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
5252
},
5353
// The below are justs tests that ensure the global-access-path computations terminate.
5454
pathsTerminate1: function (node, prev) {
@@ -100,10 +100,10 @@ export class AccessPathClass {
100100
}
101101

102102
doesTaint() {
103-
eval(" var " + this.options1.taintedOption + " = something();"); // $ Alert
104-
eval(" var " + this.options2.taintedOption + " = something();"); // $ Alert
105-
eval(" var " + this.options3.taintedOption + " = something();"); // $ Alert
106-
eval(" var " + this.taint + " = something();"); // $ Alert
103+
eval(" var " + this.options1.taintedOption + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
104+
eval(" var " + this.options2.taintedOption + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
105+
eval(" var " + this.options3.taintedOption + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
106+
eval(" var " + this.taint + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
107107
}
108108
}
109109

@@ -132,10 +132,10 @@ export class AccessPathClassBB {
132132
}
133133

134134
doesTaint() {
135-
eval(" var " + this.options1.taintedOption + " = something();"); // $ Alert
136-
eval(" var " + this.options2.taintedOption + " = something();"); // $ Alert
137-
eval(" var " + this.options3.taintedOption + " = something();"); // $ Alert
138-
eval(" var " + this.taint + " = something();"); // $ Alert
135+
eval(" var " + this.options1.taintedOption + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
136+
eval(" var " + this.options2.taintedOption + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
137+
eval(" var " + this.options3.taintedOption + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
138+
eval(" var " + this.taint + " = something();"); // $ MISSING: Alert - due to lack of localFieldStep
139139
}
140140
}
141141

javascript/ql/test/query-tests/Security/CWE-915/PrototypePollutingAssignment/lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Foo {
6767
const obj = this.obj;
6868
const path = this.path;
6969
const value = this.value;
70-
return (obj[path[0]][path[1]] = value); // $ Alert
70+
return (obj[path[0]][path[1]] = value); // $ MISSING: Alert - lacking local field step
7171
}
7272

7373
safe() {

0 commit comments

Comments
 (0)