Skip to content

merge(preprod): resolve PR #229 conflicts + fix CodeQL findings#260

Open
QSchlegel wants to merge 2 commits into
preprodfrom
claude/resolve-pr229
Open

merge(preprod): resolve PR #229 conflicts + fix CodeQL findings#260
QSchlegel wants to merge 2 commits into
preprodfrom
claude/resolve-pr229

Conversation

@QSchlegel
Copy link
Copy Markdown
Collaborator

Merges origin/main into preprod to clear the conflicts on #229, and addresses the three CodeQL alerts that surfaced on the same files. Once this lands on preprod, PR #229's diff updates and it's mergeable into main.

Conflict resolution

  • jest.config.mjs — union both moduleNameMapper entries (libsodium ESM redirect from preprod + styleMock from main)
  • package.json — keep preprod's expanded bot test scripts and Mesh SDK 1.9.0-beta.102 pins; honor main's removal of @jinglescode/nostr-chat-plugin (no remaining source refs on either branch)
  • package-lock.json — regenerated from the resolved package.json via npm install --package-lock-only
  • src/tests/{apiSecurity,botBallotsUpsert,governanceActiveProposals,signTransaction}.test.ts — take preprod. Tighter generics + preprod-shaped tRPC ctx (sessionWallets, primaryWallet) match the live router on preprod
  • src/components/pages/wallet/transactions/transaction-card.tsx — take preprod's defensive JSON.parse guard (Bug: Added transactions via API -> Cannot load 'Transactions' page #211 — a malformed txJson row must not crash the Transactions page)

CodeQL fixes

  • src/lib/server/resolveDRepAnchorFromUrl.tsjs/request-forgery (alerts #26, #27, #28). The existing validator (assertUrlSafeForFetch) checked protocol, hostname blocklist and DNS-resolved IP, but fetch() did its own DNS lookup afterwards — a DNS-rebinding TOCTOU window. Now assertUrlSafeForFetch returns the resolved { ip, family }, and the fetch runs through an undici Agent with buildConnector({ lookup: cb(ip, family) }) so the actual TCP connect uses the pre-validated IP. Hostname blocklist, private/loopback rejection, maxRedirections: 0, body-size cap and timeout all preserved. The unit test was updated to mock undici.request instead of global.fetch (transport change).
  • scripts/ci/framework/markdown.tsjs/incomplete-sanitization (alert #25). Rewrote escapeCell as a single character-class regex /[\\|]/g → \\$& so \\ and | are escaped in one pass — eliminates the chained-replace ordering pattern CodeQL flagged.

Test plan

  • jest src/__tests__/resolveDRepAnchorFromUrl.test.ts — 2/2 pass
  • npx tsc --noEmit — clean for touched files (only pre-existing audit.ts / users.ts / proxyCi* test-mock errors remain, all from preprod)
  • Vercel preview build passes
  • PR Multisig v1 Smoke passes (or flakes on the same testnet-race scenarios as feat(wallets): add Import Wallet wizard #259)
  • CodeQL re-scan no longer flags the three alerts on these files

🤖 Generated with Claude Code

Conflict resolution
- jest.config.mjs: union both moduleNameMapper entries (libsodium ESM
  redirect from preprod + styleMock from main)
- package.json: keep preprod's expanded bot test scripts and Mesh SDK
  1.9.0-beta.102 pins; honor main's removal of @jinglescode/nostr-chat-
  plugin (no remaining source refs on either branch)
- package-lock.json: regenerated from the merged package.json
- src/__tests__/{apiSecurity,botBallotsUpsert,governanceActiveProposals,
  signTransaction}.test.ts: take preprod; tighter generics and preprod-
  shaped tRPC ctx (sessionWallets/primaryWallet) match the live router
- src/components/pages/wallet/transactions/transaction-card.tsx: take
  preprod's defensive JSON.parse guard (#211 — malformed txJson must not
  crash the Transactions page)

Security fixes flagged by CodeQL on the merge
- src/lib/server/resolveDRepAnchorFromUrl.ts: close the DNS-rebinding
  TOCTOU window. assertUrlSafeForFetch now returns the resolved IP, and
  the fetch goes through an undici Agent with a buildConnector-pinned
  lookup so the actual TCP connect uses the pre-validated IP. Switched
  from global.fetch to undici.request for the same reason; existing
  hostname blocklist, private/loopback IP rejection, redirect=error,
  body size cap and timeout are all preserved.
- src/__tests__/resolveDRepAnchorFromUrl.test.ts: mock undici instead of
  global.fetch to match the new transport.
- scripts/ci/framework/markdown.ts: rewrite escapeCell as a single
  character-class regex (\\ and | escaped in one pass) so there's no
  ordering ambiguity that triggers js/incomplete-sanitization.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
multisig Ready Ready Preview, Comment May 26, 2026 8:55am

Request Review

git's three-way merge of preprod←main reported a clean merge of
prisma/schema.prisma and src/server/api/trpc.ts but silently dropped
main's additions — both files had only end-of-file additions on main,
which the auto-merge resolved by taking preprod's tail without pulling
in main's new symbols. The Vercel build then failed on three downstream
references.

prisma/schema.prisma
- Add model AuditLog (referenced by src/lib/observability/audit.ts;
  migration 20260510160404_audit_log_and_indexes already in the tree)
- Make User.nostrKey String? (matches migration
  20260510170000_make_user_nostrkey_optional)

src/server/api/trpc.ts
- Re-export TRPCContext and AuthCtx (used by src/server/api/auth.ts
  added in main's audit-log PR)

Drop the Nostr chat system on preprod to match main
- Remove src/components/pages/wallet/chat and src/pages/wallets/[wallet]/chat
- Drop @jinglescode/nostr-chat-plugin imports from _app.tsx + layout.tsx
- Remove the Chat menu entry from the wallet sidebar
- userRouter.createUser: nostrKey becomes optional (matches the now-
  nullable column) and is only written when supplied
- User profile page: scope nostrKey to a non-null local inside the
  existing `user.nostrKey &&` guard so it still renders for legacy
  users without tripping the nullable narrowing

The repo's nostr-chat-plugin dep was already removed in the prior
merge commit; this commit removes the last call sites and brings the
user-row contract in line with the schema.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant