-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Java: add websocket reads as remote flow source. #3543
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
Conversation
aschackmull
left a comment
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.
Overall LGTM, but the qldoc needs some minor fixups, and the test doesn't run (likely needs additional stubs).
However, I wasn't able to find many uses of this in the wild: https://lgtm.com/query/7727712516629826150/
Do you think this is because it isn't used much, or is there some subtle bug in the modeling that prevents us from finding more?
| HttpClient client = HttpClient.newBuilder().build(); | ||
| CompletableFuture<WebSocket> ws = client.newWebSocketBuilder() | ||
| .buildAsync(URI.create("ws://websocket.example.com"), null); | ||
| ws.get().sendText(message, false); |
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.
| ws.get().sendText(message, false); | |
| ws.get().sendText(message, false); |
Remove U+200B character.
|
@aschackmull This is dependent on github/securitylab#142 The WebSocket package was only available starting Java 11, CodeQL extractor by default uses Java 8. Hence, the tests don't compile and run. The test code does not depend on any third party libraries so there's nothing I need to stub here. As for the positive result on LGTM, I dont know why only that one was detected. Github's fuzzy search returns about 4000+ results for |
Websocket are pretty new. Most of Github's fuzzy search results are in forks of the jdk sources. |
|
For the test you can add a file called That makes the test run with Java 11 instead of 8. |
|
@aschackmull Unfortunately, that does not work. You may see in the The |
|
I've done some debugging and found the reason why this qltest fails to compile. For the sake of reproducibility we run all the qltests in a fixed and fairly minimal JDK, and this doesn't include the For this PR, I think the best way forward is to commit a completely commented-out version of the Btw., when running the test locally I found that it didn't produce any new results - I guess the XSS sink is also missing. Presumably |
Currently, JAX-WS reads are considered as untrusted. However, `java.net.http.WebSocket` reads are not marked as such. This PR adds support for the same.
|
@aschackmull Yes, the For my corresponding Golang PR, I had included the send calls as sinks but those were rejected by the team and hence had to be removed. See this comment here for the context. That's the reason I didn't include them in this one. Please let me know if you think otherwise. I would be more than happy to add them here. I have comment out the |
|
Alright, this looks almost ready to merge, then. Could I just ask you to remove the U+200B character in |
|
@aschackmull Done 👍 |
Currently, JAX-WS reads are considered as untrusted. However,
java.net.http.WebSocketreads are not marked as such. This PR adds support for the same.