Skip to content

Java : add request forgery query #3454

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 10 commits into from Nov 26, 2020
Merged

Java : add request forgery query #3454

merged 10 commits into from Nov 26, 2020

Conversation

ghost
Copy link

@ghost ghost commented May 12, 2020

This query adds support for detecting SSRF in Java.

@ghost ghost requested review from felicitymay and a team as code owners May 12, 2020 13:35
@ghost
Copy link
Author

ghost commented May 12, 2020

I just noticed #3452 tackles a similar issue. I will give a brief of how my PR differs from the latter.

  • That one adds support for only openConnection calls. I add support for multiple other calls from the java.net.http and apache http client libraries.

  • I have also included library as well as query tests for the same.

  • I haven't included any barriers for the flow while Java: CWE-918: Server side request forgery #3452 considers addition with lhs as :// as a blocking step.

  • Java: CWE-918: Server side request forgery #3452 is asking to be merged as an experimental one while I would like this to be included as stable.

@pwntester
Copy link
Contributor

Can you please open a corresponding securitylab issue for tracking?

@ghost
Copy link
Author

ghost commented Jun 26, 2020

I have added a few stubs which I had missed earlier and rebased this to the latest master. This is now ready to be reviewed and merged.

Copy link
Contributor

@felicitymay felicitymay left a comment

Choose a reason for hiding this comment

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

I should have mentioned earlier, I was added as a reviewer automatically by the CODEOWNERS file. However this PR doesn't need a review from the docs team because most of the changes are to the experimental directory. We've since updated the CODEOWNERS file to reflect this.

@adityasharad adityasharad changed the base branch from master to main August 14, 2020 18:34
@ghost
Copy link
Author

ghost commented Aug 30, 2020

@aschackmull I have rebased to the latest main. This is now ready for review.

@smowton smowton self-assigned this Oct 7, 2020
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Hello! Apologies for slowness on our part; I'm taking over reviewing and hope the process will be much quicker from here. Quite a few comments but nothing too time-consuming I hope.

@ghost
Copy link
Author

ghost commented Nov 3, 2020

@smowton Sorry for the delay in addressing the review. I was on a long vacation. I have made the changes and merged the latest master into the branch.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Just some minor comments, checking the evaluation status for this one

@smowton
Copy link
Contributor

smowton commented Nov 4, 2020

Once your subsidiary PR is merged please rebase onto main (rather than merge it in)

@smowton
Copy link
Contributor

smowton commented Nov 4, 2020

Looks like eval was done long ago, will flag this to codeql-java owners for review

@aschackmull
Copy link
Contributor

Could we get this rebased on main? The changes from #4600 still show up here.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

Just noticed some public defns with missing doc comments

result = this.getArgument(1)
}

Expr protocolArg() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing doc comment

numArgs = this.getNumArgument()
}

Argument getUriArg() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing doc comment

Copy link
Contributor

@aschackmull aschackmull left a comment

Choose a reason for hiding this comment

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

I have more comments, but let's start with this.

@aschackmull
Copy link
Contributor

The qldoc generally needs a lot of updates to bring it in line with https://github.com/github/codeql/blob/main/docs/qldoc-style-guide.md. Note in particular:

  • Classes are documented with a noun-phrase, such as A <thing> that <has properties>. or The <some unique thing>.
  • Predicates with results use a third-person verb phrase of the form Gets (a|the) <thing>.

@ghost
Copy link
Author

ghost commented Nov 18, 2020

@aschackmull I have pushed a few changes. Do I fix them now?

@aschackmull
Copy link
Contributor

I've written a bunch of additional suggested changes in a PR against this PR. Please merge https://github.com/porcupineyhairs/ql/pull/2 into this PR.

aschackmull and others added 2 commits November 24, 2020 13:18
Co-authored-by: Chris Smowton <smowton@github.com>
@ghost
Copy link
Author

ghost commented Nov 24, 2020

@aschackmull Merged!

@aschackmull aschackmull merged commit f70072a into github:main Nov 26, 2020
@ghost ghost deleted the javaSSRf branch November 26, 2020 16:39
@Marcono1234
Copy link
Contributor

Is it intended that the files of this query are directly in the src/experimental directory instead of src/experimental/Security/CWE?

(Sorry if this has been mentioned in one of the review comments; I only went over the pull request comments, but did not find anything regarding this)

@smowton
Copy link
Contributor

smowton commented Feb 11, 2021

They don't appear to be? What file are you referring to?

@Marcono1234
Copy link
Contributor

@smowton
Copy link
Contributor

smowton commented Feb 12, 2021

Doh right, I thought you meant files directly within the experimental directory

@smowton
Copy link
Contributor

smowton commented Feb 12, 2021

#5153

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.

7 participants