Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 22:15 UTC
test(security): add SEC-316 edge cases (subdir-traversal, empty name)
Two regression tests for `FileDownloadable.download()`: - `test_basename_collapse_through_subdir_is_rejected`: `name="foo/.."` exercises the case where `Path(name).name` collapses to `..`. The plain `name=".."` test already covers the same `is_relative_to()` rejection, but the through-subdir form makes the basename normalization explicit. Also asserts (per the P3.1 reorder) that `outdir` is not created as a side effect of a rejected payload. - `test_empty_name_safe_fails_at_write_time`: `name=""` makes `outfile == outdir`, which passes the containment check (a path is relative to itself). The download then safe-fails at `outfile.open("wb")` with `IsADirectoryError`. Pinning this documented behavior locks in the safe-fail and stops a future change from silently weakening the check without a test failure.