Skip to content

Ruby: Minor change of SSRF concept #8524

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

Merged
merged 7 commits into from
Mar 24, 2022

Conversation

RasmusWL
Copy link
Member

When I added the Python query in #7420, I did some minor changes. This is only part of those changes, I will do another PR for the changes I made to disablesCertificateValidation once I have had time to change our query. (this PR had been laying around for some time, so will do it now so I wont forget about it).

I'm of the understanding that we can just make any breaking changes to the API as we want, since Ruby is still in beta, so that's why I haven't done any kind of deprecation 😉

Notice that the change-note would bump the major version of the library pack. If you don't want this, let me know, and I can change things 😊

This is a port of the same change in Python from
f8fc583

The description of that commit was:

> I think `getUrl` is a bit too misleading, since from the name, I would
> only ever expect ONE result for one request being made.
>
> `getAUrlPart` captures that there could be multiple results, and that
> they might not constitute a whole URl.
>
> Which is the same naming I used when I tried to model this a long time ago
> https://github.com/github/codeql/blob/a80860cdc6b06b363b0d0919600ab383a470b449/python/ql/lib/semmle/python/web/Http.qll#L102-L111
@RasmusWL RasmusWL requested a review from a team as a code owner March 22, 2022 09:57
@RasmusWL
Copy link
Member Author

The only failing check is 2 analyses not found from Code Scanning, so I think all looks good for a review now ☺️

@nickrolfe
Copy link
Contributor

We have mostly been attempting to follow the deprecation policy, since we already have query-writers working in other repos. This change looks like a simple rename, so I feel like it would be a good idea to keep the old name with the deprecated attribute.

RasmusWL and others added 2 commits March 22, 2022 16:48
Notice that we still don't fully keep our standard deprecation support,
since the new `getAUrlPart` is still abstract, and therefore will cause
compile errors if not implemented.
So an "old" query using the deprecated predicate, will still find the
same results, even when the modeling has been updated.
@RasmusWL
Copy link
Member Author

I have fixed things up, so uses of the concept follows deprecation policy, but definition of models are required to change their override to the new name. If that's not good enough for "mostly" follow the deprecation policy, I can do further changes 😊

Copy link
Contributor

@nickrolfe nickrolfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good, apart from my grammar nitpick in the changenote.

@RasmusWL RasmusWL requested a review from nickrolfe March 23, 2022 10:26
Copy link
Contributor

@nickrolfe nickrolfe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Co-authored-by"? Very fancy! 👌

@@ -484,6 +484,14 @@ module HTTP {
/** Gets a node which returns the body of the response */
DataFlow::Node getResponseBody() { result = super.getResponseBody() }

/**
* DEPRECATED: Use `getAUrlPart` instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't entirely related to this PR, but I was wondering what you thought about adding (2022-03-24) or similar to this comment so it's clear when the predicate was deprecated. I know we can estimate this using git blame, but that can become inaccurate if code gets moved around.

Even if it's a good idea, it might be something better added to all the deprecated predicates as a separate PR. I'm mostly just interested in thoughts.

Copy link
Member Author

@RasmusWL RasmusWL Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's an excellent idea 👍 (although git blame should have our back)

@RasmusWL RasmusWL merged commit 98c0d73 into github:main Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants