Repository navigation
Description
Current ownership after the SDK migration
Registry identifier validation, cache deletion and filesystem containment now belong in StackQL internal/stackql/registry. No new omnisdk blocker is required for these host-owned sinks. Retain the old any-sdk links as historical evidence and test the current StackQL implementation.
Constituent of #769. Reviewed current main at 1de4135 on 2026-10-08; this issue proposes work, no implementation is included.
CWEs: CWE-22, CWE-20.
Finding and evidence
AnalyzeRegistry performs only a type check (internal/stackql/primitivegenerator/statement_analyzer.go). handleRegistryPull clears the provider directory before fetching the archive (internal/stackql/planbuilder/plan_builder.go). any-sdk's ClearProviderCache/RemoveProviderVersion join untrusted components and call os.RemoveAll without containment checks (internal/anysdk/registry.go).
Current parser probe accepted REGISTRY PULL "../../victim" v1 and REGISTRY PULL safe '../../victim'. A direct test of the pinned registry API with a disposable localDocRoot confirmed ClearProviderCache("../../victim") deleted a sibling sentinel directory outside <localDocRoot>/src. No real files were targeted. Backtick examples in the prework do not parse in the current default parser; double-quoted identifiers do.
The MCP and CLI forbidden-character lists omit /, .., and quotes, so they are not path validation.
Required outcome
- Validate provider/version tokens consistently across SQL, CLI and MCP, preserving supported names such as googleapis.com and normal version strings.
- Add independent containment checks at every current StackQL registry filesystem sink, including deletion and provider/version lookup. Cover Windows separators, drive/UNC paths and symlink/junction behavior.
- Reject invalid input before cache eviction or network access. Keep archive-entry containment a separate boundary.
Validation and acceptance
Add temporary-directory unit tests for all path sinks and robot cases through pgwire/CLI/MCP. Assert outside sentinels and existing provider installations survive invalid names and failed pulls. Test quoted identifiers, relative parents, absolute paths and Windows variants.
Scope and related work
#506 concerns an older mock HTTP file-path finding, not this production deletion path. Archive member traversal is a separate issue because safe provider identifiers do not make an archive safe.
Activity