-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Model Sinatra #11954
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
Ruby: Model Sinatra #11954
Conversation
Adds some very basic modeling of Sinatra applications. We recognise the `params` call in Sinatra routes as an HTTP request input access.
/** | ||
* A summary for accessing a local variable in an ERB template. | ||
* This is the second half of the modelling of the flow from the `locals` keyword argument to variables in the ERB template. | ||
* The first half is modeled by `ErbLocalsSummary`. | ||
*/ |
Check warning
Code scanning / CodeQL
Misspelling
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.
This looks great - no real suggestions.
*/ | ||
class ErbLocalsHashSyntheticGlobal extends SummaryComponent::SyntheticGlobal { | ||
private string id; | ||
private MethodCall erbCall; |
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.
I'm assuming that making this an ErbCall
leads to non-monotonic recursion problems?
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.
Yep, exactly right.
/** | ||
* Like `Location.toString`, but displays the relative path rather than the full path. | ||
*/ | ||
private string locationRelativePathToString(Location loc) { |
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.
Does using this instead of toString
make a difference in practice, or is it more a case of neatness/readability of the synthetic global ID?
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.
I don't know if there's any performance difference or otherwise - I just liked having a slightly neater ID 😀
I had hoped to catch a few more CVEs with this, but sadly they require a bit more in the way of modeling. Opening this for review now so others can build on it.