# REQ-034: LoginRequest 추가 필드 거부 enforcement (session no_expiry 정책 정합) - Status: Implemented - Type: Interface - Priority: Medium - Owner: Justin Ko ## Intent - REQ-021 정책 본문이 "session에서 `no_expiry` 시도 → HTTP 422 또는 ValueError 거부"로 명시하지만, 현재 `LoginRequest` 스키마([app/schemas/auth.py:13-23](../../app/schemas/auth.py#L13-L23))가 Pydantic 기본(`extra="ignore"`)이라 외부에서 `no_expiry: true`를 추가해 보내도 silently 무시된다. - `LoginRequest`에 `extra="forbid"` 적용으로 정책 명문과 코드 동작을 일치시켜 audit 명확성을 확보한다. ## Requirement - `app/schemas/auth.py:LoginRequest`에 `model_config = ConfigDict(extra="forbid")`를 적용한다. - 외부 client가 LoginRequest에 정의되지 않은 필드(`no_expiry` 포함, 기타 임의 필드)를 전송하면 FastAPI/Pydantic이 HTTP 422로 거부한다. - `AuthService.login`([app/services/auth_service.py:47-65](../../app/services/auth_service.py#L47-L65))의 동작은 변경하지 않는다(정책 enforcement는 스키마 단계에서 처리). - 기존 정상 client(username/password 2필드만 전송)는 영향 없음을 회귀 테스트로 확인한다. ## Acceptance Criteria 1. Given valid username/password, When `POST /auth/login` body `{"username": "...", "password": "..."}` 호출, Then HTTP 200 + 정상 TokenResponse 반환(기존 동작 회귀). 2. Given valid username/password + 추가 필드, When `POST /auth/login` body `{"username": "...", "password": "...", "no_expiry": true}` 호출, Then HTTP 422 응답 + Pydantic validation error detail에 `extra_forbidden` 표기. 3. Given valid username/password + 임의 추가 필드, When `POST /auth/login` body `{"username": "...", "password": "...", "arbitrary_field": "x"}` 호출, Then HTTP 422 응답 (extra="forbid" 일반 동작 회귀). 4. Given codebase grep `grep -n "extra.*forbid" app/schemas/auth.py`, When 본 REQ 구현 후, Then `LoginRequest` 정의 부근에 매치된다. 5. Given 본 REQ 구현 후 전체 pytest 회귀, When 실행, Then 기존 통과 케이스 모두 유지. ## Impacted Area - Docs: - (선택) `docs/srs/Documentation/req-021_token-expiry-and-rotation-policy.md` Notes에 "AC-4 enforcement는 REQ-034로 분리 구현" 추가 (cross-reference) - Modules: - `app/schemas/auth.py` — `LoginRequest.model_config = ConfigDict(extra="forbid")` 추가 - Tests: - 신규 `tests/test_auth.py::test_login_rejects_no_expiry_extra_field` — AC-2 검증 - 신규 `tests/test_auth.py::test_login_rejects_arbitrary_extra_field` — AC-3 검증 (또는 AC-2와 단일 케이스로 합침) ## Notes - 본 REQ는 dcy-005 FR-2 산출물. REQ-021 follow-up. - `extra="forbid"`는 `LoginRequest` 전체에 추가 필드 거부 효과. 기존 정상 client는 username/password만 전송하므로 영향 없음. 본 워크스페이스는 개발용이라 외부 monitoring 영향 무. - 본 REQ는 별도 REL-002로 분리 배포(dcy-005 OQ-3 결정, 2026-06-01). - Source: dcy-005 FR-2, REQ-021 AC-5 follow-up. ## Change Log ### CHG-20260601-03 - Date: 2026-06-01 - Author: Justin Ko #### Change Summary - Status: Approved → Implemented #### Intent - BAT-015 confirm-batch-verification 완료(2026-06-05). AC-1~5 모두 PASSED. `LoginRequest` extra="forbid" 적용 + pytest 422 회귀 2건 신규 + 로컬 smoke 422 + extra_forbidden 확인. #### Acceptance Criteria Delta - No change #### Impacted Area Delta - No change #### Delivery Trace Delta - Batches: - BAT-015 (release-candidate) - Releases: - REL-002 (예정) #### Revalidation Impact - Reverification Needed: no - Existing Implementation Invalidated: no - Status Recommendation: implemented - Follow-up Action: none ### CHG-20260601-02 - Date: 2026-06-01 - Author: Justin Ko #### Change Summary - Status: Proposed → Approved #### Intent - 승인 게이트 통과: 필수 필드(Status/Type/Priority/Owner/Intent/Requirement/AC/Impacted Area/Change Log) 모두 충족, AC-1~5 구체성 확인 완료, blocker 없음. #### Acceptance Criteria Delta - No change #### Impacted Area Delta - No change #### Delivery Trace Delta - Batches: none (미정) - Releases: none (미정 — REL-002 분리 예정) #### Revalidation Impact - Reverification Needed: no - Existing Implementation Invalidated: no - Status Recommendation: promote-to-approved - Follow-up Action: batch 계획 편입 (BAT-015 후보) ### CHG-20260601-01 - Date: 2026-06-01 - Author: Justin Ko #### Change Summary - 최초 생성 — dcy-005 confirm-discovery 후 draft-req 실행. dcy-005 FR-2 산출물. #### Intent - REQ-021 정책 본문과 LoginRequest 코드 동작 일치 (session no_expiry 거부 enforcement). #### Acceptance Criteria Delta - Added: - AC-1~5 최초 작성 #### Impacted Area Delta - Docs: (선택) docs/srs/Documentation/req-021_*.md cross-reference — 최초 지정 - Modules: app/schemas/auth.py — 최초 지정 - Tests: tests/test_auth.py — 최초 지정 #### Delivery Trace Delta - Batches: none (미정) - Releases: none (미정 — REL-002 분리 예정) #### Revalidation Impact - Reverification Needed: no - Existing Implementation Invalidated: no - Status Recommendation: keep-current - Follow-up Action: confirm-req 후 batch 계획 편입 #### Validation Plan - pytest TestClient로 AC-1~3 검증; grep으로 AC-4 검증