Repository navigation
feat(phase-16): security hotfix (CVE, JWT, secrets fail-fast) - #77
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.
Phase 16 — security hotfix (auth hardening, secrets fail-fast)
Закрывает оставшиеся открытые тикеты фазы 16 (родитель #66). Тикеты #43–#47 уже слиты ранее отдельными PR.
Closes #48
Closes #49
Closes #53
Что изменено
#48 — python-jose → PyJWT, passlib → argon2-cffi
services/auth/src/core/security.py: PyJWT 2.14 (HS256,require: ["exp","sub"]),PasswordHasher(argon2-cffi), лимит токена 8 KB до decode (CVE-2024-33664 — JWT-бомба)pyproject.toml,uv.lock,docs/spec.md#49 — password policy, email normalization, IntegrityError
password: Field(min_length=8)в RegisterRequest (login — без политики, не ломаем существующих)IntegrityErrorна commit → rollback + 409 (гонка SELECT-then-INSERT)#53 — fail fast на секретах, обязательный exp/type в JWT, constant-time internal auth
requireEnv— пустыеJWT_SECRET/INTERNAL_TOKENроняют сервис на старте, кромеENV=dev; хардкодchange-me-...убранvalidate_secrets()в lifespan — та же семантика дляJWT_SECRETjwt.WithExpirationRequired()+ строгийtype == "access"во всех мидлварях (gateway Auth/Optional/hls, metadata Auth/Optional, upload Auth)crypto/subtle) в metadataInternalAuth${JWT_SECRET:?}/${INTERNAL_TOKEN:?}—make upбез секретов падает с внятной ошибкойENV=dev;.env.example— предупреждение про prodAcceptance criteria
a@x.com==A@x.com; пароль < 8 → 422 (P1 auth: add password policy, email normalization and IntegrityError handling #49)make upбез секретов падает с внятной ошибкой; токен без exp → 401; INTERNAL_TOKEN не открывает/internal/*молча (P1 infra: fail fast on empty JWT_SECRET/INTERNAL_TOKEN and require exp in JWT #53)Verification
make test-py— 38 passed (18 auth + 20 transcoder)make test-go— pass (metadata/gateway/upload)make lint-py/make lint-go(0 issues) /make lint-front— чистоdocker compose config—:?синтаксис валиден в dev и prod overridemake up && make e2e— PASS на чистых volumes (OrbStack): полный пайплайн, presign, private HLS, resumableReview cycle
/meпринимает refresh-токен — не входит в скоуп P1 infra: fail fast on empty JWT_SECRET/INTERNAL_TOKEN and require exp in JWT #53)