Skip to content

Commit

Permalink
/admin/tool must return 404 #10861 (#10867)
Browse files Browse the repository at this point in the history
  • Loading branch information
anatol-sialitski authored Jan 20, 2025
1 parent f0c8b76 commit 2b56c4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected WebResponse doHandle( final WebRequest webRequest, final WebResponse w
throws Exception
{
final String rawPath = webRequest.getRawPath();
if ( !( rawPath.equals( "/admin" ) || rawPath.equals( "/admin/" ) ) && !TOOL_CXT_PATTERN.matcher( rawPath ).find() )
if ( !rawPath.equals( "/admin" ) && !TOOL_CXT_PATTERN.matcher( rawPath ).find() )
{
throw WebException.notFound( "Invalid admin tool mount" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ void testInvalidAdminToolMount()
ex = assertThrows( WebException.class, () -> this.handler.doHandle( this.portalRequest, this.webResponse, this.chain ) );
assertEquals( HttpStatus.NOT_FOUND, ex.getStatus() );
assertEquals( "Invalid admin tool mount", ex.getMessage() );

this.portalRequest.setRawPath( "/admin/" );
ex = assertThrows( WebException.class, () -> this.handler.doHandle( this.portalRequest, this.webResponse, this.chain ) );
assertEquals( HttpStatus.NOT_FOUND, ex.getStatus() );
assertEquals( "Invalid admin tool mount", ex.getMessage() );
}

private void mockDescriptor( DescriptorKey descriptorKey, boolean hasAccess )
Expand Down

0 comments on commit 2b56c4e

Please sign in to comment.