feat(backlog): presign resumable fallback, login rate-limit and e2e private HLS - #42
Merged
Merged
Conversation
Issue #19: redis in compose, slowapi limiter on POST /api/v1/auth/login returns 429 after 5 req/min per IP. Falls back to memory when redis unreachable (local pytest). Adds REDIS_URL to .env.example and compose.
Issue #20: GET/PUT /api/v1/videos/{id}/resumable handles Content-Range bytes start-end/total, validates offset via StatObjectSize and appends via Get+Put. Gateway proxies resumable endpoints, frontend adds getResumableOffset/uploadResumable with automatic fallback in uploadVideo on presigned PUT failure (50% resume test).
…panic
chi wildcard * must be last segment; keep only {id} param route. Fixes panic at main.go:123.
…SigV4 Previously rewrote host after signing which broke X-Amz-Signature (host is signed header). Now creates tmp minio client with public host (localhost:9000) and Region us-east-1 to generate correct signature. Also stores accessKey/secretKey in MinioClient for reuse. Fixes e2e presign 403 SignatureDoesNotMatch and 500 dial tcp connection refused (tmp client now uses BucketLookupPath and Region to avoid bucket location fetch).
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 #19
Closes #20
Closes #21
Summary
Backlog phase — 3 issues: brute-force protection for login, Content-Range resumable fallback for presigned upload, and e2e coverage for presign + private HLS.
services/auth/src/core/limiter.py:1— slowapi 5/min/IP onPOST /api/v1/auth/loginwith redis (redis:7-alpinein compose) fallback to memory; 429 after limit (services/auth/src/routers/auth.py:60,services/auth/src/main.py:11).services/upload/internal/handler/resumable.go:1—GET /api/v1/videos/{id}/resumableoffset +PUT /resumablewithContent-Range: bytes start-end/total(308 until complete, 200 when done, 416 on mismatch) viaStatObjectSize/GetObject/PutObject; gateway proxies/resumable(services/gateway/cmd/server/main.go:121); frontendfrontend/src/lib/api.ts:158addsgetResumableOffset/uploadResumablewith fallback inuploadVideo.scripts/e2e.sh:262— adds steps 8 presignPOST /presign→PUT presigned→POST /complete→poll ready→HLS, 9 privatePATCH visibility private→403 without token→200 with hls-token + Cache-Control private, 10 resumable308→200incl. 50% split resume.services/upload/internal/storage/minio.go:60— generate presigned URL for public host (MINIO_PUBLIC_ENDPOINT) without breaking SigV4 (tmp client Region us-east-1, BucketLookupPath);services/gateway/cmd/server/main.go:121— remove invalid wildcard*/resumablecausing chi panic.Acceptance criteria
curl 6× login →429,uv run pytest12 passedGET /resumable+ secondPUT200make e2ePASSVerification
make lint-go— 0 issuesmake lint-py— black/flake8/mypy passmake lint-front— next lint 0 warningsmake test-go— upload handler 13 passed (incl. 4 resumable)make test-py— auth 12 passed (incl. rate-limit), transcoder 20 passedmake up --build -d && make e2e— PASS (presign 200, private 403→200, resumable 308→200)Remaining risks