security: fix path traversal vulnerability in sidecar file endpoints
- Replace vulnerable str().startswith() with Path.is_relative_to() for proper path containment validation (fixes prefix collision attacks) - Add missing shutil import for directory deletion - Add protection against deleting the working directory itself - Add unit tests demonstrating the vulnerability and fix Fixes: wipash/K8sInterpreter#5, wipash/K8sInterpreter#7
S
Sean McGrath committed
52a13e8575d1d1a129f2b2c567adfab8337fc659
Parent: 78ac692