Skip to content
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: Add Server-Side Request Forgery query #7015

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Ruby: Add Server-Side Request Forgery query #7015

wants to merge 6 commits into from

Conversation

Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
@hmac
Copy link
Contributor

@hmac hmac commented Nov 1, 2021

This closes github/codeql-team#502

The query finds cases where user input flows to the URL in an outgoing HTTP request.

We use the same sanitizer as with URL redirection: prefixing user input with some non-user-controlled string is treated as sanitizing it, because the user no longer has complete control over the URL of the request.

This PR also fixes a bug with CallExprCfgNode.getKeywordArgument, which was previously not giving any results.

hmac added 5 commits Nov 1, 2021
This test shows that `CallCfgNode.getKeywordArgument(string keyword)`
doesn't return any results.
This predicate now produces results.
This member predicate gets dataflow nodes which contribute to the URL of
the request.

Also consolidate the identical tests for each HTTP client.
@github-actions github-actions bot added the Ruby label Nov 1, 2021
@owen-mc owen-mc changed the title Add Server-Side Request Forgery query Ruby: Add Server-Side Request Forgery query Nov 1, 2021
* otherwise `ServerSideRequestForgeryCustomizations` should be imported instead.
*/

import codeql.ruby.DataFlow::DataFlow::PathGraph
Copy link
Contributor

@intrigus-lgtm intrigus-lgtm Nov 1, 2021

Is this missing import ruby as the first import statement?
AFAIK import ruby should be the first statement for caching (?) reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment