Uh oh!
There was an error while loading. Please reload this page.
Add missing string replacement sanitizers to log-injection and string-break - #731
Add missing string replacement sanitizers to log-injection and string-break#731owen-mc wants to merge 5 commits into
Conversation
owen-mc
commented
May 4, 2022
Currently missing: tracing back from the receiver of a call to |
I've also add the extra sanitizers to the other place where string replacement is a sanitizer. (Note: this does include the "tracing back" to find out what kind of quote is being replaced.) It might be worth combining the two very similar implementations. |
smowton
left a comment
There was a problem hiding this comment.
Looks sensible, couple of small things to fix
| StringsNewReplacerCall() { this.getTarget().hasQualifiedName("strings", "NewReplacer") } | ||
| DataFlow::Node getAReplacedArgument() { | ||
| exists(int m, int n | m = 2 * n and n = m / 2 and result = getArgument(m)) |
There was a problem hiding this comment.
| exists(intm,intn| m =2* n and n =m/2 and result=getArgument(m)) | |
| exists(intm| m %2=0andresult=getArgument(m)) |
| exists(StringsNewReplacerConfiguration config, DataFlow::Node source, DataFlow::Node sink | | ||
| config.hasFlow(source, sink) and | ||
| this.getTarget().hasQualifiedName("strings", "Replacer", "Replace") and | ||
| sink = this.getReceiver() and |
There was a problem hiding this comment.
Use exists( DataFlow::MethodCallNode mcn | ... this = mcn.getResult()) rather than assume that a method-call node is its own result
owen-mc
commented
May 5, 2022
@smowton Currently, for log injection this PR doesn't check that the receiver of a call to |
smowton
commented
May 7, 2022
Given we're doing it for StringBreak already and the other sanitisers in LogInjectionCustomizations do check what's being replaced, yes I think we should do likewise and try to check the replace args. If it proves too expensive to measure cross-method we can do it locally. |
strings.Replacer.Replaceandstrings.Replacer.WriteString