mirror of
https://github.com/github/codeql.git
synced 2026-01-30 06:42:57 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user