jackMintao opened a new pull request, #8936:
URL: https://github.com/apache/hbase/pull/8936

   JIRA: https://issues.apache.org/jira/browse/HBASE-30578
   
   ## Problem
   
   When `hbase.security.authorization=true`, two master Web UI pages fail:
   
   - `/hbck.jsp` (without `?cache=true`) shows
     `Insufficient permissions for user 'null' (global, action=ADMIN)` for both
     `runHbckChore` and `runCatalogScan`, and no new report is generated.
   - `/operationDetails.jsp` returns HTTP 500 with the same
     `AccessDeniedException`.
   
   Both JSPs call master RPC services in-process. `master.getConnection()` is a
   short-circuit connection, so the JSP Jetty thread has no `RpcServer.CurCall`;
   `RSRpcServices.requirePermission` therefore checks a `null` user and denies.
   
   ## Fix
   
   Keep `RSRpcServices.requirePermission` unchanged and fix the two pages at the
   page boundary:
   
   - `operationDetails.jsp` reads `BalancerDecision`/`BalancerRejection` 
directly
     from `master.getNamedQueueRecorder()`, matching `rsOperationDetails.jsp`,
     instead of going through `Admin#getLogEntries ->
     MasterRpcServices#getLogEntries`.
   - `hbck.jsp` only calls `HbckChore#runChore()` and `CatalogJanitor#scan()`
     when `InfoServer.canUserModifyUI()` allows the request. Otherwise it shows
     the cached reports with an informational message. This prevents read-only 
or
     unauthorized UI visitors from triggering writes/metadata GC via a plain 
GET.
   
   A generic fallback in `RSRpcServices.requirePermission` was deliberately not
   used: it would affect every in-process ADMIN-level RPC, not just these pages.
   
   ## Tests
   
   - `TestInfoServers#testHbckAndOperationDetailsReadOnly`:
     read-only mode shows the informational message and `No Report created.`
     (proves `runChore` was skipped), no error/ACL alert;
     `/operationDetails.jsp` renders.
   - `TestInfoServersACL#testHbckPagePermissions`:
     with `hbase.security.authorization=true` (MiniKdc/SPNEGO), the admin gets 
no
     read-only message, no error alert, no ACL error and a generated report; the
     non-admin gets the read-only/cached-report message; the admin
     `/operationDetails.jsp` returns HTTP 200 and `Operations Details` without
     ACL errors. Before this fix it returned HTTP 500 in this environment.
   - JspC precompilation: 0 errors. `mvn test-compile`: `BUILD SUCCESS`.
   - Manual verification on HBase 2.6.8-SNAPSHOT / Hadoop 3.4.3 / ACL:
     before, hbck had the two ACL errors and operationDetails was HTTP 500;
     after, both pages are HTTP 200 with no ACL errors, read-only requests do 
not
     change the CatalogJanitor report time, the authorized test path generates
     reports, and a remote non-superuser is still denied for
     `catalogjanitor_run`/`get_balancer_decisions`.
   
   ## Behavior note
   
   `InfoServer.canUserModifyUI()` requires `hbase.master.ui.readonly=false`,
   Kerberos UI authentication, `hadoop.security.authorization=true`, and a UI
   administrator. In simple-auth clusters `/hbck.jsp` no longer auto-triggers
   chores; it shows cached reports and points admins to `hbck_chore_run` /
   `catalogjanitor_run`. This matches the existing `table.jsp`/`snapshot.jsp`
   read-only behavior and avoids unauthenticated GET-triggered writes.
   
   `RSRpcServices` is untouched; remote RPC ACL behavior is unchanged.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to