Class TestAccessControllerObserverCoverage
java.lang.Object
org.apache.hadoop.hbase.security.access.TestAccessControllerObserverCoverage
@Tag("org.apache.hadoop.hbase.testclassification.SecurityTests") @Tag("org.apache.hadoop.hbase.testclassification.SmallTests")
public class TestAccessControllerObserverCoverage
extends Object
Verifies that AccessController implements every security-relevant method declared in the five
observer interfaces it claims to implement: MasterObserver, RegionObserver, RegionServerObserver,
EndpointObserver, BulkLoadObserver.
If a new hook is added to any of these interfaces and AccessController does not override it, the default no-op implementation will silently skip the permission check — a potential privilege escalation. This test catches that at build time.
Skipped methods are determined by two mechanisms:
- Pattern rules — methods matching these patterns are always safe to skip:
post*— post-operation notifications; the operation has already been authorized and executed.pre*Action— procedure-level action hooks; authorization happens at the RPC layer in the correspondingpre*hook.
- Explicit whitelist — methods that don't match the above rules but are still safe to skip (internal lifecycle hooks, deprecated overloads with default delegation, read-only queries). Each entry has a justification comment.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Class<?>[]Explicit whitelist for methods that don't match the pattern rules but are intentionally not overridden in AccessController. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Stringprivate static booleanisMethodImplemented(Class<?> implClass, Method ifaceMethod) private static booleanmatchesSkipPattern(Class<?> iface, Method m) Returns true if the method matches a pattern rule that makes it safe to skip without an explicit whitelist entry.private static Stringvoid
-
Field Details
-
WHITELIST
Explicit whitelist for methods that don't match the pattern rules but are intentionally not overridden in AccessController.Use simple method name (covers all overloads) or full signature key "methodName(ParamType1,ParamType2,..." using simple class names.
-
OBSERVER_INTERFACES
-
-
Constructor Details
-
TestAccessControllerObserverCoverage
public TestAccessControllerObserverCoverage()
-
-
Method Details
-
matchesSkipPattern
Returns true if the method matches a pattern rule that makes it safe to skip without an explicit whitelist entry. -
methodSignatureKey
-
fullMethodSignatureKey
-
isMethodImplemented
-
testAllObserverMethodsAreImplemented
-