fix(backend): restore Joi validation on smart-wallet routes and fix C… - #49
Merged
jobbykings merged 1 commit intoJun 21, 2026
Conversation
…I readiness (Issue Epondia#44) - Fix paillier-js import in SecureAggregation.js (wrong destructure) - Add ../node_modules/@types to typeRoots in tsconfig.json for Jest globals - Remove deprecated stub @types/express-validator and @types/natural - Remove duplicate unused smartWalletRoutes.ts - Make MongoDB Memory Server failure graceful in test setup - Create GasOptimizationService stub with expected methods - Add missing methods to smart wallet service stubs - Fix assignment validation, grading, and code execution services - Fix assignment.test.ts type errors and class statistics test data All targeted tests pass: validateRequestSchema (10/10), smartWallet (19/19), assignment (30/30), tsc --noEmit (0 errors)
jobbykings
approved these changes
Jun 21, 2026
6 tasks
jobbykings
pushed a commit
that referenced
this pull request
Jun 21, 2026
… (Issue #44) * Per-route Joi schemas in backend/src/routes/smartWallet.ts now reject malformed Ethereum addresses, hex calldata, 65-byte signatures, 32-byte hashes, non-BigInt-safe value strings, non-numeric/ISO dates, and unspecified/unbalanced guardian/signer arrays. Cross-field guards added (threshold <= signers, newOwner != guardianAddress). * GET endpoints now also validate path params (recoveryId, walletAddress) and query params (limit, acknowledged) instead of trusting them. * validateRequestSchema middleware now aggregates ALL errors per source with a normalized { success: false, message, errors: [{ source, field, message }] } envelope that matches the rest of the codebase, validates body/query/params in one pass, strips unknown fields, and uses safe-path extraction to avoid crashes on missing detail.path. * backend/src/utils/validation.ts docblock updated to explain why the no-op stubs remain (controllers/assignmentController.ts still imports them) and to redirect new code to the real middleware. * Removes the stale backend/src/tests/validateRequestSchema.test.js from PR #49 (asserted the pre-fix envelope and was failing the new tests). * Adds backend/tests/middleware/validateRequestSchema.test.ts covering the full middleware surface: pass-through on success, 400 envelope, source/field/message normalization, multi-source aggregation, missing-path safety, unknown-field stripping, empty-schema pass-through. Refs #44 (assigned to gbengaeben).
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.
…I readiness (Issue #44)
All targeted tests pass: validateRequestSchema (10/10), smartWallet (19/19), assignment (30/30), tsc --noEmit (0 errors)
closes #43