Skip to content

Harden auth rate limiting, unify validation errors, bound WebSocket rooms, and raise coverage thresholds - #774

Merged
meshackyaro merged 3 commits into
trustflow-protocol:mainfrom
0xMegie:waveii
Oct 18, 2026
Merged

meshackyaro merged 3 commits into
trustflow-protocol:mainfrom
0xMegie:waveii

Conversation

@0xMegie

@0xMegie 0xMegie commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

closes #369 - Adds stricter env-configurable per-IP limits to /auth/challenge and /auth/verify, and stops a new challenge request from replacing a live one so a third party can't cancel someone else's login.
Adds a documented TRUST_PROXY setting; 429s now carry Retry-After/X-RateLimit-* headers and every rejection is logged and counted in a metric.

closes #368 - Zod and class-validator failures now return the same 400 shape { statusCode, message: 'Validation failed', errors: [{ field, message }] }; Zod errors no longer return 500 or get reported to Sentry.
GET /auth/challenge validates through ChallengeDto, the bare throw new Error(...) calls in AuthController are now 400/401, and the error format is documented with a Swagger response type.

closes #393 - subscribe:gig / unsubscribe:gig validate the gigId payload and return an error reply instead of throwing; each socket is capped at WS_MAX_ROOMS_PER_CLIENT rooms.
Connection and room counts are exposed through getStats() and logged, the disconnect reason is logged, and the gateway spec covers invalid payloads, the cap and disconnects.

closes #397 - Raises the global Jest coverage floor and adds per-path thresholds for escrow, dispute, auth, gig, outbox, rate-limit and idempotency; *-spec.ts files now run too.
Adds codecov.yml project/patch checks, makes the CI coverage upload fail the build on error, adds outbox relay/publisher specs, and updates CI_SETUP_SUMMARY.md with the real thresholds and testing requirements.

…ent and improve challenge reuse

fix(validation): unify validation error handling for class-validator and Zod, ensuring consistent 400 responses

feat(rate-limit): introduce dynamic rate limit values via thunks for environment-configured limits

test(rate-limit): add tests for rate limit headers and thunk-based limits in RateLimitGuard

feat(validation): implement validation error DTOs and error handling for Zod validation

chore(env): add environment variables for auth route rate limits and WebSocket settings

test(outbox): implement tests for OutboxPublisherService and OutboxRelayService to ensure reliable event handling

chore(coverage): add Codecov configuration for coverage status checks on backend PRs
@0xMegie
0xMegie requested a review from meshackyaro as a code owner October 18, 2026 12:44
0xMegie and others added 2 commits October 18, 2026 13:59
fix(ci): make coverage upload failure non-blocking for forked PRs

refactor(nonce-store): improve logging for reused live challenges

style: format imports and improve readability in various files

test: update test descriptions for clarity and consistency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants