Skip to content

fix: safely handle Content-Disposition download filenames - #237

Open
ryanduguid wants to merge 1 commit into
XeroAPI:masterfrom
ryanduguid:audit/safe-content-disposition-filenames
Open

fix: safely handle Content-Disposition download filenames#237
ryanduguid wants to merge 1 commit into
XeroAPI:masterfrom
ryanduguid:audit/safe-content-disposition-filenames

Conversation

@ryanduguid

Copy link
Copy Markdown

Summary

  • safely handle Content-Disposition headers with no filename parameter
  • constrain a response-provided filename to the configured temporary directory
  • add regression coverage for traversal, normal attachment names, and inline responses

This SDK contains generated client code. The same hardening should also be carried into Xero's customized Python API-client template before the next regeneration.

Validation

  • python -m pytest -p no:cacheprovider -q tests/test_api_client/test_file_download.py
  • python -m flake8 tests/test_api_client/test_file_download.py

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