File tree Expand file tree Collapse file tree
javascript/ql/src/semmle/javascript/security/dataflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,23 +35,11 @@ module CleartextLogging {
3535 override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof Barrier }
3636
3737 override predicate isSanitizerEdge ( DataFlow:: Node pred , DataFlow:: Node succ ) {
38- succ . ( DataFlow :: PropRead ) . getBase ( ) = pred
38+ CleartextLogging :: isSanitizerEdge ( pred , succ )
3939 }
4040
4141 override predicate isAdditionalTaintStep ( DataFlow:: Node src , DataFlow:: Node trg ) {
42- // A taint propagating data flow edge through objects: a tainted write taints the entire object.
43- exists ( DataFlow:: PropWrite write |
44- write .getRhs ( ) = src and
45- trg .( DataFlow:: SourceNode ) .flowsTo ( write .getBase ( ) )
46- )
47- or
48- // Taint through the arguments object.
49- exists ( DataFlow:: CallNode call , Function f |
50- src = call .getAnArgument ( ) and
51- f = call .getACallee ( ) and
52- not call .isImprecise ( ) and
53- trg .asExpr ( ) = f .getArgumentsVariable ( ) .getAnAccess ( )
54- )
42+ CleartextLogging:: isAdditionalTaintStep ( src , trg )
5543 }
5644 }
5745}
Original file line number Diff line number Diff line change @@ -189,4 +189,30 @@ module CleartextLogging {
189189 class PartiallySensitiveMap extends DataFlow:: FlowLabel {
190190 PartiallySensitiveMap ( ) { this = "PartiallySensitiveMap" }
191191 }
192+
193+ /**
194+ * Holds if the edge `pred` -> `succ` should be sanitized for clear-text logging of sensitive information.
195+ */
196+ predicate isSanitizerEdge ( DataFlow:: Node pred , DataFlow:: Node succ ) {
197+ succ .( DataFlow:: PropRead ) .getBase ( ) = pred
198+ }
199+
200+ /**
201+ * Holds if the edge `src` -> `trg` is an additional taint-step for clear-text logging of sensitive information.
202+ */
203+ predicate isAdditionalTaintStep ( DataFlow:: Node src , DataFlow:: Node trg ) {
204+ // A taint propagating data flow edge through objects: a tainted write taints the entire object.
205+ exists ( DataFlow:: PropWrite write |
206+ write .getRhs ( ) = src and
207+ trg .( DataFlow:: SourceNode ) .flowsTo ( write .getBase ( ) )
208+ )
209+ or
210+ // Taint through the arguments object.
211+ exists ( DataFlow:: CallNode call , Function f |
212+ src = call .getAnArgument ( ) and
213+ f = call .getACallee ( ) and
214+ not call .isImprecise ( ) and
215+ trg .asExpr ( ) = f .getArgumentsVariable ( ) .getAnAccess ( )
216+ )
217+ }
192218}
You can’t perform that action at this time.
0 commit comments