Repository navigation
fix(metadata): enforce visibility filter in list and get - #72
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 #44
Summary
P0 security hotfix (phase:16): private video UUIDs leaked through the public metadata feed and direct-ID reads, closing the CRITICAL data-plane bypass chain.
Listnow filtersWHERE visibility='public' OR owner_id=$viewer— anonymous users and other users no longer see private/unlisted video IDs; owners see their own videos.Getreturns 403 for a private video under a non-owner (and anonymous); unlisted stays reachable by direct link. Internal endpoints (/internal/videos/{id}, VOD mapping) are unchanged for transcoder/gateway HLSAuth.X-User-IDheader: metadata got its ownOptionalAuthmiddleware (the metadata port is published on0.0.0.0, so a header-based design was forgeable). Refresh tokens are rejected (type: accesscheck, same as mandatory auth).OptionalAuth— client-suppliedX-User-IDis stripped, a valid Bearer is forwarded, an invalid/expired token degrades to anonymous (public feed no longer 401s on a stale frontend token).Getdocuments 403).Acceptance criteria (issue #44)
Verification
make lint-go— 0 issues (metadata, gateway, upload)make test-go— all pass; new regression tests:TestListVisibilityFilter,TestGetVisibility(incl. forged-X-User-ID and refresh-token cases), gatewayTestOptionalAuth*×4make swagger— metadata docs regeneratedmake e2e— not run in this session (docker stack not started)Review cycle
Independent review + re-review (2 iterations). Fixed during review: forgeable
X-User-IDtrust boundary (→ metadata-side JWT), missingOptionalAuthtests, 401 regression for expired tokens on public reads, refresh-token-as-identity.Remaining risks
/internal/*metadata endpoints are open whenINTERNAL_TOKENis empty.