-
Notifications
You must be signed in to change notification settings - Fork 155
chore(compile): tighten link_resolver._resolve_path input guards #841
Copy link
Copy link
Closed
Labels
area/content-securityUnicode scanning, Glassworm, apm audit content checks, SARIF output.Unicode scanning, Glassworm, apm audit content checks, SARIF output.good first issueGood for newcomersGood for newcomerspriority/lowAccepted but not time-sensitiveAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/securitySecure by default. Content scanning, lockfile integrity, MCP trust boundaries.Secure by default. Content scanning, lockfile integrity, MCP trust boundaries.type/bugSomething does not work as documented.Something does not work as documented.
Milestone
Metadata
Metadata
Assignees
Labels
area/content-securityUnicode scanning, Glassworm, apm audit content checks, SARIF output.Unicode scanning, Glassworm, apm audit content checks, SARIF output.good first issueGood for newcomersGood for newcomerspriority/lowAccepted but not time-sensitiveAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.Direction approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/securitySecure by default. Content scanning, lockfile integrity, MCP trust boundaries.Secure by default. Content scanning, lockfile integrity, MCP trust boundaries.type/bugSomething does not work as documented.Something does not work as documented.
Type
Projects
Status
Done
Context
Follow-up to the
link_resolver._resolve_pathcontainment hardening landed in the dogfooding PR (commit79389abonfeat/792-dogfood-apm, closes #695 / #792). Surfaced during the supply-chain-security review of that change -- not exploitable in the current call paths, but worth fixing so we don't regress later.Findings
Minor 1 -- empty-string input returns
base_pathinstead ofNone_resolve_path("")follows thePath(base_dir) / ""branch and returns the base directory. Not exploitable today because every caller does an.exists()check on the returned path, but semantically wrong (an empty link should resolve to nothing).Fix: add an early guard at the top of
_resolve_path:Minor 2 -- whitespace-only input (same class)
_resolve_path(" ")hits the same code path as empty-string. The same guard covers it.Minor 3 -- regression test gaps
Add test cases for:
"")" ")foo\\..\\..\\etc\\passwd)file://URI on POSIXCurrent containment code handles these correctly; tests lock in that behaviour.
Scope
src/apm_cli/compilation/link_resolver.pytests/unit/compilation/test_link_resolver.pyLabels
good first issue,compilation,security-hardening