-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Java: Use of HTTP/FTP to download/upload Maven artifacts #2413
Java: Use of HTTP/FTP to download/upload Maven artifacts #2413
Conversation
This adds a security alert for the use of HTTP or FTP to download or upload artifacts using Maven.
Two additional things: I've submitted this PR for consideration by the GitHub Security Lab Bounty team here: github/securitylab#21 I have a test project that I used to build this query. I'm more than happy to create a test for this query as well, I just want to make sure that there's nothing special I need to do to enable. As mentioned in #2377 the XML logic is currently not automatically collected when building the QL database. Here is the test project I used to test this query, happy to port it into a unit test for this codebase. You can see an example of this query here: |
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.ql
Outdated
Show resolved
Hide resolved
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.ql
Outdated
Show resolved
Hide resolved
It's pretty dismaying that HTTPS is apparently the only layer of defense for authenticity of huge swathes of the free software supply chain. Considering how large the attack surface for exfiltrating server certificates can be, something better than that is sorely needed. (Which is of course in no way or shape a point against this query). |
@hmakholm Your assessment of this quite accurate, I wish we all had a better solution at this time. |
Nice query! LGTM, just a few minor things. The PR checks complain that the code is not formatted correctly - could you run autoformat? It's easy to do in e.g. VSCode - just right-click in the editor and select "Format Document" or hit Alt+Shift+F. If you're using Eclipse the short-cut is Ctrl+Shift+F. Adding a small test would be nice. If you look in |
Actually, I believe we don't yet have the tooling in place to allow anyone outside github to run the tests, so it may be a bit tricky to get right, so I can help you out with that part. If you add the test itself to a suitable subdir in |
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.
Hopefully these small changes will fix the qhelp preview failure.
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.qhelp
Outdated
Show resolved
Hide resolved
Hey all, My disconnected communication over the next two weeks is due to my being on vacation till December 7th. I'll see if I can steal some time to clean this up during this time, but if I can't, please understand that I'll get back to it as soon as I'm back home. I really appreciate the review feedback and suggestions!! |
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.
Nice query!
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.ql
Outdated
Show resolved
Hide resolved
Co-Authored-By: Felicity Chapman <[email protected]> Co-Authored-By: yo-h <[email protected]>
Back from my vacation! 😄 Per the request, I've reformatted the query. @aschackmull unless I've missed something, this PR should hopefully be in a state where you can add the Please let me know if there's anything else that you'd like to see in this change. |
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.ql
Outdated
Show resolved
Hide resolved
I've added the missing pieces of the test as a PR against your branch here JLLeitschuh#1 |
Java: Add .expected file to qltest.
Merged your PR! Thanks! I had 'Allow edits from maintainers.' turned on so you could have pushed directly to my branch if you'd wanted to. |
LGTM. Anyone have any further comments? I've triggered the CI, so I'll merge on green if there are no further comments. |
java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.qhelp
Outdated
Show resolved
Hide resolved
I haven't managed to see the qhelp preview yet. It would be good to have a quick look at that before we merge to check that nothing's broken. |
@felicitymay I'm not sure how to render a preview of the |
@JLLeitschuh The QHelp tooling is unfortunately still internal only. It's on my to-do list to add a (I think Felicity was not asking you to review it, but commenting for aschackmull and his team). |
It's being rendered as part of the CI that I triggered, but it failed due to an |
@JLLeitschuh - many apologies for my unclear comment. We're still working on how to make qhelp previews easy for other people to generate. The CI task seems to need a further fix, suggested by @aschackmull, which I don't think I have permission to merge. |
Anything I can do to help here? |
Yes. I don't have write access to your branch, so if you could just click the "Commit suggestion" button on the |
…qhelp Co-Authored-By: Anders Schack-Mulligen <[email protected]>
Done. Sorry, didn't realize that was lingering there. Applied now! 😄 |
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.
The query help looks fine. AFAIK, we haven't mentioned the CVSS base score previously, and perhaps we should start doing that for other queries?
Hi there |
@aschackmull, there's not yet a release note for this new query, right? Would you mind adding one? |
I've added a change note in #2615 both for this query as well as the other new one. |
This adds a security alert for the use of HTTP or FTP to download or upload artifacts using Maven.
Want to take over the Java ecosystem? All you need is a MITM!
Related to #2377