1010
1111import rust
1212private import codeql.rust.Concepts
13+ private import codeql.rust.security.SensitiveData
1314private import codeql.rust.dataflow.DataFlow
1415
1516/**
@@ -23,7 +24,7 @@ module NormalHashFunction {
2324 /**
2425 * A data flow source for "use of a broken or weak cryptographic hashing algorithm on sensitive
2526 * data" vulnerabilities that does not require computationally expensive hashing. That is, a
26- * piece of sensitive data.
27+ * piece of sensitive data that is not a password .
2728 */
2829 abstract class Source extends DataFlow:: Node {
2930 Source ( ) { not this instanceof ComputationallyExpensiveHashFunction:: Source }
@@ -52,7 +53,19 @@ module NormalHashFunction {
5253 */
5354 abstract class Barrier extends DataFlow:: Node { }
5455
55- // TODO: SensitiveDataSourceAsSource
56+ /**
57+ * A flow source modelled by the `SensitiveData` library.
58+ */
59+ class SensitiveDataAsSource extends Source instanceof SensitiveData {
60+ SensitiveDataAsSource ( ) {
61+ not this .( SensitiveData ) .getClassification ( ) = SensitiveDataClassification:: password ( ) and // (covered in ComputationallyExpensiveHashFunction)
62+ not this .( SensitiveData ) .getClassification ( ) = SensitiveDataClassification:: id ( ) // (not accurate enough)
63+ }
64+
65+ override SensitiveDataClassification getClassification ( ) {
66+ result = this .( SensitiveData ) .getClassification ( )
67+ }
68+ }
5669
5770 /**
5871 * A flow sink modelled by the `Cryptography` module.
@@ -117,7 +130,18 @@ module ComputationallyExpensiveHashFunction {
117130 */
118131 abstract class Barrier extends DataFlow:: Node { }
119132
120- // TODO: PasswordSourceAsSource
133+ /**
134+ * A flow source modelled by the `SensitiveData` library.
135+ */
136+ class PasswordAsSource extends Source instanceof SensitiveData {
137+ PasswordAsSource ( ) {
138+ this .( SensitiveData ) .getClassification ( ) = SensitiveDataClassification:: password ( )
139+ }
140+
141+ override SensitiveDataClassification getClassification ( ) {
142+ result = this .( SensitiveData ) .getClassification ( )
143+ }
144+ }
121145
122146 /**
123147 * A flow sink modelled by the `Cryptography` module.
0 commit comments