fix: harden JSON parsing and path handling in PAM extend#1891
fix: harden JSON parsing and path handling in PAM extend#1891jlima8900 wants to merge 1 commit intoKeeper-Security:releasefrom
Conversation
- Strip NUL bytes from folder paths before placeholder substitution to prevent path segment manipulation via crafted JSON input - Replace bare except on JSON parse with specific handlers for JSONDecodeError (shows parse error) and PermissionError/OSError - Canonicalize import file path with os.path.realpath() to resolve symlinks before opening
|
Suggestions to consider: If there's a defined "safe directory" for import files (not sure if there is, but that would be a good hardening improvement), add a path confinement check after realpath. |
|
Thanks for the review! Two thoughts: Path confinement: Commander is a CLI tool where users explicitly pass file paths as arguments — adding a safe directory restriction would limit usability since users should be able to point at any path on their filesystem. The
|
Summary
Test plan