Skip to content

Commit

Permalink
HBASE-23663 Allow dot and hyphen in Profiler's URL (#1002)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
  • Loading branch information
petersomogyi committed Jan 9, 2020
1 parent fbf660c commit 54af279
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class ProfileOutputServlet extends DefaultServlet {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory.getLogger(ProfileOutputServlet.class);
private static final int REFRESH_PERIOD = 2;
// Alphanumeric characters, plus percent (url-encoding), equals, and ampersand
private static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9\\%\\=\\&]*");
// Alphanumeric characters, plus percent (url-encoding), equals, ampersand, dot and hyphen
private static final Pattern ALPHA_NUMERIC = Pattern.compile("[a-zA-Z0-9%=&.\\-]*");

@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class TestProfileOutputServlet {

@Test
public void testSanitization() {
List<String> good = Arrays.asList("abcd", "key=value", "key1=value&key2=value2", "");
List<String> good = Arrays.asList("abcd", "key=value", "key1=value&key2=value2", "",
"host=host-1.example.com");
for (String input : good) {
assertEquals(input, ProfileOutputServlet.sanitize(input));
}
Expand Down

0 comments on commit 54af279

Please sign in to comment.