Skip to content

fix(security): sanitize version string to prevent path traversal [DEVA11Y-480]#20

Open
sunny-se wants to merge 1 commit into
mainfrom
fix/DEVA11Y-480-sanitize-version-string
Open

fix(security): sanitize version string to prevent path traversal [DEVA11Y-480]#20
sunny-se wants to merge 1 commit into
mainfrom
fix/DEVA11Y-480-sanitize-version-string

Conversation

@sunny-se
Copy link
Copy Markdown
Collaborator

@sunny-se sunny-se commented May 26, 2026

Summary

  • CWE-22 / CVSS 7.5 (High)extractVersion() did not validate the version string parsed from HTTP redirect filenames. A malicious server could craft a filename with ../ traversal segments, causing cache writes outside the intended directory.
  • Added a character allowlist (alphanumeric, ., -, +) and explicit .. rejection so only valid semver-like strings are accepted.
  • Version strings containing path separators, traversal sequences, or any non-semver characters now return nil.

Verification

  • A version string like 1.2.3 passes validation and is returned.
  • A version string like ../../etc/passwd is rejected (contains / and ..).
  • A version string like 1.2..3 is rejected (contains ..).
  • An empty version string returns nil.

Jira

DEVA11Y-480

🤖 Generated with Claude Code

F-010 / DEVA11Y-480 — extractVersion() did not validate the version
string parsed from HTTP redirect filenames (CWE-22). A crafted
filename with ../ segments could write outside the cache directory.
Add character allowlist and reject traversal sequences.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sunny-se sunny-se requested a review from a team as a code owner May 26, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant