feat(BA-6152): track originating client IP on active login_sessions#11755
Draft
jopemachine wants to merge 1 commit into
Draft
feat(BA-6152): track originating client IP on active login_sessions#11755jopemachine wants to merge 1 commit into
jopemachine wants to merge 1 commit into
Conversation
Mirror the BA-5733 client_ip work on the active session table: - Add a nullable `client_ip VARCHAR(45)` column to `login_sessions` via a new Alembic migration chained after BA-5733's history-column migration. - Persist the originating IP on the `login_sessions` row inside `create_login_session`, alongside the existing SUCCESS `login_history` row. - Expose `clientIp` on `LoginSessionV2` (Strawberry) and the v2 REST `LoginSessionNode`. - Add `client_ip` to `LoginSessionFilter` and a `CLIENT_IP` value to `LoginSessionOrderField` (DTO + GQL inputs); wire matching `LoginSessionConditions.by_client_ip_*` + `LoginSessionOrders.client_ip` helpers and update `LoginSessionAdapter`. - Regenerate the supergraph / v2 schema dumps. - Add a unit test under `tests/unit/manager/repositories/auth/` asserting the supplied client_ip lands on the session row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Mirror the BA-5733 client_ip work on the active session table (BA-5733 only added the column to
login_history). With this change, the manager can answer ‘where am I currently logged in from?’ and ‘show me / revoke all active sessions originating from IP X’ without joining against possibly-pruned history rows.client_ip VARCHAR(45)column tologin_sessionsvia a new Alembic migration (c4d2f8b6e9a1) chained after BA-5733'sa1b3e7c2d4f5.create_login_sessionalongside the existing SUCCESSlogin_historyrow, using the sameclient_ipargument the service already threads in.clientIponLoginSessionV2(Strawberry) and the v2 RESTLoginSessionNode.client_iptoLoginSessionFilterand aCLIENT_IPvalue toLoginSessionOrderField(DTO + GraphQL inputs), with matchingLoginSessionConditions.by_client_ip_*+LoginSessionOrders.client_iphelpers and adapter wiring.tests/unit/manager/repositories/auth/confirming the suppliedclient_iplands on the session row (and falls back to NULL when not provided).Resolves BA-6152.
Stack
Stacked on top of #11733 (BA-5733 — client_ip on
login_history). This PR's base branch is `feat/BA-5733-login-history-client-ip`; rebase onto `main` once #11733 merges.Test plan
🤖 Generated with Claude Code