fix: post-Phase-0 corrections — data-dir bind mounts, reserved subdomains, list_active()
Unit Tests / test (push) Successful in 11m31s
Unit Tests / test (push) Successful in 11m31s
Three related fixes discovered during review of Phase 0 and Phase 1 manifests:
1. validate_rendered_compose(): add allowed_data_dir param. After ${PIC_DATA_DIR}
substitution, compose templates produce absolute paths; without this the
validator would reject every service install. ServiceComposer.write_compose()
now passes its resolved data_dir so only the designated data directory is
exempt — /etc, /proc, docker.sock etc. still blocked.
2. _RESERVED_SUBDOMAINS: remove service-level subdomains (mail, calendar, files,
webdav, webmail). The reserved list should protect PIC infrastructure endpoints
(api, webui, admin) — not service subdomains that official store services
(calendar, files, webmail) must be allowed to claim. Aligns with the
existing _RESERVED_SUBS in service_registry.py.
3. ServiceRegistry.list_active(): new method returning only installed store
services (no builtins). This is the forward-looking API that Phase 2 will
make the primary read path once builtins are deleted. Adding it now unblocks
the QA agent's test_optional_services_feature.py which was already testing
the expected Phase 2 behaviour.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -156,7 +156,11 @@ class ServiceComposer:
|
||||
content = self.render_template(service_id, manifest, template_content)
|
||||
|
||||
# Validate before any file I/O so a bad template never touches disk.
|
||||
ok, errs = validate_rendered_compose(content)
|
||||
# Pass the resolved data_dir so that bind mounts created by ${PIC_DATA_DIR}
|
||||
# substitution are allowed; all other absolute paths are still rejected.
|
||||
ok, errs = validate_rendered_compose(
|
||||
content, allowed_data_dir=str(Path(self.data_dir).resolve())
|
||||
)
|
||||
if not ok:
|
||||
raise ValueError(
|
||||
f'Compose template failed security validation: {"; ".join(errs)}'
|
||||
|
||||
Reference in New Issue
Block a user