Files
codeql/java/ql/test/query-tests/security/CWE-079/semmle/tests/WebsocketXss.java
Porcupiney Hairs 4f07733b06 remove U+200B
2020-08-30 04:54:02 +05:30

28 lines
992 B
Java

// package test.cwe079.cwe.examples;
// import java.net.http.HttpClient;
// import java.net.http.WebSocket;
// import java.net.URI;
// import java.util.*;
// import java.util.concurrent.*;
// public class WebsocketXss {
// public static void main(String[] args) throws Exception {
// WebSocket.Listener listener = new WebSocket.Listener() {
// public CompletionStage<?> onText(WebSocket webSocket, CharSequence message, boolean last) {
// try {
// HttpClient client = HttpClient.newBuilder().build();
// CompletableFuture<WebSocket> ws = client.newWebSocketBuilder()
// .buildAsync(URI.create("ws://websocket.example.com"), null);
// ws.get().sendText(message, false);
// } catch (Exception e) {
// // TODO: handle exception
// }
// return null;
// };
// };
// }
// }