Repository navigation
feat: resolve issues #1260 #1261 #1262 #1264 — DB constraints, Stellar timeouts, audit logging, wallet auth UX - #1578
Merged
mimijuwonlo-commits merged 1 commit intoOct 22, 2026
Conversation
Split-Naira#1264 (Mirabel64) Split-Naira#1260 — DB uniqueness constraints for financial identities - Add partial unique index on users.email (WHERE email IS NOT NULL) via migration 1760000000015-AddEmailUniquenessConstraint.ts - Map PostgreSQL SQLSTATE 23505 unique-violation to 409 DUPLICATE_RESOURCE in the error handler so concurrent registration races surface correctly - Add 5 tests covering 23505 → 409 mapping, early 409 on duplicate wallet, and safe non-leak of DB internals in the error response Split-Naira#1261 — Transaction timeout coverage for external Stellar calls - Add services/stellar-timeout.ts with classifyStellarFailure (timeout / permanent / transient), isStellarTimeoutFailure, and withStellarTimeoutGuard - withStellarTimeoutGuard ensures DB transactions are rolled back and released when a Stellar call times out, never left open - Add 23 tests covering all classification categories, guard re-throw semantics, the DB-transaction-cleanup scenario, and executeWithRetry timeout behaviour with fake timers Split-Naira#1262 — Structured audit logging for privileged operations - Extend AuditLog entity with actor (wallet address) and outcome fields - Add migration 1760000000016-AddAuditLogActorOutcome.ts - Rewrite audit-log.ts middleware: extract actor from payload/JWT, redact known-sensitive keys (token, apiKey, secret, xdr, signature, …), derive consistent lowercase snake_case event names, record outcome as success / failure / blocked - Export redactSensitivePayload and deriveEventName for unit testing - Add 13 tests (unit + HTTP integration) covering redaction, event names, actor recording, and all three outcome values Split-Naira#1264 — Frontend wallet authentication challenge UX - Add WalletAuthChallenge component with: explanation that this is NOT a payment, distinction callout, expiry timer with near-expiry warning, rejection handling (user cancelled), safe challenge refresh that never reuses expired nonces, success state, ARIA dialog semantics - Add i18n keys to en.json and fr.json (59 keys each, i18n check passes) - Add 19 tests covering all acceptance criteria Closes Split-Naira#1260 Closes Split-Naira#1261 Closes Split-Naira#1262 Closes Split-Naira#1264
|
@Mirabel64 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
| for (const [key, value] of Object.entries(payload)) { | ||
| // Check the direct key | ||
| if (REDACTED_KEYS.has(key.toLowerCase())) { | ||
| redacted[key] = "[REDACTED]"; |
| redactedNested[nk] = nv; | ||
| } | ||
| } | ||
| redacted[key] = anyRedacted ? redactedNested : value; |
| continue; | ||
| } | ||
|
|
||
| redacted[key] = value; |
| ]); | ||
|
|
||
| function isRedactedKey(key: string): boolean { | ||
| return REDACTED_KEYS.has(key.toLowerCase().replace(/[-_]/g, "").replace("secret", "secret")); |
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
Resolves all four issues assigned to Mirabel64. Changes span backend (DB, middleware, services) and frontend (component + i18n).
Issues closed
#1260 — DB uniqueness constraints for financial identities
Problem: Application-level uniqueness checks can race under concurrent requests.
Changes:
1760000000015-AddEmailUniquenessConstraint.ts: adds a partial unique index onusers.email WHERE email IS NOT NULL, preventing duplicate emails at the DB level without affecting existing null-email rows.middleware/error.ts: maps PostgreSQL SQLSTATE23505(unique violation) to a safe 409DUPLICATE_RESOURCEresponse — never leaks DB internals.#1261 — Transaction timeout coverage for external Stellar calls
Problem: External blockchain calls must not hold application resources indefinitely.
Changes:
services/stellar-timeout.ts: exportsclassifyStellarFailure(timeout / permanent / transient),isStellarTimeoutFailure, andwithStellarTimeoutGuard.withStellarTimeoutGuardensures DB query runners are rolled back and released when a Stellar call times out — never left open.executeWithRetrytimeout via fake timers.#1262 — Structured audit logging for privileged operations
Problem: Privileged actions need consistent, searchable audit events.
Changes:
entities/AuditLog.ts: addactor(wallet address) andoutcome(success/failure/blocked) fields.1760000000016-AddAuditLogActorOutcome.ts: adds columns and an index onactor.middleware/audit-log.tsrewritten: extract actor from payload/JWT, redact known-sensitive keys (token,apiKey,secret,xdr,signature, …), derive consistent lowercase snake_case event names, record outcome.redactSensitivePayloadandderiveEventName, HTTP integration tests for actor recording, redaction, and all three outcome values.#1264 — Frontend wallet authentication challenge UX
Problem: The frontend needs a clear flow for signing an authentication challenge.
Changes:
components/wallet/WalletAuthChallenge.tsx:challengeprop arrives.messages/en.jsonandmessages/fr.json(i18n check passes: 59 keys each).Test results
No regressions. All pre-existing failures were present on
mainbefore this PR.New passing tests: 41 backend (5 + 23 + 13) + 19 frontend = 60 new tests.
Closes #1260
Closes #1261
Closes #1262
Closes #1264