Skip to content

Commit

Permalink
Merge pull request #15292 from egregius313/egregius313/java/dataflow/…
Browse files Browse the repository at this point in the history
…common-sanitizers/uuid-and-date

Java: Add `java.util.UUID` and `java.util.Date` to the `SimpleTypeSanitizer` class
  • Loading branch information
egregius313 authored Jan 26, 2024
2 parents 031bd8b + ef884fa commit 4602f89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added the `java.util.Date` and `java.util.UUID` classes to the list of types in the `SimpleTypeSanitizer` class in `semmle.code.java.security.Sanitizers`.
7 changes: 5 additions & 2 deletions java/ql/lib/semmle/code/java/security/Sanitizers.qll
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import java
private import semmle.code.java.dataflow.DataFlow

/**
* A node whose type is a simple type unlikely to carry taint, such as primitives or their boxed counterparts.
* A node whose type is a simple type unlikely to carry taint, such as primitives and their boxed counterparts,
* `java.util.UUID` and `java.util.Date`.
*/
class SimpleTypeSanitizer extends DataFlow::Node {
SimpleTypeSanitizer() {
this.getType() instanceof PrimitiveType or
this.getType() instanceof BoxedType or
this.getType() instanceof NumberType
this.getType() instanceof NumberType or
this.getType().(RefType).hasQualifiedName("java.util", "UUID") or
this.getType().(RefType).hasQualifiedName("java.util", "Date")
}
}

0 comments on commit 4602f89

Please sign in to comment.