Python: Clarify SensitiveAttributeAccess

The comment about imports was placed wrong. I also realized we didn't
even have a single test-case for
`this.(DataFlow::AttrRead).getAttributeNameExpr() = sensitiveLookupStringConst(classification)`
so I added that (notice that this is only `getattr(foo, x)` and not
`getattr(foo, "password")`)
This commit is contained in:
Rasmus Wriedt Larsen
2021-06-10 14:09:47 +02:00
parent 3819a361b5
commit eb4f168dd4
2 changed files with 7 additions and 2 deletions

View File

@@ -153,10 +153,12 @@ private module SensitiveDataModeling {
SensitiveDataClassification classification;
SensitiveAttributeAccess() {
nameIndicatesSensitiveData(this.(DataFlow::AttrRead).getAttributeName(), classification)
or
// Things like `foo.<sensitive-name>` or `from <module> import <sensitive-name>`
// I considered excluding any `from ... import something_sensitive`, but then realized that
// we should flag up `form ... import password as ...` as a password
nameIndicatesSensitiveData(this.(DataFlow::AttrRead).getAttributeName(), classification)
or
// Things like `getattr(foo, <reference-to-string>)`
this.(DataFlow::AttrRead).getAttributeNameExpr() = sensitiveLookupStringConst(classification)
}