Introduces a unified security event store and HTTP API that ingests events from any of the configured sources (API audit, Caddy access log, fail2ban, shared_bans, future remote agents) and surfaces them in the dashboard. New files: src/security/event-store.js JSONL-backed store + in-memory query index src/security/host-registry.js Registered hosts with per-host API keys src/security/event-workers.js Tail-followers for Caddy/fail2ban/shared_bans logs routes/security.js Events, hosts, ingest, SSE stream endpoints status/js/security-center.js Dashboard modal with Overview/Events/Hosts tabs SECURITY-FEATURE.md Full feature documentation DEAD-CODE.md, DUP-CODE.md, HARDENING.md Prior audits Modified: src/app.js Mount /api/v1/security/* src/utilities/middleware.js Add ingest endpoints to PUBLIC_ROUTES src/security/audit-logger.js Mirror audit events into security store server.js Start security workers on boot status/build.js Bundle security-center.js status/index.html Add Security button to nav
2.8 KiB
2.8 KiB
DashCaddy Dead Code Report
Generated: 2026-07-13
Scope:123source files,55exported names
Total source LOC: 36,231
Summary
| Category | Count |
|---|---|
| Dead exports (defined, never imported) | 11 |
| Unused files (no importer) | 7 | | Large local dead functions (30+ lines, never called) | 0 |
⚠️ Caveats
This is a static analysis pass — every finding should be verified before deletion:
- Entry points (
server.js,src/app.js, mounted route files) are exempted from 'unused file' check - Re-exports via
module.exports = { X }look like dead exports unless we track which file imports the whole module - Framework callbacks (Express middleware, error handlers, lifecycle hooks) often look unused but aren't
- Side-effect imports (
require('./foo')for side effects) aren't tracked here - Dynamic requires (
require(variableName)) won't be detected
Treat this as a TO-DO list, not a delete list. Each finding needs a human check.
Confidence Classification
- 6 high-confidence dead exports (no obvious dynamic load path)
- 5 medium-confidence dead exports (might be loaded via registry / factory / dynamic require)
1. Dead Exports
Symbols that are defined (and exported) but never imported elsewhere in the codebase.
| Symbol | Defined in | Confidence |
|---|---|---|
BUNDLED_WORKFLOWS |
src/recipes/bundled-workflows.js:575 |
high |
DEFAULT_LIMIT |
src/utilities/pagination.js:53 |
high |
MAX_LIMIT |
src/utilities/pagination.js:53 |
high |
RFC2136Provider |
src/dns/dns-providers/rfc2136.js:383 |
high |
SelfUpdater |
src/docker/self-updater.js:790 |
high |
readTextFile |
src/utilities/fs-helpers.js:65 |
high |
CloudflareDNSProvider |
src/dns/dns-providers/cloudflare.js:269 |
medium |
DEFAULT_POLICY |
src/managers/auto-restart-manager.js:503 |
medium |
ManualDNSProvider |
src/dns/dns-providers/manual.js:93 |
medium |
PREMIUM_FEATURES |
src/managers/license-manager.js:494 |
medium |
TechnitiumDNSProvider |
src/dns/dns-providers/technitium.js:507 |
medium |
2. Unused Files
Files not required by any other file in the source tree. Entry points and mounted route files are exempted.
| File | Size |
|---|---|
routes/context.js |
4,940 bytes |
src/dns/dns-providers/cloudflare.js |
9,816 bytes |
src/dns/dns-providers/manual.js |
2,471 bytes |
src/dns/dns-providers/rfc2136.js |
13,135 bytes |
src/dns/dns-providers/technitium.js |
16,607 bytes |
src/managers/license-keygen.js |
11,024 bytes |
src/utils/index.js |
492 bytes |
3. Local Dead Functions (≥ 30 lines)
Top-level functions defined but never called within the file or from any other file. Smaller helpers are not flagged.
| Function | File | Lines |
|---|