File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
opengrok-indexer/src/main/java/org/opengrok/indexer/web
opengrok-web/src/main/webapp Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 19
19
20
20
/*
21
21
* Copyright (c) 2020, Chris Fraire <[email protected] >.
22
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
22
23
*/
23
24
package org .opengrok .indexer .web ;
24
25
@@ -72,6 +73,17 @@ public static String launderRevision(String value) {
72
73
return replaceAll (value , "[^a-zA-Z0-9:]" , "" );
73
74
}
74
75
76
+ /**
77
+ * Sanitize {@code value} where it will be used in subsequent OpenGrok
78
+ * (non-logging) processing. The value is assumed to represent a pagination query string,
79
+ * e.g. {@code n=25&start=25}
80
+ * @return {@code null} if null or else {@code value} with anything besides
81
+ * alphanumeric or {@code &}, {@code =} characters removed.
82
+ */
83
+ public static String launderPaginationQueryString (String value ) {
84
+ return replaceAll (value , "[^a-zA-Z0-9=&]" , "" );
85
+ }
86
+
75
87
/**
76
88
* Sanitize {@code value} where it will be used in subsequent OpenGrok
77
89
* (non-logging) processing. The value is assumed to represent URI path,
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ org.opengrok.indexer.web.Util"
48
48
<%@ page import =" jakarta.servlet.http.HttpServletResponse" %>
49
49
<%@ page import =" org.opengrok.indexer.web.SortOrder" %>
50
50
<%@ page import =" java.util.Optional" %>
51
+ <%@ page import =" org.opengrok.indexer.web.Laundromat" %>
51
52
<% /* ---------------------- history.jsp start --------------------- */
52
53
{
53
54
final Logger LOGGER = LoggerFactory . getLogger(getClass());
@@ -291,7 +292,7 @@ document.domReady.push(function() {domReadyHistory();});
291
292
if (entry. isActive()) {
292
293
StringBuffer urlBuffer = new StringBuffer (context + Prefix . HIST_L + uriEncodedName);
293
294
if (request. getQueryString() != null ) {
294
- urlBuffer. append(' ?' ). append(request. getQueryString());
295
+ urlBuffer. append(' ?' ). append(Laundromat . launderPaginationQueryString( request. getQueryString() ));
295
296
}
296
297
urlBuffer. append(' #' ). append(Util . uriEncode(rev));
297
298
% >
You can’t perform that action at this time.
0 commit comments