vault provision: canonicalize + enforce allowed-root containment on the jail target #92
Labels
No labels
first-proof blocker
hardening
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: clawdie/colibri#92
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Builds on #91
PR #91 added a registered-vs-spawned jail-root check before vault provisioning, but it's a string-equality compare (
trim_trailing_slash(stored) != trim_trailing_slash(spawned)), not canonicalization. It catches "spawned jail ≠ registered jail," but not:..or a symlink (both sides can be string-equal yet resolve elsewhere)Fix
Before writing the
.env, canonicalize the target (std::fs::canonicalize, resolving symlinks/..) and assert it is contained under the allowed root, e.g. matches/usr/local/bastille/jails/<name>/root. Refuse (warn + skip, fail-soft) otherwise.Pairs with the
UNIQUE(jail_root_path)constraint tracked separately — together they make the root mapping unique and bounded.Acceptance
A tenant whose registered/spawned root contains
.., a symlink, or resolves outside/usr/local/bastille/jails/.../rootis refused — no.envwritten.Security invariant: see docs/HIVE-ONBOARDING.md (layered-soul). Related: #91.
🤖 Generated with Claude Code