Skip to content

Commit 3850734

Browse files
committed
Use non-extending subtypes
1 parent 93d7c5c commit 3850734

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

go/ql/lib/semmle/go/security/OpenUrlRedirectCustomizations.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,20 @@ module OpenUrlRedirect {
9999
* A call to a function called `isLocalUrl`, `isValidRedirect`, or similar, which is
100100
* considered a barrier guard for sanitizing untrusted URLs.
101101
*/
102-
class RedirectCheckBarrierGuardAsBarrierGuard extends RedirectCheckBarrier, Barrier { }
102+
class RedirectCheckBarrierGuardAsBarrierGuard extends Barrier instanceof RedirectCheckBarrier { }
103103

104104
/**
105105
* A call to a regexp match function, considered as a barrier guard for sanitizing untrusted URLs.
106106
*
107107
* This is overapproximate: we do not attempt to reason about the correctness of the regexp.
108108
*/
109-
class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, Barrier { }
109+
class RegexpCheckAsBarrierGuard extends Barrier instanceof RegexpCheckBarrier { }
110110

111111
/**
112112
* A check against a constant value or the `Hostname` function,
113113
* considered a barrier guard for url flow.
114114
*/
115-
class UrlCheckAsBarrierGuard extends UrlCheckBarrier, Barrier { }
115+
class UrlCheckAsBarrierGuard extends Barrier instanceof UrlCheckBarrier { }
116116
}
117117

118118
/** A sink for an open redirect, considered as a sink for safe URL flow. */

go/ql/lib/semmle/go/security/RequestForgeryCustomizations.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ module RequestForgery {
102102
* A call to a function called `isLocalUrl`, `isValidRedirect`, or similar, which is
103103
* considered a barrier guard.
104104
*/
105-
class RedirectCheckBarrierGuardAsBarrierGuard extends RedirectCheckBarrier, Sanitizer { }
105+
class RedirectCheckBarrierGuardAsBarrierGuard extends Sanitizer instanceof RedirectCheckBarrier {
106+
}
106107

107108
/**
108109
* A call to a regexp match function, considered as a barrier guard for sanitizing untrusted URLs.
109110
*
110111
* This is overapproximate: we do not attempt to reason about the correctness of the regexp.
111112
*/
112-
class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, Sanitizer { }
113+
class RegexpCheckAsBarrierGuard extends Sanitizer instanceof RegexpCheckBarrier { }
113114

114115
/**
115116
* An equality check comparing a data-flow node against a constant string, considered as
@@ -118,7 +119,7 @@ module RequestForgery {
118119
* Additionally, a check comparing `url.Hostname()` against a constant string is also
119120
* considered a barrier guard for `url`.
120121
*/
121-
class UrlCheckAsBarrierGuard extends UrlCheckBarrier, Sanitizer { }
122+
class UrlCheckAsBarrierGuard extends Sanitizer instanceof UrlCheckBarrier { }
122123

123124
/**
124125
* A simple-typed node, considered a sanitizer for request forgery.

go/ql/src/experimental/CWE-287/ImproperLdapAuthCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module ImproperLdapAuth {
2929
*
3030
* This is overapproximate: we do not attempt to reason about the correctness of the regexp.
3131
*/
32-
class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, LdapSanitizer { }
32+
class RegexpCheckAsBarrierGuard extends LdapSanitizer instanceof RegexpCheckBarrier { }
3333

3434
/**
3535
* An empty string.

go/ql/src/experimental/CWE-918/SSRF.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module ServerSideRequestForgery {
113113
*
114114
* This is overapproximate: we do not attempt to reason about the correctness of the regexp.
115115
*/
116-
class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, Sanitizer { }
116+
class RegexpCheckAsBarrierGuard extends Sanitizer instanceof RegexpCheckBarrier { }
117117

118118
private predicate equalityAsSanitizerGuard(DataFlow::Node g, Expr e, boolean outcome) {
119119
exists(DataFlow::Node url, DataFlow::EqualityTestNode eq |
@@ -156,5 +156,5 @@ module ServerSideRequestForgery {
156156
* The method Var of package validator is a sanitizer guard only if the check
157157
* of the error binding exists, and the tag to check is one of "alpha", "alphanum", "alphaunicode", "alphanumunicode", "number", "numeric".
158158
*/
159-
class ValidatorAsSanitizer extends Sanitizer, ValidatorVarCheckBarrier { }
159+
class ValidatorAsSanitizer extends Sanitizer instanceof ValidatorVarCheckBarrier { }
160160
}

0 commit comments

Comments
 (0)