Sensitive GET Query

This commit is contained in:
luchua-bc
2020-12-26 16:51:30 +00:00
parent 49f902d28b
commit ffe9d4a310
7 changed files with 133 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
edges
| SensitiveGetQuery.java:12:38:12:45 | password : String | SensitiveGetQuery.java:12:22:12:45 | ... + ... |
nodes
| SensitiveGetQuery.java:12:22:12:45 | ... + ... | semmle.label | ... + ... |
| SensitiveGetQuery.java:12:38:12:45 | password : String | semmle.label | password : String |
#select
| SensitiveGetQuery.java:12:22:12:45 | ... + ... | SensitiveGetQuery.java:12:38:12:45 | password : String | SensitiveGetQuery.java:12:22:12:45 | ... + ... | $@ uses GET request method with sensitive information. | SensitiveGetQuery.java:12:38:12:45 | password | sensitive query string |

View File

@@ -0,0 +1,20 @@
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
public class SensitiveGetQuery extends HttpServlet {
// BAD - Tests sending sensitive information in a GET request.
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String password = request.getParameter("password");
System.out.println("password = " + password);
}
// GOOD - Tests sending sensitive information in a POST request.
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String password = request.getParameter("password");
System.out.println("password = " + password);
}
}

View File

@@ -0,0 +1 @@
experimental/Security/CWE/CWE-598/SensitiveGetQuery.ql

View File

@@ -0,0 +1 @@
// semmle-extractor-options: --javac-args -cp ${testdir}/../../../../stubs/servlet-api-2.4