Language

What the kernel owns

Routing, authentication, permission enforcement, audit writes, configuration versioning, snapshots, database connections and file boundaries have a single implementation; modules can only call the interfaces.

What the kernel owns is not "core business"; it is the set of things that must not have a second copy: routing and authentication, permission enforcement, audit writes, configuration versioning, snapshots, database connections, file boundaries. Modules can only call their interfaces; they cannot implement their own copy.

This boundary deserves an article of its own, because it decides whether this system slowly grows two sets of answers as it is extended.

The list

Runtime and configuration: service startup, configuration loading, ports and the run lifecycle; configuration storage and encryption of sensitive fields.

HTTP surface: route registration, middleware, request body limits, unified error responses. The request body limit is the kernel's default; any endpoint that needs to exceed it must declare so explicitly to the kernel, and it is only allowed on one precise method and path — no wildcards, no subtrees, no arbitrary methods.

Accounts and permissions: administrator authentication, sessions, password policy, roles and permission enforcement. "Can this request get in" and "can this field be changed" are both answered at this layer; modules can declare which permission codes they need, but they cannot judge for themselves.

Data: database connections, transactions, migration execution, dialect and database capability checks. Migrations are accounted by "plugin + version number"; once a version number has been used, it belongs to that migration.

Files: the storage abstraction, path safety, upload boundaries, file access control. Business modules receive media assets and never touch the filesystem.

Events and tasks: the event bus, reliable delivery within transactions, retries, dead letters and delivery status; registration of scheduled tasks, their run records and lifecycle.

Audit and recovery: audit log writes, traces of critical operations, protection of security metadata; backup snapshots, checksums, recovery, rollback and the rules for protected system tables.

Frontend: server-side rendering context, address and language resolution, the theme loading boundary, HTML sanitization and cache fingerprints.

Extension itself: module manifest validation, dependency resolution, lifecycle states and capability registration constraints. If a module declares that it consumes a capability but the assembly order is wrong, it is blocked at registration time.

Three whys

Audit writes exist only in the kernel. Audit is something retained long-term, queryable in the backend, and carries a digest chain. If every module wrote its own log line, "who changed it" would have several accounts with different degrees of credibility, and afterwards nobody could tell which one counts. Likewise, the output of commands and interfaces does not enter the audit — the redaction rules recognize by key name, and privacy values such as customer emails and phone numbers live in the body; writing the output into a place retained long-term and open to everyone is like building a privacy warehouse that is only half redacted.

HTML sanitization happens in exactly one place. Rich text, navigation, operation slots and theme output share the same sanitizer; when the sanitization rules change, the signature version must be upgraded in sync, otherwise browsers will keep hitting pre-sanitized pages with an old ETag. Sanitization is attached at read time rather than write time, because doing it at write time would consume the version sequence number and advance the visibility watermark — that would be a security fix quietly changing publish semantics.

Request protection only counts by default. The kernel ships a basic layer of request protection whose default mode is "count only, block no one"; it only rejects when explicitly enabled. The reason is practical: a rate limiter that has never seen a site's real traffic is about as likely to lock a customer's office out as to block an attacker. This layer is not a WAF, and we do not call it a WAF anywhere — it is a bounded, minimal protection whose target is "an endpoint being replayed without limit", not "arbitrary malicious payloads".

One criterion

To ask "should this go into the kernel", judge with this shape: if two modules each implemented it, would one of the answers quietly become wrong? Yes — into the kernel. No — it is business, and it belongs to the modules.

Content, media, navigation and other high-frequency capabilities are not the kernel, but they are not "plugins you can disable at will" either; they sit in the middle layer: platform modules.