Resource scoping enforced
Why it matters
Passing the full host application instance to plugins — the Express app object, a raw database connection, or process — is functionally equivalent to giving every third-party plugin full administrative access to the application. Plugins can add routes, read or overwrite shared state, escalate their own permissions, or access data belonging to other plugins and tenants. OWASP A01 (Broken Access Control) and CWE-284 apply directly. The plugin surface becomes an attack surface: a malicious or compromised plugin can exfiltrate any data the host can reach.
Severity rationale
Critical because exposing the full host instance to plugins grants third-party code unrestricted access to the database, internal state, and other plugins' data — OWASP A01 applied at the architecture level.
Remediation
Replace full-instance passing with a scoped PluginContext that exposes only the APIs plugins legitimately need. Define the interface explicitly so the accessible surface is auditable.
interface PluginContext {
// Storage scoped to this plugin:
storage: PluginStorage;
// Only specific host APIs exposed:
hooks: HookRegistry;
config: Readonly<PluginConfig>;
logger: Logger;
// No access to: database, raw HTTP server, other plugins, internal state
}
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Plugin / Extension Architecture Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-829 — Inclusion of Functionality from Untrusted Control Sphere — plugins must not receive unrestricted access to host internals
- cwe · CWE-284 — Improper Access Control — scoped plugin context enforces least-privilege access
- owasp:2021 · A01 — Broken Access Control
- iso-25010:2011 · maintainability.modularity — Modularity — scoped API surface decouples plugin code from host internals
Taxons
History
- 2026-04-18·v1.0.0·Initial import from plugin-extension-architecture·automated