Skip to content

Commit f16c077

Browse files
committed
Use non-extending subtypes
1 parent 7ee79c5 commit f16c077

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

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

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

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

107107
/**
108108
* A check against a constant value or the `Hostname` function,
109109
* considered a barrier guard for url flow.
110110
*/
111-
class UrlCheckAsBarrierGuard extends UrlCheckBarrier, Barrier { }
111+
class UrlCheckAsBarrierGuard extends Barrier instanceof UrlCheckBarrier { }
112112
}
113113

114114
/** 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
@@ -98,14 +98,15 @@ module RequestForgery {
9898
* A call to a function called `isLocalUrl`, `isValidRedirect`, or similar, which is
9999
* considered a barrier guard.
100100
*/
101-
class RedirectCheckBarrierGuardAsBarrierGuard extends RedirectCheckBarrier, Sanitizer { }
101+
class RedirectCheckBarrierGuardAsBarrierGuard extends Sanitizer instanceof RedirectCheckBarrier {
102+
}
102103

103104
/**
104105
* A call to a regexp match function, considered as a barrier guard for sanitizing untrusted URLs.
105106
*
106107
* This is overapproximate: we do not attempt to reason about the correctness of the regexp.
107108
*/
108-
class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, Sanitizer { }
109+
class RegexpCheckAsBarrierGuard extends Sanitizer instanceof RegexpCheckBarrier { }
109110

110111
/**
111112
* An equality check comparing a data-flow node against a constant string, considered as
@@ -114,7 +115,7 @@ module RequestForgery {
114115
* Additionally, a check comparing `url.Hostname()` against a constant string is also
115116
* considered a barrier guard for `url`.
116117
*/
117-
class UrlCheckAsBarrierGuard extends UrlCheckBarrier, Sanitizer { }
118+
class UrlCheckAsBarrierGuard extends Sanitizer instanceof UrlCheckBarrier { }
118119

119120
/**
120121
* 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)