Skip to content

Commit 483e5c5

Browse files
committed
C#: Re-factor ExposureOfPrivateInformation to use the new API.
1 parent cc4f3f6 commit 483e5c5

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

csharp/ql/lib/semmle/code/csharp/security/dataflow/ExposureOfPrivateInformationQuery.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ abstract class Sink extends DataFlow::ExprNode { }
2323
abstract class Sanitizer extends DataFlow::ExprNode { }
2424

2525
/**
26+
* DEPRECATED: Use `ExposureOfPrivateInformation` instead.
27+
*
2628
* A taint-tracking configuration for private information flowing unencrypted to an external location.
2729
*/
2830
class TaintTrackingConfiguration extends TaintTracking::Configuration {
@@ -35,6 +37,22 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
3537
override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
3638
}
3739

40+
/**
41+
* A taint-tracking configuration for private information flowing unencrypted to an external location.
42+
*/
43+
private module ExposureOfPrivateInformationConfig implements DataFlow::ConfigSig {
44+
predicate isSource(DataFlow::Node source) { source instanceof Source }
45+
46+
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
47+
48+
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
49+
}
50+
51+
/**
52+
* A taint-tracking module for private information flowing unencrypted to an external location.
53+
*/
54+
module ExposureOfPrivateInformation = TaintTracking::Global<ExposureOfPrivateInformationConfig>;
55+
3856
private class PrivateDataSource extends Source {
3957
PrivateDataSource() { this.getExpr() instanceof PrivateDataExpr }
4058
}

csharp/ql/src/Security Features/CWE-359/ExposureOfPrivateInformation.ql

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

1414
import csharp
1515
import semmle.code.csharp.security.dataflow.ExposureOfPrivateInformationQuery
16-
import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
16+
import ExposureOfPrivateInformation::PathGraph
1717

18-
from TaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
19-
where c.hasFlowPath(source, sink)
18+
from ExposureOfPrivateInformation::PathNode source, ExposureOfPrivateInformation::PathNode sink
19+
where ExposureOfPrivateInformation::flowPath(source, sink)
2020
select sink.getNode(), source, sink,
2121
"Private data returned by $@ is written to an external location.", source.getNode(),
2222
source.getNode().toString()

0 commit comments

Comments
 (0)