Atul Singh Gautam created ZOOKEEPER-5128:
--------------------------------------------

             Summary: Make PERSISTENT_RECURSIVE watch delivery optionally 
require READ on its own registration root
                 Key: ZOOKEEPER-5128
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5128
             Project: ZooKeeper
          Issue Type: Improvement
            Reporter: Atul Singh Gautam


Following up on a report sent to [email protected]: OpCode.addWatch 
registers a watch (including PERSISTENT_RECURSIVE) with no READ-ACL check at 
all, unlike exists/getData/getChildren. Event delivery re-checks READ, but only 
against the changed node's own ACL, never against the ancestor path a recursive 
watch was registered on. Since ZooKeeper ACLs are per-node and not inherited, a 
child can have a strictly more permissive ACL than its parent, so a client with 
zero READ on a restricted subtree can register a recursive watch on it and 
learn new descendants' names as soon as a more permissively-ACL'd descendant 
changes, bypassing the parent-READ requirement getChildren() enforces for that 
same discovery.

The security team's review confirmed the mechanism but didn't treat it as a 
vulnerability: ACLs are documented as per-node and non-recursive (no "traverse" 
permission), the only information disclosed is a name/path for a node the 
watcher is already independently permitted to READ, and this is the known, 
deliberately-scoped edge of CVE-2024-23944/ZOOKEEPER-4799's delivery-time 
filter. They invited a public issue/PR describing it in ACL-semantics terms as 
an opt-in hardening improvement.

This is intentionally opt-in, default off. PersistentWatcherACLTest's own 
"truth table" has a named round (roundNothingForAAsItSDeniedBChangesSeen) that 
explicitly specifies today's behavior as correct: a recursive watch on a denied 
parent still sees a child's NodeCreated event when the child's own ACL is more 
permissive. That's deliberate, specified, tested behavior, not an oversight, so 
this change does not alter it by default. It adds a new knob for operators who 
want the stricter semantics, with zero effect on existing deployments or tests.

What changed (see PR for full detail): new system property 
zookeeper.recursiveWatch.requireAncestorRead 
(DataTree.REQUIRE_RECURSIVE_WATCH_ANCESTOR_READ), default false. When enabled, 
delivery-time ACL resolution walks the registration root's current ACL (not 
registration-time, so a later setACL is honored immediately) via a new 
IWatchManager#setPathAclLookup hook, enforced through the existing checkACL 
call sites in NIOServerCnxn/NettyServerCnxn via a new ServerWatcher#process 
overload, so auth-provider/super-user semantics stay centralized. A 
registration root that no longer exists by delivery time fails closed. 
WatchManagerOptimized is untouched (out of scope, doesn't support 
WatcherMode-aware recursive watches).

A registration-time check was considered and rejected: SetWatches2 re-registers 
persistent/recursive watches on reconnect with no ACL check either, so 
registration-time-only would be bypassed on reconnect, and can't account for a 
setACL that changes the root's ACL after registration.

PR: https://github.com/apache/zookeeper/pull/2502

Release Note (end-user facing):

Adds an opt-in system property, zookeeper.recursiveWatch.requireAncestorRead 
(default false), which, when set to true, requires a client to hold READ on a 
PERSISTENT_RECURSIVE watch's own registration root in order to receive events 
from it, re-checked live at delivery time. Default behavior is unchanged; this 
is for operators who want stricter semantics than the documented per-node ACL 
model provides by default.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to