Skip to content

Commit f8fccc0

Browse files
authored
Merge pull request #5 from NOAA-PMEL/master
Get upstream changes including request filter.
2 parents 993abd1 + 170d68d commit f8fccc0

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

JavaSource/gov/noaa/pmel/tmap/las/filter/RequestInputFilter.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
186186
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Request contains an illegal query parameter.");
187187
return;
188188
}
189+
if ( !validateTemplates(request) ) {
190+
LASAction.logerror(request, "Illegal request parameter value.", "Request contains a parameter value that is not allowed.");
191+
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Request contains an illegal query parameter value.");
192+
return;
193+
}
189194
if ( ! validBooleanValues(request) ) {
190195
LASAction.logerror(request, "Illegal request parameter value.", "Request contains a parameter value that is not allowed.");
191196
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Request contains an illegal boolean query parameter value.");
@@ -254,6 +259,18 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
254259
filterChain.doFilter( servletRequest, servletResponse );
255260
return;
256261
}
262+
public boolean validateTemplates(HttpServletRequest request) {
263+
String value[] = request.getParameterValues("template");
264+
if ( value != null ) {
265+
for (int i = 0; i < value.length; i++) {
266+
String v = value[i];
267+
if (v.toLowerCase().contains(">") || v.toLowerCase().contains("<") || v.toLowerCase().contains("script")) {
268+
return false;
269+
}
270+
}
271+
}
272+
return true;
273+
}
257274
public void init(FilterConfig arg0) throws ServletException {
258275

259276
}

WebContent/output/placeholder.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Keep me or remove me from the deployed location, it doesn't matter.
2+
But keep me in $LAS_HOME so the war file includes me.

configure.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,10 @@
726726

727727
print "Building addXML and the servlet war file.\n";
728728
system("ant addxml-build; ant deploy");
729-
729+
if ($? != 0) {
730+
print "Build failed!\n";
731+
exit 1;
732+
}
730733
print "\n\n";
731734

732735
createScripts();

0 commit comments

Comments
 (0)