Skip to content

fix: replace blocklist with allowlist for install_packages() package validation#403

Merged
padmak30 merged 1 commit intomainfrom
fix/install_package_validation
Apr 10, 2026
Merged

fix: replace blocklist with allowlist for install_packages() package validation#403
padmak30 merged 1 commit intomainfrom
fix/install_package_validation

Conversation

@padmak30
Copy link
Copy Markdown
Contributor

fix: replace blocklist with allowlist for install_packages() package validation

The previous character blocklist (;, &, |, `, $) could be bypassed by passing pip flags like -r or --index-url as separate list elements, which contained none of the blocked characters but still reached the shell command string. Replace it with a regex allowlist (VALID_PACKAGE_NAME) that only accepts strings matching valid PyPI package name syntax, blocking all flag and path injection vectors at the input boundary. Add TestInstallPackagesAllowlist covering pip flags, shell metacharacters, path traversal, newline splitting, and valid package specs.

@padmak30 padmak30 requested a review from a team April 10, 2026 11:22
@github-actions
Copy link
Copy Markdown
Contributor

✅ No Breaking Changes Detected

No public API breaking changes found in this PR.

@padmak30 padmak30 merged commit ed953b5 into main Apr 10, 2026
33 checks passed
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.

3 participants