/** * CottonDB HAS NO SECRETS ENGINE, and this guard is what keeps it that way. * * `scripts/secrets/{cli,registry,propagate,providers,sops}.ts` drove a SOPS+age * vault (`../tinmen-secrets`) whose `registry.yaml` declares ONE `github.repo`, * and it reads `decemberfm/tinmen` — so `secrets:sync` and `secrets:rotate` * already refused to run from this repo by construction, and had for as long as * the split existed. Nothing else called the engine: no workflow, no hook, no * script. Meanwhile the credentials it was meant to carry moved to three homes * that are not a git vault: * * 1. CI — Forgejo Actions secrets, set by hand with `pnpm forge secret set * NAME` (value on stdin, never argv). One hand-set secret exists today, * `CLOUDFLARE_MEDIA_DEPLOY_TOKEN` in `deploy-site.yml`. * 2. Product and assistant keys — `cotton_secrets` rows in the person's own * database (`create_secret` / `list_secrets`). The database is the ONLY * copy: "passwords, API keys and secure notes belong in the database now * that it is secure — not in a separate git vault." * 3. Local dev keys — `.env.local` at the worktree root, gitignored. * * Recovery copies of the RUNNER's files (the CI box SSH key, the Apple signing * files, the forge bot token, the GitHub App PEM) stay in the `tinmen-secrets` * vault and are pulled with the TINMEN repo's engine, which is the copy the * shared registry authorises. Nobody is stranded; re-adding an engine here only * re-creates the one that could not sync. * * So: no `scripts/secrets/` directory, and no `secrets:*` script in the root * manifest. A future re-add has to delete this file and say why. */ import { describe, expect, it } from "vitest"; import { existsSync, readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; const REPO_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", ".."); describe("no secrets engine in this repo", () => { it("has no scripts/secrets directory", () => { expect(existsSync(resolve(REPO_ROOT, "scripts/secrets"))).toBe(false); }); it("has no secrets:* script in the root package.json", () => { const manifestPath = resolve(REPO_ROOT, "package.json"); const raw = readFileSync(manifestPath, "utf8"); expect(raw, `unreadable: ${manifestPath}`).not.toBe(""); const scripts: Record = JSON.parse(raw).scripts ?? {}; expect(Object.keys(scripts).filter((name) => name.startsWith("secrets:"))).toEqual([]); }); it("no script or workflow invokes the deleted engine", () => { const scripts: Record = JSON.parse( readFileSync(resolve(REPO_ROOT, "package.json"), "utf8"), ).scripts ?? {}; const offenders = Object.entries(scripts).filter(([, cmd]) => cmd.includes("scripts/secrets")); expect(offenders).toEqual([]); }); });