You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
P1 auth: require type=access in /me (refresh token must not be an identity) #76
Пункт про lowercase-миграцию users.email снят: dev-стенд и данные удалены (compose down -v), регистронезависимость (#49) работает на пустой БД без миграций.
Осталось (Low): decode_token требует exp/sub, но не type — GET /api/v1/auth/me примет 7-дневный refresh-токен как access-идентичность. Фикс: в /me проверять payload.get("type") == "access" (в Go-мидлварях уже сделано в #53).
Verify:/me с refresh-токеном → 401; с access-токеном → 200.
changed the title [-]P1 auth: lowercase migration for existing users.email and type check in /me[/-][+]P1 auth: require type=access in /me (refresh token must not be an identity)[/+]on Sep 18, 2026
None. Independent reviewer examined origin/main..8a5c619, both full source files, and re-ran checks. Confirmed: type-check placed after signature/exp validation and before sub/UUID parsing/DB query (services/auth/src/routers/auth.py:112); forged type claims fail signature verification; tokens without type fail closed (secure default, consistent with Go middleware from P1 infra: fail fast on empty JWT_SECRET/INTERNAL_TOKEN and require exp in JWT #53); decode_token has no other unchecked callers (/refresh already type-checks).
Verdict
ready for PR
Verification
uv run pytest tests/test_auth.py -v — 19 passed (incl. new test_me_with_refresh_token_rejected: refresh → 401, DB never hit; existing test_me_success: access → 200)
uv run flake8 src tests — clean; uv run mypy src — clean
black --check on tests/test_auth.py fails on pre-existing long lines already present on origin/main (not introduced by this change)
Activity
[-]P1 auth: lowercase migration for existing users.email and type check in /me[/-][+]P1 auth: require type=access in /me (refresh token must not be an identity)[/+]SlavaKuntsov commentedon Sep 29, 2026
Agent review — iteration 1
Findings
origin/main..8a5c619, both full source files, and re-ran checks. Confirmed: type-check placed after signature/exp validation and beforesub/UUID parsing/DB query (services/auth/src/routers/auth.py:112); forgedtypeclaims fail signature verification; tokens withouttypefail closed (secure default, consistent with Go middleware from P1 infra: fail fast on empty JWT_SECRET/INTERNAL_TOKEN and require exp in JWT #53);decode_tokenhas no other unchecked callers (/refreshalready type-checks).Verdict
ready for PR
Verification
uv run pytest tests/test_auth.py -v— 19 passed (incl. newtest_me_with_refresh_token_rejected: refresh → 401, DB never hit; existingtest_me_success: access → 200)uv run flake8 src tests— clean;uv run mypy src— cleanblack --checkontests/test_auth.pyfails on pre-existing long lines already present onorigin/main(not introduced by this change)SlavaKuntsov commentedon Sep 29, 2026
Ready for review
Implemented
GET /api/v1/auth/menow requirespayload.get("type") == "access"afterdecode_token— a refresh token gets 401 before any DB access (mirrors Go middleware from P1 infra: fail fast on empty JWT_SECRET/INTERNAL_TOKEN and require exp in JWT #53 and the existing/refreshtype check)test_me_with_refresh_token_rejected: refresh token → 401,db.executenever awaitedAcceptance criteria
/meс refresh-токеном → 401 (identity не утекает, запрос к БД не выполняется)/meс access-токеном → 200 (test_me_success)Verification
uv run pytest tests/test_auth.py -v— 19 passeduv run flake8 src tests/uv run mypy src— cleanmake e2e— not run: change is covered by unit tests at the token-parsing boundary; no end-to-end auth flow changeReview cycle
Suggested PR title
fix(auth): require type=access in /meSlavaKuntsov commentedon Sep 29, 2026
Pull request opened
#81 — will auto-close via
Closes #76on merge.Project status:
Review(synced after PR creation).Verification
uv run pytest tests/test_auth.py -v— 19 passeduv run flake8 src tests/uv run mypy src— cleanRemaining risks
None (
make e2eне гонялся — e2e-флоу auth не менялся, изменение покрыто юнит-тестами).test(auth): pass jti to create_refresh_token in issue #76 test