Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update python/ql/lib/semmle/python/security/dataflow/LogInjectionCust…
…omizations.qll

Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
  • Loading branch information
yoff and RasmusWL authored Feb 14, 2022
commit 3a995ec1b1189a0c585fcde54f131114ad26d195
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ module LogInjection {
* A call to replace line breaks, considered as a sanitizer.
*/
class ReplaceLineBreaksSanitizer extends Sanitizer, DataFlow::CallCfgNode {
// This is actually not safe:
// Note: This sanitizer is not 100% accurate, since:
// - we do not check that all kinds of line breaks are replaced
// - we do not check that one kind of line breaks is not replaced by another
// however, we lack a simple way to do better, and the query would likely
// be too noisy without this. Consider rewriting using flow states.
//
// However, we lack a simple way to do better, and the query would likely
// be too noisy without this.
//
// TODO: Consider rewriting using flow states.
ReplaceLineBreaksSanitizer() {
this.getFunction().(DataFlow::AttrRead).getAttributeName() = "replace" and
this.getArg(0).asExpr().(StrConst).getText() in ["\r\n", "\n"]
Expand Down