Skip to content

Security invariants

The repository security baseline defines five invariants. A change touching one needs its enforcement check and behavior-specific tests.

InvariantRequired propertyEnforcement
Normalized Matrix inputCapability and presentation code consume normalized eventsAdapter contracts and hostile-input tests
Secret-safe diagnosticsCredentials, secret material, message bodies, and precise location stay out of diagnosticsTyped failure metadata and hostile-adapter tests
SDK import containmentMatrix SDK imports stay in approved adapters and pure Matrix modeling utilitiesESLint and architecture checks
Electron IPC boundaryIPC is versioned, sender-validated, and capability-scopedHost contract and IPC security tests
Sensitive preference policySensitive settings declare storage and export restrictionsPreference catalog and export-schema guards

Treat Matrix events, deep links, host messages, configuration documents, and imported files as untrusted. Normalize and validate them at the owning adapter before capability or presentation code consumes them.

Use the narrowest public contract. Do not expose SDK objects, Electron channels, native plugin instances, storage keys, or secret-bearing exception payloads across layers.

Run pnpm architecture:check and the focused security/host/capability tests after changing one of these boundaries. A successful compile alone does not exercise hostile input or runtime sender validation.

Read diagnostics and encryption and trust for related lifecycle rules.