…ypass (opensearch-project#22328)
The fs repository base_path setting was read verbatim from REST input with
no validation. An absolute base_path causes Path.resolve to discard the
path.repo-validated location, redirecting all blob-store operations outside
the repository (CWE-22) and enabling arbitrary filesystem deletion via the
snapshot _cleanup API.
Add two layers of defense:
- BASE_PATH_SETTING validator rejects absolute and upward-escaping (..) values
after normalization (benign interior '..' that cancels out is allowed).
- validateBasePathWithinRepo() resolves base_path against the location and
verifies the result stays within a configured path.repo directory.
Signed-off-by: Aditya Khera <kheraadi@amazon.com>
Co-authored-by: Aditya Khera <kheraadi@amazon.com>
(cherry picked from commit 629a185)
Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
Backport 629a185 from #22328.