Skip to content

Commit

Permalink
HBASE-27792 Guard Master/RS Dump Servlet behind admin walls (#5176)
Browse files Browse the repository at this point in the history
  • Loading branch information
NihalJain authored and chrajeshbabu committed Apr 28, 2023
1 parent 0fb5053 commit adfcea8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ServerMetrics;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.http.HttpServer;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.ServerManager;
import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
Expand All @@ -46,6 +47,9 @@ public class MasterDumpServlet extends StateDumpServlet {

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) {
return;
}
HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
assert master != null : "No Master in context!";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.http.HttpServer;
import org.apache.hadoop.hbase.ipc.CallQueueInfo;
import org.apache.hadoop.hbase.monitoring.StateDumpServlet;
import org.apache.hadoop.hbase.monitoring.TaskMonitor;
Expand All @@ -42,6 +43,9 @@ public class RSDumpServlet extends StateDumpServlet {

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(), request, response)) {
return;
}
HRegionServer hrs =
(HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
assert hrs != null : "No RS in context!";
Expand Down

0 comments on commit adfcea8

Please sign in to comment.