Skip to content

HBASE-30578 Fix null-user ACL failures on master HBCK and Operation Details pages - #8936

Open
jackMintao wants to merge 1 commit into
apache:branch-2.6from
jackMintao:HBASE-30578
Open

jackMintao wants to merge 1 commit into
apache:branch-2.6from
jackMintao:HBASE-30578

Conversation

@jackMintao

Copy link
Copy Markdown

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.

…etails pages

The master web UI JSPs invoke MasterRpcServices in-process through the
short-circuit connection. Such calls have no RpcServer request user, so
with hbase.security.authorization=true RSRpcServices.requirePermission sees
a null user and denies the request:

  Insufficient permissions for user 'null' (global, action=ADMIN)

This makes /hbck.jsp show errors for runHbckChore/runCatalogScan and makes
/operationDetails.jsp return HTTP 500 for getLogEntries.

Fix the two pages locally instead of widening RSRpcServices.requirePermission
for every in-process ADMIN RPC:

- operationDetails.jsp reads BalancerDecision/BalancerRejection directly from
  master.getNamedQueueRecorder(), like 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 arbitrary or
  read-only UI visitors from triggering writes/metadata GC via a GET.

RSRpcServices#requirePermission is deliberately unchanged so remote and
in-process ADMIN RPC authorization is not broadened.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants