Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remember CodeQL (5a0097b)? CodeQL basically runs GitHub LGTM on source code, looking for possible security issues.
Now that CodeQL is running, we can begin addressing reported issues.
Problems found include:
~~ Result of call that may return NULL dereferenced unconditionally ~~
If calloc(3) returns
nullptr
, we shouldn't pass it on toMultiByteToWideChar()
orWideCharToMultiByte()
without validation.~~ HttpClient created with CheckCertificateRevocationList disabled ~~
Apparently the
HttpClient
default constructor is "bad"; we should instead use theHttpClient(HttpMessageHandler)
constructor, provide our ownHttpClientHandler
, and ensure thatHttpClientHandler.CheckCertificateRevocationList
is True.~~ Arbitrary file write during archive extraction ("Zip Slip") ~~
tools/java-source-utils
(69e1b80) extracts the contents of.jar
files to look for.java
files to use for type resolution, as I couldn't find an easier way to getcom.github.javaparser
to use Java source code for type resolution purposes unless the Java source code was on-disk. Unfortunately, the.jar
extraction code was susceptible to "Zip Slip", wherein an entry in the.jar
may overwrite unexpected data if it has an entry name of e.g.../../this/is/really/bad
. Fix this by verifying that the target filename stays within the target directory structure.~~ Local-user-controlled data in path expression ~~
LGTM is complaining that
tools/java-source-utils
(69e1b80) accepts user-controlled data. These warnings will be ignored because the app is unusable without "user-controlled data"; consider thesejava-source-utils --help
fragments:These are all user-controlled, and they are necessary to allow
java-source-utils
to work.Similarly:
LGTM complains that
--output-javadoc FILE
accepts a user-controlled path which may control directory separator chars, and this is intentional; using it would be annoying if that weren't true!These uses can be ignored by appending the comment
// lgtm [java/path-injection-local]
.