Skip to content

security(bridge): ENG-279 audit findings — 3 issues, branch blocked until resolved#314

Draft
patoo0x wants to merge 5 commits intofeature/bridge-integrationfrom
security/eng-279-bridge-audit
Draft

security(bridge): ENG-279 audit findings — 3 issues, branch blocked until resolved#314
patoo0x wants to merge 5 commits intofeature/bridge-integrationfrom
security/eng-279-bridge-audit

Conversation

@patoo0x
Copy link
Copy Markdown
Contributor

@patoo0x patoo0x commented Apr 1, 2026

Bridge Integration Security Audit (ENG-279)

Full findings in docs/bridge-integration/SECURITY-AUDIT.md.

🔴 Critical

Amount not validated before Bridge API call
initiateWithdrawal passes raw amount: string directly to Bridge with no validation. Allows NaN, -100, exponential notation. Fix: parse + validate >= 1.0 before API call.

🟡 High (x2)

Fake email in customer creation (ENG-278)
${account.id}@flash.app placeholder email sent to Bridge KYC. KYC emails undeliverable, ToS violation. Fix: use real email from Kratos identity.

External account ownership not enforced in withdrawal
If externalAccountId not found in user's accounts, transfer is attempted anyway. Should early-return error if targetAccount === undefined.

✅ Passes

  • Webhook RSA-SHA256 signature verification — correct
  • GraphQL mutation auth (level < 2 gate) — correct
  • BridgeConfig.enabled feature flag — correct
  • IBEX Tron address — correctly stubbed, safe

Bottom line

Branch not ready to merge. 3 targeted fixes needed. Items 1 and 3 are < 1 hour. Item 2 (ENG-278) needs Kratos identity lookup — pattern already exists in business-account-upgrade-request.ts.

…ore merge

Critical: amount not validated before Bridge API call
High: fake placeholder email in customer creation (ENG-278)
High: no error if external account not found in withdrawal

Webhook sig verification, GraphQL auth, and feature flag
gating all pass. Branch blocked until 3 items resolved.
@linear
Copy link
Copy Markdown

linear Bot commented Apr 1, 2026

@islandbitcoin islandbitcoin marked this pull request as draft April 7, 2026 13:47
forge0x added 4 commits April 7, 2026 21:09
… guard

fix(initiateKyc): use real email from Kratos identity (IdentityRepository)
  instead of the `${account.id}@flash.app` placeholder.
  Falls back to placeholder with a warning log if Kratos lookup fails or
  identity has no email — maintains KYC flow without hard failure.

fix(verifyBridgeSignature): remove silent JSON.stringify fallback for rawBody.
  If req.rawBody is not set (body-parser misconfiguration), the middleware now
  returns HTTP 500 with a descriptive error instead of silently bypassing
  signature verification. The standalone webhook server already sets rawBody
  via express.json({ verify }) — this guard makes misconfiguration loud.

Refs: ENG-279
- Add BridgeDepositAddress collection + repo for active crypto receive addresses
- Remove chain-specific bridgeTronAddress from Account schema/type
- Resolve ETH USDT receive address through IBEX and persist in BridgeDepositAddress
- Update Bridge virtual account creation and withdrawal flows to read from repo
- Add generic bridge deposit primitive to domain layer

This replaces the hardcoded Tron field with a pre-launch extensible model.
- Add unit coverage for BridgeDepositAddress repository
- Verify active address reuse, deactivation + insert, and deactivate helper
- Verify Bridge service reuses existing deposit address, creates/stores a new ETH USDT address when missing, and uses stored address for withdrawals
- Update IBEX client createCryptoReceiveInfo wrapper to use documented
   +  +  request shape.
- Switch ETH USDT receive creation to the documented receive-info API.
- Update IBEX crypto-receive webhook to resolve deposits via the new
  BridgeDepositAddress collection and accept ethereum/erc20 payloads.
- Refresh bridge integration docs to remove Tron-specific language.
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