Skip to content

Commit 3d1568e

Browse files
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/clover.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<coverage generated="1783303650959" clover="3.2.0">
3-
<project timestamp="1783303650959" name="All files">
2+
<coverage generated="1783357108809" clover="3.2.0">
3+
<project timestamp="1783357108811" name="All files">
44
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
55
</project>
66
</coverage>

coverage/lcov-report/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h1>All files</h1>
8686
<div class='footer quiet pad2 space-top1 center small'>
8787
Code coverage generated by
8888
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89-
at 2026-07-06T02:07:30.820Z
89+
at 2026-07-06T16:58:28.737Z
9090
</div>
9191
<script src="prettify.js"></script>
9292
<script>

package-lock.json

Lines changed: 89 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/public/css/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
body { font-family: Arial, sans-serif; margin: 40px; }
2-
h1 { color: #3498db; }
1+
body { font-family: Arial, sans-serif; margin: 40px; }
2+
h1 { color: #3498db; }

templates/public/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
console.log('Vako loaded');
1+
console.log('Vako loaded')

verification-report-advanced.json

Lines changed: 0 additions & 1568 deletions
This file was deleted.

verification-report.html

Lines changed: 0 additions & 7222 deletions
This file was deleted.

0 commit comments

Comments
 (0)