Remove the same callable constraint

This commit is contained in:
luchua-bc
2022-02-15 12:44:23 +00:00
parent 2b5982fd9d
commit fd533f2ba8
2 changed files with 9 additions and 10 deletions

View File

@@ -50,8 +50,7 @@ private class SetToGetAttributeStep extends AdditionalValueStep {
sma.getMethod() instanceof SetRequestAttributeMethod sma.getMethod() instanceof SetRequestAttributeMethod
) and ) and
gma.getArgument(0).(CompileTimeConstantExpr).getStringValue() = gma.getArgument(0).(CompileTimeConstantExpr).getStringValue() =
sma.getArgument(0).(CompileTimeConstantExpr).getStringValue() and sma.getArgument(0).(CompileTimeConstantExpr).getStringValue()
gma.getEnclosingCallable() = sma.getEnclosingCallable()
| |
pred.asExpr() = sma.getArgument(1) and pred.asExpr() = sma.getArgument(1) and
succ.asExpr() = gma succ.asExpr() = gma

View File

@@ -85,8 +85,8 @@ public class FilePathInjection extends Controller {
// BAD: Upload file to user specified path without validation through request attribute // BAD: Upload file to user specified path without validation through request attribute
public void uploadFile4() throws IOException { public void uploadFile4() throws IOException {
String savePath = getPara("dir"); String savePath = getPara("dir");
setAttr("uploadDir", savePath); setAttr("uploadDir2", savePath);
String requestUploadDir = getAttr("uploadDir"); String requestUploadDir = getAttr("uploadDir2");
File file = getFile("fileParam").getFile(); File file = getFile("fileParam").getFile();
String finalFilePath = BASE_PATH + requestUploadDir; String finalFilePath = BASE_PATH + requestUploadDir;
@@ -108,8 +108,8 @@ public class FilePathInjection extends Controller {
// BAD: Upload file to user specified path without validation through session object (not detected) // BAD: Upload file to user specified path without validation through session object (not detected)
public void uploadFile5() throws IOException { public void uploadFile5() throws IOException {
String savePath = getPara("dir"); String savePath = getPara("dir");
getSession().setAttribute("uploadDir", savePath); getSession().setAttribute("uploadDir3", savePath);
String sessionUploadDir = getSessionAttr("uploadDir"); String sessionUploadDir = getSessionAttr("uploadDir3");
File file = getFile("fileParam").getFile(); File file = getFile("fileParam").getFile();
String finalFilePath = BASE_PATH + sessionUploadDir; String finalFilePath = BASE_PATH + sessionUploadDir;
@@ -130,8 +130,8 @@ public class FilePathInjection extends Controller {
// GOOD: Upload file to a system path from a request object // GOOD: Upload file to a system path from a request object
public void uploadFile6() throws IOException { public void uploadFile6() throws IOException {
setAttr("uploadDir", "/data/upload_dir/"); setAttr("uploadDir4", "/data/upload_dir/");
String requestUploadDir = getAttr("uploadDir"); String requestUploadDir = getAttr("uploadDir4");
File file = getFile("fileParam").getFile(); File file = getFile("fileParam").getFile();
String finalFilePath = BASE_PATH + requestUploadDir; String finalFilePath = BASE_PATH + requestUploadDir;
@@ -153,9 +153,9 @@ public class FilePathInjection extends Controller {
// GOOD: Upload file to a system path from a request object // GOOD: Upload file to a system path from a request object
public void uploadFile7() throws IOException { public void uploadFile7() throws IOException {
String savePath = getPara("dir"); String savePath = getPara("dir");
setAttr("uploadDir", savePath); setAttr("uploadDir5", savePath);
setAttr("realUploadDir", "/data/upload_dir/"); setAttr("realUploadDir", "/data/upload_dir/");
String requestUploadDir = getAttr("realUploadDir"); String requestUploadDir = getAttr("realUploadDir5");
File file = getFile("fileParam").getFile(); File file = getFile("fileParam").getFile();
String finalFilePath = BASE_PATH + requestUploadDir; String finalFilePath = BASE_PATH + requestUploadDir;