Merged
Conversation
Put routing modelling inside a Routing module.
This allows frameworks to add new instances where a node is interpreted as a regular expression. We introduce a class RegExpInterpretation::Range that represents these nodes. In the future we may want to make this a full Concept, but it's not necessary at the moment.
Add type summaries to recognise instances of Mime::Type, and recognise arguments to Mime::Type.match? and Mime::Type.=~ as regular expression interpretations.
aibaars
previously approved these changes
Aug 1, 2022
Contributor
aibaars
left a comment
There was a problem hiding this comment.
Looks good to me. Let's add a change note and fix the QLDoc warning.
ruby/ql/lib/codeql/ruby/Regexp.qll
Outdated
|
|
||
| /** | ||
| * Holds if `source` may be interpreted as a regular expression. | ||
| * Nodes interpreted as regular expressions via various standard library methods. |
Contributor
There was a problem hiding this comment.
Let's address The QLDoc for a class should start with 'A', 'An', or 'The'. warning.
| row = | ||
| [ | ||
| // Mime[type] : Mime::Type (omitted) | ||
| // Method names with brackets like [] cannot be represented in MaD. |
Contributor
There was a problem hiding this comment.
@asgerf Is there a way to escape [ and ] symbols in a member name?
aibaars
approved these changes
Aug 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mime::Type#match?andMime::Type#=~convert their argument to a regular expression, so they're relevant for queries like ReDoS. This PR adds modeling forMime::Typeso we recognise instances of it and consider arguments these two methods to be regular expressions.