Repository navigation
fix(upload): verify video ownership in complete and resumable - #74
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #46
Summary
HIGH IDOR:
CompleteandGET/PUT resumablein the upload service did not verify ownership — any logged-in user knowing a video UUID could append/overwrite someone else'sraw/{id}/original.mp4and trigger transcoding of their video.Now every write/read path verifies the owner via the metadata internal API before touching storage:
services/upload/internal/handler/ownership.go(new) —OwnershipCheckerinterface +requireOwnershiphelper: foreign id →403, unknown video →404, metadata unavailable →502(fail closed).MetadataClient.GetVideoOwner—GET /internal/videos/{id}withX-Internal-Token(fromINTERNAL_TOKEN),url.PathEscape;INTERNAL_TOKENadded to the upload service env indeploy/docker-compose.yml.Completeadditionally verifies the stored object via newStatObjectInfo: empty object or non-video/*content type →400.Acceptance criteria
completeverifies object size/content-type (empty → 400, non-video → 400)Verification
go test ./...(upload) — pass, including 9 new IDOR tests (foreign complete/resumable GET/PUT → 403 with nothing stored; unknown → 404; metadata down → 502; client 200/404/401 contract)make lint-go— 0 issuesmake test-go— all 9 packages okmake e2e— not run (requires the full Docker stack)Review