Security baseline
Mount securityBaselineFeatures() instead of hand-picking the four features
every prod app needs for basic account/security hygiene: sessions
(revocable JWTs), crypto-shredding (operator-triggered subject-key erase),
rate-limiting (ops-side bucket-status query, dispatcher wiring is
automatic), and audit (tenant-scoped audit trail). Forgetting one of them
used to be silent; now the boot validator warns at NODE_ENV=production.
What it shows
Section titled “What it shows”securityBaselineFeatures()(@cosmicdrift/kumiko-bundled-features/presets) — returns the four features in one call, fresh instances per call.warnOnMissingSecurityBaseline— wired intovalidateBoot(fw#2857). AtNODE_ENV=production, boot compares mounted feature names againstSECURITY_BASELINE_FEATURE_NAMESand logs aconsole.warnnaming whatever is missing. It never throws — the baseline is a strong recommendation, not a hard requirement — and it is silent outside production.includeSessions: false— dropsessionsfrom the preset when it is already mounted elsewhere, e.g. viadsgvoSelfServiceFeatures()(mounting the same feature name twice throws at boot).
Feature composition
Section titled “Feature composition”config → tenant's r.requires("config") dependencyuser → cross-tenant identity (sessions' r.requires target)tenant → memberships (audit's r.requires target)auth-foundation → tokenVerifier extension point (sessions' r.requires target)sessions → revocable JWTscrypto-shredding → operator-triggered subject-key eraserate-limiting → ops-side rate-limit status queryaudit → tenant-scoped audit trailWhen to reach for it
Section titled “When to reach for it”Any app that also mounts dsgvoSelfServiceFeatures() — that preset already
mounts sessions as part of its own require-chain. Combine both with
includeSessions: false to avoid a duplicate-feature-name boot failure:
import { dsgvoSelfServiceFeatures, securityBaselineFeatures } from "@cosmicdrift/kumiko-bundled-features/presets";
export const APP_FEATURES = [ // ...config, user, tenant, auth-foundation... ...dsgvoSelfServiceFeatures(), ...securityBaselineFeatures({ includeSessions: false }),];For an app that does not mount dsgvoSelfServiceFeatures(), use
securityBaselineFeatures() with its default options, as this recipe does.
bun test samples/recipes/security-baseline/src/__tests__/feature.test.tsThree cases: APP_FEATURES boots clean; at NODE_ENV=production it produces
no security-baseline warning; dropping crypto-shredding/rate-limiting/
audit (sessions stays mounted — auth-foundation’s own bootCheck requires
a sessionStore) at NODE_ENV=production produces exactly one warning and
still does not throw.
Source code
Section titled “Source code”The feature entry point — embedded straight from the source file, so the code here is exactly what runs. Multi-file samples keep their remaining files next to it on GitHub (link below):
// Security-Baseline Sample// Shows: mounting securityBaselineFeatures() (sessions, crypto-shredding,// rate-limiting, audit) and how it silences the NODE_ENV=production boot// warning that fires when one of those four is missing.
import { authFoundationFeature } from "@cosmicdrift/kumiko-bundled-features/auth-foundation";import { createConfigFeature } from "@cosmicdrift/kumiko-bundled-features/config";import { securityBaselineFeatures } from "@cosmicdrift/kumiko-bundled-features/presets";import { createTenantFeature } from "@cosmicdrift/kumiko-bundled-features/tenant";import { createUserFeature } from "@cosmicdrift/kumiko-bundled-features/user";import type { FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
export const APP_FEATURES: FeatureDefinition[] = [ createConfigFeature(), createUserFeature(), createTenantFeature(), authFoundationFeature, ...securityBaselineFeatures(),];📄 On GitHub: samples/recipes/security-baseline/src/feature.ts