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

Skip to content

Commit 4334a51

Browse files
committed
Make StoredCommand use new API
1 parent ac1670c commit 4334a51

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

go/ql/lib/semmle/go/security/StoredCommand.qll

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ import CommandInjectionCustomizations
1717
*/
1818
module StoredCommand {
1919
/**
20+
* DEPRECATED: Use `Flow` instead.
21+
*
2022
* A taint-tracking configuration for reasoning about command-injection vulnerabilities.
2123
*/
22-
class Configuration extends TaintTracking::Configuration {
24+
deprecated class Configuration extends TaintTracking::Configuration {
2325
Configuration() { this = "StoredCommand" }
2426

2527
override predicate isSource(DataFlow::Node source) {
@@ -39,4 +41,18 @@ module StoredCommand {
3941
guard instanceof CommandInjection::SanitizerGuard
4042
}
4143
}
44+
45+
private module Config implements DataFlow::ConfigSig {
46+
predicate isSource(DataFlow::Node source) {
47+
source instanceof StoredXss::Source and
48+
// exclude file names, since those are not generally an issue
49+
not source instanceof StoredXss::FileNameSource
50+
}
51+
52+
predicate isSink(DataFlow::Node sink) { sink instanceof CommandInjection::Sink }
53+
54+
predicate isBarrier(DataFlow::Node node) { node instanceof CommandInjection::Sanitizer }
55+
}
56+
57+
module Flow = TaintTracking::Global<Config>;
4258
}

go/ql/src/Security/CWE-078/StoredCommand.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
import go
1515
import semmle.go.security.StoredCommand
16-
import DataFlow::PathGraph
16+
import StoredCommand::Flow::PathGraph
1717

18-
from StoredCommand::Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
19-
where cfg.hasFlowPath(source, sink)
18+
from StoredCommand::Flow::PathNode source, StoredCommand::Flow::PathNode sink
19+
where StoredCommand::Flow::flowPath(source, sink)
2020
select sink.getNode(), source, sink, "This command depends on a $@.", source.getNode(),
2121
"stored value"

0 commit comments

Comments
 (0)