jira/apps/api/plane
sriram veeraghanta aea66f53f4
fix: sanitize filenames in upload paths to prevent path traversal (#8879)
* fix: sanitize filenames in upload paths to prevent path traversal (GHSA-v57h-5999-w7xp)

Add server-side filename sanitization across all file upload endpoints
to prevent path traversal sequences (../) in user-supplied filenames
from being incorporated into S3 object keys. While S3 keys are flat
strings and not vulnerable to filesystem traversal, this adds
defense-in-depth and prevents S3 key pollution.

Changes:
- Add sanitize_filename() utility in path_validator.py
- Sanitize filenames in get_upload_path() for FileAsset and IssueAttachment models
- Sanitize name parameter in all upload view endpoints

* fix: address PR review feedback on filename sanitization

- Remove unused `import re`
- Normalize backslashes to forward slashes before os.path.basename()
  so Windows-style paths (e.g. ..\..\..\evil.txt) are handled on POSIX
- Strip whitespace before removing leading dots so " .env" is caught
- Return None instead of "unnamed" for empty input so existing
  `if not name` validation guards remain effective
- Add `or "unnamed"` fallback at call sites that lack a name guard

* fix: use random hex name as fallback in get_upload_path instead of "unnamed"

* fix: resolve ruff E501 line too long in DuplicateAssetEndpoint
2026-04-20 15:33:30 +05:30
..
analytics chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
api fix: sanitize filenames in upload paths to prevent path traversal (#8879) 2026-04-20 15:33:30 +05:30
app fix: sanitize filenames in upload paths to prevent path traversal (#8879) 2026-04-20 15:33:30 +05:30
authentication [WEB-5225] feat: enhance authentication logging with detailed error and info message (#7998) 2026-03-03 19:35:34 +05:30
bgtasks fix: replace IS_SELF_MANAGED with WEBHOOK_ALLOWED_IPS allowlist (#8884) 2026-04-20 15:28:33 +05:30
db fix: sanitize filenames in upload paths to prevent path traversal (#8879) 2026-04-20 15:33:30 +05:30
license chore: remove Intercom integration and chat support components (#8875) 2026-04-10 00:16:45 +05:30
middleware chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
seeds/data [WEB-5602] feat: new design system (#8220) 2025-12-12 20:50:14 +05:30
settings fix: replace IS_SELF_MANAGED with WEBHOOK_ALLOWED_IPS allowlist (#8884) 2026-04-20 15:28:33 +05:30
space fix: sanitize filenames in upload paths to prevent path traversal (#8879) 2026-04-20 15:33:30 +05:30
static [WEB-6420] chore: self-host social icons in project invitation email (#8718) 2026-03-05 18:17:42 +05:30
tests fix: replace IS_SELF_MANAGED with WEBHOOK_ALLOWED_IPS allowlist (#8884) 2026-04-20 15:28:33 +05:30
throttles chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
utils fix: sanitize filenames in upload paths to prevent path traversal (#8879) 2026-04-20 15:33:30 +05:30
web chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
__init__.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
asgi.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
celery.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
urls.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
wsgi.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30