-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Go: misc trivial fixes #21109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Go: misc trivial fixes #21109
Changes from all commits
64905df
7e2177c
7ee79c5
f16c077
c9f0064
46c75df
a062d51
abda17d
47b5fac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,14 +98,15 @@ module RequestForgery { | |
| * A call to a function called `isLocalUrl`, `isValidRedirect`, or similar, which is | ||
| * considered a barrier guard. | ||
| */ | ||
| class RedirectCheckBarrierGuardAsBarrierGuard extends RedirectCheckBarrier, Sanitizer { } | ||
| class RedirectCheckBarrierGuardAsBarrierGuard extends Sanitizer instanceof RedirectCheckBarrier { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this make sense as a ql-for-ql check too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pattern we are looking for is "extend an abstract class by adding all instances of another class". I'm not totally sure how you'd search for this using ql-for-ql. It relies a lot on knowing the intention. I used the regex |
||
| } | ||
|
|
||
| /** | ||
| * A call to a regexp match function, considered as a barrier guard for sanitizing untrusted URLs. | ||
| * | ||
| * This is overapproximate: we do not attempt to reason about the correctness of the regexp. | ||
| */ | ||
| class RegexpCheckAsBarrierGuard extends RegexpCheckBarrier, Sanitizer { } | ||
| class RegexpCheckAsBarrierGuard extends Sanitizer instanceof RegexpCheckBarrier { } | ||
|
|
||
| /** | ||
| * An equality check comparing a data-flow node against a constant string, considered as | ||
|
|
@@ -114,7 +115,7 @@ module RequestForgery { | |
| * Additionally, a check comparing `url.Hostname()` against a constant string is also | ||
| * considered a barrier guard for `url`. | ||
| */ | ||
| class UrlCheckAsBarrierGuard extends UrlCheckBarrier, Sanitizer { } | ||
| class UrlCheckAsBarrierGuard extends Sanitizer instanceof UrlCheckBarrier { } | ||
|
|
||
| /** | ||
| * A simple-typed node, considered a sanitizer for request forgery. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a coding-style policy that could be written as a ql-for-ql check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. I don't know if other language libraries follow the same convention, but in the Go library we aim to always puts a
Rangesupertype first, followed by other supertypes. I'm not sure it's worth the effort though. Maybe if people agree to this convention for all language libraries.