Merge pull request #4220 from erik-krogh/colonCmd

Approved by esbena
This commit is contained in:
CodeQL CI
2020-09-09 10:13:14 +01:00
committed by GitHub
4 changed files with 17 additions and 2 deletions

View File

@@ -30,6 +30,7 @@
| Incomplete URL substring sanitization (`js/incomplete-url-substring-sanitization`) | More results | This query now recognizes additional URLs when the substring check is an inclusion check. |
| Ambiguous HTML id attribute (`js/duplicate-html-id`) | Results no longer shown | Precision tag reduced to "low". The query is no longer run by default. |
| Unused loop iteration variable (`js/unused-loop-variable`) | Fewer results | This query no longer flags variables in a destructuring array assignment that are not the last variable in the destructed array. |
| Unsafe shell command constructed from library input (`js/shell-command-constructed-from-input`) | More results | This query now recognizes more commands where colon, dash, and underscore are used. |
| Unsafe jQuery plugin (`js/unsafe-jquery-plugin`) | More results | This query now detects more unsafe uses of nested option properties. |

View File

@@ -85,7 +85,7 @@ module UnsafeShellCommandConstruction {
this = root.getALeaf() and
root = isExecutedAsShellCommand(DataFlow::TypeBackTracker::end(), sys) and
exists(string prev | prev = this.getPreviousLeaf().getStringValue() |
prev.regexpMatch(".* ('|\")?[0-9a-zA-Z/]*")
prev.regexpMatch(".* ('|\")?[0-9a-zA-Z/:_-]*")
)
}
@@ -132,7 +132,7 @@ module UnsafeShellCommandConstruction {
this = call.getFormatArgument(_) and
call = isExecutedAsShellCommand(DataFlow::TypeBackTracker::end(), sys) and
exists(string formatString | call.getFormatString().mayHaveStringValue(formatString) |
formatString.regexpMatch(".* ('|\")?[0-9a-zA-Z/]*%.*")
formatString.regexpMatch(".* ('|\")?[0-9a-zA-Z/:_-]*%.*")
)
}

View File

@@ -176,6 +176,10 @@ nodes
| lib/lib.js:315:22:315:25 | name |
| lib/lib.js:320:23:320:26 | name |
| lib/lib.js:320:23:320:26 | name |
| lib/lib.js:324:40:324:42 | arg |
| lib/lib.js:324:40:324:42 | arg |
| lib/lib.js:325:49:325:51 | arg |
| lib/lib.js:325:49:325:51 | arg |
edges
| lib/lib2.js:3:28:3:31 | name | lib/lib2.js:4:22:4:25 | name |
| lib/lib2.js:3:28:3:31 | name | lib/lib2.js:4:22:4:25 | name |
@@ -388,6 +392,10 @@ edges
| lib/lib.js:314:40:314:43 | name | lib/lib.js:320:23:320:26 | name |
| lib/lib.js:314:40:314:43 | name | lib/lib.js:320:23:320:26 | name |
| lib/lib.js:314:40:314:43 | name | lib/lib.js:320:23:320:26 | name |
| lib/lib.js:324:40:324:42 | arg | lib/lib.js:325:49:325:51 | arg |
| lib/lib.js:324:40:324:42 | arg | lib/lib.js:325:49:325:51 | arg |
| lib/lib.js:324:40:324:42 | arg | lib/lib.js:325:49:325:51 | arg |
| lib/lib.js:324:40:324:42 | arg | lib/lib.js:325:49:325:51 | arg |
#select
| lib/lib2.js:4:10:4:25 | "rm -rf " + name | lib/lib2.js:3:28:3:31 | name | lib/lib2.js:4:22:4:25 | name | $@ based on library input is later used in $@. | lib/lib2.js:4:10:4:25 | "rm -rf " + name | String concatenation | lib/lib2.js:4:2:4:26 | cp.exec ... + name) | shell command |
| lib/lib2.js:8:10:8:25 | "rm -rf " + name | lib/lib2.js:7:32:7:35 | name | lib/lib2.js:8:22:8:25 | name | $@ based on library input is later used in $@. | lib/lib2.js:8:10:8:25 | "rm -rf " + name | String concatenation | lib/lib2.js:8:2:8:26 | cp.exec ... + name) | shell command |
@@ -441,3 +449,4 @@ edges
| lib/lib.js:308:11:308:26 | "rm -rf " + name | lib/lib.js:307:39:307:42 | name | lib/lib.js:308:23:308:26 | name | $@ based on library input is later used in $@. | lib/lib.js:308:11:308:26 | "rm -rf " + name | String concatenation | lib/lib.js:308:3:308:27 | cp.exec ... + name) | shell command |
| lib/lib.js:315:10:315:25 | "rm -rf " + name | lib/lib.js:314:40:314:43 | name | lib/lib.js:315:22:315:25 | name | $@ based on library input is later used in $@. | lib/lib.js:315:10:315:25 | "rm -rf " + name | String concatenation | lib/lib.js:315:2:315:26 | cp.exec ... + name) | shell command |
| lib/lib.js:320:11:320:26 | "rm -rf " + name | lib/lib.js:314:40:314:43 | name | lib/lib.js:320:23:320:26 | name | $@ based on library input is later used in $@. | lib/lib.js:320:11:320:26 | "rm -rf " + name | String concatenation | lib/lib.js:320:3:320:27 | cp.exec ... + name) | shell command |
| lib/lib.js:325:12:325:51 | "MyWind ... " + arg | lib/lib.js:324:40:324:42 | arg | lib/lib.js:325:49:325:51 | arg | $@ based on library input is later used in $@. | lib/lib.js:325:12:325:51 | "MyWind ... " + arg | String concatenation | lib/lib.js:326:2:326:13 | cp.exec(cmd) | shell command |

View File

@@ -319,4 +319,9 @@ module.exports.typeofcheck = function (name) {
} else {
cp.exec("rm -rf " + name); // NOT OK
}
}
module.exports.typeofcheck = function (arg) {
var cmd = "MyWindowCommand | findstr /i /c:" + arg; // NOT OK
cp.exec(cmd);
}