Skip to content

Commit 44c32c6

Browse files
committed
Convert barrier for cleartext logging to MaD
1 parent 352c07a commit 44c32c6

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

go/ql/lib/ext/builtin.model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
extensions:
2+
- addsTo:
3+
pack: codeql/go-all
4+
extensible: barrierModel
5+
data:
6+
- ["", "error", False, "Error", "", "", "ReturnValue", "go/clear-text-logging", "manual"]
27
- addsTo:
38
pack: codeql/go-all
49
extensible: summaryModel

go/ql/lib/ext/fmt.model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ extensions:
66
- ["fmt", "", False, "Print", "", "", "Argument[0]", "log-injection", "manual"]
77
- ["fmt", "", False, "Printf", "", "", "Argument[0..1]", "log-injection", "manual"]
88
- ["fmt", "", False, "Println", "", "", "Argument[0]", "log-injection", "manual"]
9+
- addsTo:
10+
pack: codeql/go-all
11+
extensible: barrierModel
12+
data:
13+
- ["fmt", "Stringer", False, "String", "", "", "ReturnValue", "go/clear-text-logging", "manual"]
914
- addsTo:
1015
pack: codeql/go-all
1116
extensible: summaryModel

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,8 @@ module CleartextLogging {
2222
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
2323

2424
predicate isBarrier(DataFlow::Node node) {
25-
node instanceof Barrier
26-
or
25+
node instanceof Barrier or
2726
barrierNode(node, "go/clear-text-logging")
28-
or
29-
exists(DataFlow::CallNode call | node = call.getResult() |
30-
call.getTarget() = Builtin::error().getType().getMethod("Error")
31-
or
32-
call.getTarget().(Method).hasQualifiedName("fmt", "Stringer", "String")
33-
)
3427
}
3528

3629
predicate isBarrierIn(DataFlow::Node node) { isSource(node) }

0 commit comments

Comments
 (0)