Repository navigation
Conversation
tusd v2 silently dropped the entire checksum extension. As a result, any Upload-Checksum header sent on PATCH (or on a POST creation-with-upload) was ignored: the server advertised the checksum extension but never actually validated it, returning 204 on uploads with wrong checksums instead of the required 460 Checksum Mismatch. Three independent gaps had to be closed: 1. pkg/upload/tus_adapter.go — FinishUpload already switched on ChecksumMismatch but mapped it to the internal CS3 code 419 instead of the TUS-spec mandated 460. Fixed to return 460. 2. pkg/upload/tus_adapter.go — added SetChecksum() method to tusAdapter so the PATCH layer can persist the Upload-Checksum header value into the session before tusd processes the chunk. 3. pkg/rhttp/datatx/manager/tus/tus.go — before PatchFile, extract Upload-Checksum, normalise algorithm to lowercase, and call SetChecksum via a local checksumSetter interface. 4. internal/http/services/owncloud/ocdav/tus.go — add Upload-Checksum to the InitiateFileUpload opaque map when present in the POST, so the creation-with-upload path also verifies checksums. Mirrors handlePut. This is a temporary vendor fix pending merge of owncloud/reva#879. Needs backporting to stable-9.0 and stable-8.2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Martin Mattel <github@diemattels.at>
The TUS protocol spec requires the Upload-Checksum header value to be base64-encoded. The TusPhp client (used in acceptance tests) always sends base64. checkHash() was comparing the raw base64 string against hex.EncodeToString(), which never matched, so every upload that sent a checksum received HTTP 460 Checksum Mismatch. Decode from base64 first (using h.Size() to verify the decoded length matches the expected hash size); if decoding succeeds, convert to hex before comparing. Plain hex values fall through unchanged. Upstream fix: owncloud/reva#883 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Martin Mattel <github@diemattels.at>
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
For multi-chunk TUS uploads each PATCH carries the checksum of that chunk only, not the whole-file checksum. Storing a per-chunk checksum for FinishUpload whole-file validation caused every chunked upload with per-chunk checksums to fail with 460 Checksum Mismatch. Restrict SetChecksum() to single-chunk uploads: offset == 0 and Content-Length equals the declared upload size. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Martin Mattel <github@diemattels.at>
|
The Noteworthy: the identical code changes in the master PR #13666 pass Snyk PR-check URL for investigation: If the finding is a false positive or a pre-existing issue already accepted by the team, it can be marked as ignored in the Snyk UI or suppressed via the repo's |
Backport of #13666 to stable-9.0.
Includes both commits:
Upload-Checksumfrom TUS POST into theInitiateFileUploadopaque, store it viaSetChecksumon PATCH, verify onFinishUpload, and correct the HTTP status from 419 → 460checkHash()now decodes the TUS-spec base64 value before comparing against the hex digest (see PR comment on fix(tus): restore Upload-Checksum validation broken by tusd v2 #13666 for root-cause analysis)Upstream reva fixes: owncloud/reva#883 (main), owncloud/reva#884 (stable-9.0)
🤖 Generated with Claude Code