Skip to content

Commit 0f239e3

Browse files
authored
Merge pull request github#7782 from geoffw0/clrtxt7
C++: Fix FPs for cpp/cleartext-storage-file
2 parents 864b61a + a695f02 commit 0f239e3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cpp/ql/src/Security/CWE/CWE-311/CleartextFileWrite.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ where
6565
midNode.getNode().asExpr() = mid and
6666
mid = w.getASource() and
6767
dest = w.getDest() and
68+
not dest.(VariableAccess).getTarget().getName() = ["stdin", "stdout", "stderr"] and // exclude calls with standard streams
6869
not isFileName(globalValueNumber(source)) and // file names are not passwords
6970
not exists(string convChar | convChar = w.getSourceConvChar(mid) | not convChar = ["s", "S"]) // ignore things written with other conversion characters
7071
select w, sourceNode, midNode,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The `cpp/cleartext-storage-file` query has been improved, removing false positives where data is written to a standard output stream.

0 commit comments

Comments
 (0)