Skip to content

ZOOKEEPER-5124 (C client) Chroot path validation fails to isolate namespaces - #2499

Open
apurtell wants to merge 1 commit into
apache:masterfrom
apurtell:ZOOKEEPER-5124
Open

apurtell wants to merge 1 commit into
apache:masterfrom
apurtell:ZOOKEEPER-5124

Conversation

@apurtell

@apurtell apurtell commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

On a chrooted handle, the C client added the chroot to the client path before it validated the path. The check then incorrectly considered the full path, so a path that did not start with "/" would be silently accepted. Also, sub_string removed the chroot from server paths by length only rather than at path component boundaries.

prepend_chroot now returns NULL for a NULL, empty, or relative client path on a chrooted handle. The isValidPath check of the caller then returns ZBADARGUMENTS, as on a plain handle. sub_string removes the chroot path only on a path component boundary and returns other paths unchanged. Sync config reads now use zoo_awgetconfig with a completion to standardize handling on one path.

New tests in Zookeeper_simpleSystem: testChrootPathValidation, testChrootGetConfig, and testChrootServerPathMapping.

…espaces

On a chrooted handle, the C client added the chroot to the client path
before it validated the path. The check then incorrectly considered the
full path, so a path that did not start with "/" would be silently
accepted. Also, sub_string removed the chroot from server paths by
length only rather than at path component boundaries.

prepend_chroot now returns NULL for a NULL, empty, or relative client
path on a chrooted handle. The isValidPath check of the caller then
returns ZBADARGUMENTS, as on a plain handle. sub_string removes the
chroot path only on a path component boundary and returns other paths
unchanged. Sync config reads now use zoo_awgetconfig with a completion
to standardize handling on one path.

New tests in Zookeeper_simpleSystem: testChrootPathValidation,
testChrootGetConfig, and testChrootServerPathMapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant