Skip to content

fix(server): reject invalid base64 metadata and tolerate trailing slash - #5

Merged
injaeryou merged 2 commits into
mainfrom
fix/creation-slash-and-metadata
Jul 22, 2026
Merged

fix(server): reject invalid base64 metadata and tolerate trailing slash#5
injaeryou merged 2 commits into
mainfrom
fix/creation-slash-and-metadata

Conversation

@injaeryou

Copy link
Copy Markdown
Owner

Purpose

Two independent creation-endpoint hardening fixes, off current main.

  • Reject non-base64 Upload-Metadata values with 400 (was silently accepted → corrupted stored values)
  • Tolerate a trailing slash on the creation endpoint (/files/ == /files; some proxies/clients append /, POST returned 404)

Test Plan

  • New unit cases on sync + async creation paths (bad base64 → 400, trailing slash → 201)
  • make ci

Test Result

  • pytest -v green; ruff + ty check clean

Checklist
  • PR title follows Conventional Commits (type(scope): ...)
  • pytest -v passes locally
  • ruff check / ruff format --check / ty check resumable_upload clean
  • Tests added for new behavior or regression
  • No new core runtime dependencies (cloud SDKs go in optional extras)
  • If wire/header/status-code behavior changed, TUS_COMPLIANCE.md updated
  • Docs / examples updated if user-facing behavior changed

- POST to base_path matched exactly; '/files/' returned 404
- tusd accepts both; tus-py-client builds URLs with trailing slash
- match base_path and base_path + '/' in sync and async routers
- b64decode without validate=True silently drops non-alphabet chars
- 'filename ####' decoded to '' instead of 400
- pass validate=True so malformed values are rejected
@injaeryou
injaeryou merged commit 74ae10a into main Jul 22, 2026
10 checks passed
@injaeryou
injaeryou deleted the fix/creation-slash-and-metadata branch July 22, 2026 10:20
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