app/lib/admin/secrets.server.ts
16 lines and 2 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| auditSecrets | 13 to 19 | 1 | 100% | OkCRAP 1 | No data: no mutants in this code |
| <anonymous:14> | 14 to 18 | 2 | 100% | OkCRAP 2 | No data: no mutants in this code |
Imports
It imports app/lib/secrets.mjs. Imported by app/routes/admin.tools.tsx.
Source
// PRESENCE ONLY: return a name and a boolean, never a value, a masked value or a length (each leaks).
// check:secrets matches `env.NAME`, so these dynamic `env[name]` reads are not in its count.
// Relative, not `~`: test/secrets-audit.test.mjs runs under node:test, which cannot resolve the alias.
import { REQUIRED_SECRETS } from "../secrets.mjs";
export interface SecretPresence {
name: string;
present: boolean;
}
// Empty string counts as absent: a `.dev.vars` line with nothing after `=` stores one.
export function auditSecrets(env: Record<string, unknown>): SecretPresence[] {
return REQUIRED_SECRETS.map((name) => ({
name,
// Tested and discarded in one expression, never bound, so no later edit can return it.
present: typeof env[name] === "string" && (env[name] as string).length > 0,
}));
}