@@ -85,8 +85,8 @@ public void uploadFile3() throws IOException {
85
85
// BAD: Upload file to user specified path without validation through request attribute
86
86
public void uploadFile4 () throws IOException {
87
87
String savePath = getPara ("dir" );
88
- setAttr ("uploadDir " , savePath );
89
- String requestUploadDir = getAttr ("uploadDir " );
88
+ setAttr ("uploadDir2 " , savePath );
89
+ String requestUploadDir = getAttr ("uploadDir2 " );
90
90
91
91
File file = getFile ("fileParam" ).getFile ();
92
92
String finalFilePath = BASE_PATH + requestUploadDir ;
@@ -108,8 +108,8 @@ public void uploadFile4() throws IOException {
108
108
// BAD: Upload file to user specified path without validation through session object (not detected)
109
109
public void uploadFile5 () throws IOException {
110
110
String savePath = getPara ("dir" );
111
- getSession ().setAttribute ("uploadDir " , savePath );
112
- String sessionUploadDir = getSessionAttr ("uploadDir " );
111
+ getSession ().setAttribute ("uploadDir3 " , savePath );
112
+ String sessionUploadDir = getSessionAttr ("uploadDir3 " );
113
113
114
114
File file = getFile ("fileParam" ).getFile ();
115
115
String finalFilePath = BASE_PATH + sessionUploadDir ;
@@ -130,8 +130,8 @@ public void uploadFile5() throws IOException {
130
130
131
131
// GOOD: Upload file to a system path from a request object
132
132
public void uploadFile6 () throws IOException {
133
- setAttr ("uploadDir " , "/data/upload_dir/" );
134
- String requestUploadDir = getAttr ("uploadDir " );
133
+ setAttr ("uploadDir4 " , "/data/upload_dir/" );
134
+ String requestUploadDir = getAttr ("uploadDir4 " );
135
135
136
136
File file = getFile ("fileParam" ).getFile ();
137
137
String finalFilePath = BASE_PATH + requestUploadDir ;
@@ -153,9 +153,9 @@ public void uploadFile6() throws IOException {
153
153
// GOOD: Upload file to a system path from a request object
154
154
public void uploadFile7 () throws IOException {
155
155
String savePath = getPara ("dir" );
156
- setAttr ("uploadDir " , savePath );
156
+ setAttr ("uploadDir5 " , savePath );
157
157
setAttr ("realUploadDir" , "/data/upload_dir/" );
158
- String requestUploadDir = getAttr ("realUploadDir " );
158
+ String requestUploadDir = getAttr ("realUploadDir5 " );
159
159
160
160
File file = getFile ("fileParam" ).getFile ();
161
161
String finalFilePath = BASE_PATH + requestUploadDir ;
0 commit comments