Open mlevesquedion opened 4 years ago
I would like to qualify this example:
func Oops(s Source) {
Sanitize(s)
Sink(s)
}
In some cases this may in fact not be an incorrect sanitization. Indeed, if the sensitive field is a map
or other pointer-like type, the sanitizer will be able to do its job because it will get a copy of the pointer.
We may wish to be able to detect incorrect uses of sanitization by value. Consider the following sanitizer:
Now consider the following incorrect use of this sanitizer:
The issue is rather obvious: since
Sanitize
receives a copy ofs
, the originals
is not sanitized.Although the issue is obvious, we currently do not produce a report for it. For additional context, here is the correct way to use a "value" sanitizer:
The reason the incorrect case above does not yield a report is that our checks to determine whether a
source
was sanitized before reaching asink
rely ondomination
of thesink
instruction by thesanitizer
instruction. This allows us to handle cases like this:So it seems we will need some way to treat sanitizers differently depending on whether they take their argument by pointer or by value.