feat: implement middleware authentication, secure secret redaction, a… - #772
Merged
Merged
Conversation
…nd optimize performance with lazy-loading components and virtualized grids.
|
@Alhaji-naira Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Description
This PR addresses critical performance bottlenecks and security vulnerabilities. It improves initial load times by code-splitting heavy chart libraries, stabilizes UI rendering for massive property lists, and enforces secure data handling for both client routing and error reporting.
🚀 Performance Optimizations
Deferred Heavy Chart Libraries (Closes [Perf] Defer recharts / d3 charts to dynamic imports above-the-fold #650):
withLazyChartHOC combiningnext/dynamicandIntersectionObserver.TransactionAnalyticsandMortgageCalculatorto preventrechartsandd3from blocking the main thread eagerly.TransactionHistory.tsxto ensure proper code-splitting.Virtualized Property Grids (Closes [Perf] Virtualize large Web3 property grids with @tanstack/react-virtual #651):
VirtualizedPropertyGridcomponent powered by@tanstack/react-virtual.SearchResults.tsx(which powers the/propertiesroute) with the virtualized version, solving scroll stuttering on lower-end devices.aria-setsize,aria-posinset, androle="listitem"onto virtual rows to preserve 100% screen reader accessibility.🔒 Security Enhancements
Strict JWT Validation (Closes [Security] Validate JWT/auth-token in middleware.ts (currently only checks cookie existence) #652):
auth-tokenmiddleware check to perform full cryptographic signature and expiry validation usingjose(jwtVerify), closing an authentication bypass vulnerability.useAuth.ts.middleware.test.ts.Automated Secret Redaction (Closes [Security] Strip secrets from error-reporting context (privateKey, mnemonic, cookies) #654):
redactSecrets) insrc/utils/secretRedaction.tsleveraging aWeakSetto safely handle circular references.sendToAnalytics(src/utils/errorReporting.ts) to strip sensitive keys (jwt,private_key,token, etc.) from contextual error data and stack traces before transmission.Testing & Validation
npm run lintandnpm test).@tanstack/react-virtualgrid inSearchResults.test.tsxto ensure tests continue to pass gracefully.Reviewer Notes
Please ensure that the
AUTH_SECRETenvironment variable is correctly configured in staging and production, as the strict middleware validation will safely block users if the secret is missing.