Commit 3d1568e
committed
refactor(lib): fix critical security, memory leaks, and architectural
duplications
This major overhaul of the `lib/` directory addresses critical
vulnerabilities,
performance bottlenecks, and massive code duplications across the core
framework.
- **app.js**: Secured unprotected admin routes (RCE risk), fixed memory
leak in
auto-updater intervals, and fixed DevServer middleware injection bug.
- **routing/route-manager.js**: Removed 6 duplicated methods, fixed
custom rate-limit
memory leak (OOM risk), and optimized regex execution to prevent Event
Loop blocking.
- **layout/layout-manager.js**: Replaced blocking `readFileSync` with
async I/O,
added lock mechanism to prevent race conditions during layout
creation, and
removed redundant EJS double-escaping.
- **dev/dev-server.js**: Removed global process hijacking
(`uncaughtException`),
fixed incorrect WebSocket port in injected client, secured HTML
injection against
JSON corruption, and added auto-reconnect to client script.
- **core/auto-updater.js**: Converted to instance class, fixed
destructive rollback
bug (safe temp-dir swap), fixed version comparison crash, added
missing SHA-512
integrity verification, and made all I/O operations non-blocking.
- **core/auth-manager.js**: Implemented missing `setupViews` method
(crash fix),
fixed broken route middleware chaining, removed memory-leaking custom
rate limiters,
and secured CSRF validation against `RangeError` crashes.
- **plugin-manager.js**: Merged 5 duplicate methods, fixed `setInterval`
and `chokidar`
memory leaks, and implemented missing sandbox/validation methods.
- **adapters/nextjs-adapter.js**: Fixed infinite hang in serverless API
handlers,
fixed `res.end` context crash, and replaced dangerous monkey-patching
with safe wrappers.
- **core/module-installer.js**: Removed `process.exit(1)` library
anti-pattern,
updated vulnerable dependency versions, and switched to async
execution.
- **core/logger.js**: Added object inspection for complex logs,
integrated file logging,
and added environment awareness to suppress dev logs in production.1 parent d783f9a commit 3d1568e
7 files changed
Lines changed: 95 additions & 8798 deletions
File tree
- coverage
- lcov-report
- templates/public
- css
- js
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
This file was deleted.
This file was deleted.
0 commit comments