Skip to content

feat(auth): log wallet name on every login#3851

Open
joshuakrueger-dfx wants to merge 1 commit into
developfrom
feat/log-wallet-name-on-login
Open

feat(auth): log wallet name on every login#3851
joshuakrueger-dfx wants to merge 1 commit into
developfrom
feat/log-wallet-name-on-login

Conversation

@joshuakrueger-dfx

Copy link
Copy Markdown
Collaborator

Implements the backend part of #3849.

What

Persists the wallet name a login originated from in the per-login audit trail (IpLog).

  • IpLog.walletName — new nullable column (migration AddWalletNameToIpLog)
  • IpLogService.create/doCreate — new walletName param, included in the dedup cache key and the persisted row
  • IpCountryGuard — forwards req.body.wallet for signature logins (POST /v1/auth); RealUnit already sends wallet: 'RealUnit', so this now gets logged
  • Mail loginsignInByMail stores the resolved login wallet name on the pending-login entry; completeSignInByMail passes it to IpLogService.create

Complements the mail-branding fix #3846: branding follows the login source, and now the source wallet is also recorded per login.

Scope notes

  • Migration is a new file only (no existing migration touched).
  • Frontend: no change required for current apps — app.dfx.swiss already forwards the wallet URL param (absent → backend defaults to DFX), and the RealUnit app (Flutter) has no email login and already sends wallet: 'RealUnit' on signature auth. Optionally, app.dfx.swiss could send an explicit DFX wallet name to tag its own email logins in IpLog — open question for review.

Verification

Local: lint, format:check (src), build, full test suite (1018 passed) — all green.

Adds a walletName column to IpLog and threads the login-request wallet
through to the per-login audit trail:
- IpCountryGuard forwards req.body.wallet for signature logins
- mail login persists the resolved login wallet name and passes it on
  completion

Captures which app/wallet a login originated from, complementing the
mail-branding fix (#3846). Refs #3849.

@davidleomay davidleomay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidleomay davidleomay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wallet field on SignInDto/SignUpDto/AuthMailDto should get a @Transform(Util.sanitize) decorator, consistent with how other string fields are handled in the codebase (e.g. auth-lnurl.dto.ts). Strips HTML, trims whitespace — no perf hit, no extra DB lookup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants