Add class for default taint sanitizer guards

This allows us to specify taint sanitizer guards that apply in
all configurations.
This commit is contained in:
Owen Mansel-Chan
2021-01-18 10:51:59 +00:00
parent 83c26a3594
commit 903ff33b0d
3 changed files with 19 additions and 2 deletions

View File

@@ -187,3 +187,16 @@ abstract class DefaultTaintSanitizer extends DataFlow::Node { }
* but not in local taint.
*/
predicate isDefaultTaintSanitizer(DataFlow::Node node) { node instanceof DefaultTaintSanitizer }
/**
* A sanitizer guard in all global taint flow configurations but not in local taint.
*/
abstract class DefaultTaintSanitizerGuard extends DataFlow::BarrierGuard { }
/**
* Holds if `guard` should be a sanitizer guard in all global taint flow configurations
* but not in local taint.
*/
predicate isDefaultTaintSanitizerGuard(DataFlow::BarrierGuard guard) {
guard instanceof DefaultTaintSanitizerGuard
}

View File

@@ -92,7 +92,9 @@ abstract class Configuration extends DataFlow::Configuration {
/** Holds if taint propagation through nodes guarded by `guard` is prohibited. */
predicate isSanitizerGuard(DataFlow::BarrierGuard guard) { none() }
final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) { isSanitizerGuard(guard) }
final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) {
isSanitizerGuard(guard) or isDefaultTaintSanitizerGuard(guard)
}
/**
* Holds if the additional taint propagation step from `node1` to `node2`

View File

@@ -92,7 +92,9 @@ abstract class Configuration extends DataFlow::Configuration {
/** Holds if taint propagation through nodes guarded by `guard` is prohibited. */
predicate isSanitizerGuard(DataFlow::BarrierGuard guard) { none() }
final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) { isSanitizerGuard(guard) }
final override predicate isBarrierGuard(DataFlow::BarrierGuard guard) {
isSanitizerGuard(guard) or isDefaultTaintSanitizerGuard(guard)
}
/**
* Holds if the additional taint propagation step from `node1` to `node2`