Skip to content

security: stop disclosing RPC credentials, O(1) address flow, non-root container, pin GHActions - #1

Open
BlacKSnowDot0 wants to merge 1 commit into
NuraChain:mainfrom
BlacKSnowDot0:fix/security-audit-findings
Open

security: stop disclosing RPC credentials, O(1) address flow, non-root container, pin GHActions#1
BlacKSnowDot0 wants to merge 1 commit into
NuraChain:mainfrom
BlacKSnowDot0:fix/security-audit-findings

Conversation

@BlacKSnowDot0

Copy link
Copy Markdown

Fixes three findings from an independent security audit of the NuraChain org.

  1. /api/stats/summary disclosed the raw RPC_URL (may embed credentials)
    Added PUBLIC_RPC_URL; the summary endpoint now returns it, falling
    back to RPC_URL with userinfo redacted. .env.example updated.

  2. flowOfAddress scanned every successful transaction of an address
    (unbounded memory/CPU per request — DoS on busy addresses).
    Native flow is now maintained in an address_flow ledger during ingest
    (BigInt arithmetic; SQL SUM would overflow/precision-lose wei),
    making the read O(1). After reorgs/chain switches the ledger is
    rebuilt lazily in bounded pages. SCHEMA_VERSION bumped to 2
    (drop-and-replay per repo policy).

  3. Container ran as root
    Dockerfile now creates a non-root user owning logs/ and .data/ and
    drops privileges before CMD.

Also pins ci.yml actions to commit SHAs.

Verified: npm run check, npm run build, npm run test all pass.

…t container, pin GHActions

- client.ts/app.ts: add PUBLIC_RPC_URL; /stats/summary now returns it (or
  RPC_URL with userinfo redacted) instead of the raw RPC_URL, which may
  embed provider credentials
- store.ts: maintain native flow in an address_flow ledger at ingest time
  (BigInt arithmetic), making flowOfAddress an O(1) read; the ledger is
  rebuilt lazily after reorgs/chain switches; SCHEMA_VERSION bumped to 2
- Dockerfile: run the container as an unprivileged user with ownership of
  logs/ and .data/
- ci.yml: pin GitHub Actions to full commit SHAs
@GreatRedem

Copy link
Copy Markdown
Contributor

@BlacKSnowDot0 Please, fix conflict

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