Carries eight template commits: the provider sandbox actually running, release
admission to a named environment, the product feature manifest with its runtime
kill switch, architecture and documentation rules that match what is enforced,
the removability fixtures, and the browser, visual and performance evidence.
Product identity is unchanged. `package.json` keeps `tech-log-frontend` and the
catalog keeps the Tech Log naming; the home page was not in the delta. The
visual baselines are this product's own — the template's were excluded from the
transplant and these were regenerated here, where the only difference is the
platform overview's new product-feature section.
What this repository gains operationally: `config/runtime/{local,development,
staging,production}.json` with `FE-GATE-027` refusing an artifact whose runtime
document does not match the environment it is being admitted to, and
`FEATURE_OVERRIDES` for taking an installed feature out of service without a
rebuild.
Verified here: eight gates green, build green, visual 5/5, and 1,858 of 1,859
tests in the suites that do not need a sandbox — the one failure passes in
isolation and is a jsdom lazy-chunk timeout under parallel load. The provider
suites cannot run on this machine at all: `kernel.apparmor_restrict_unprivileged
_userns=1` makes `bwrap --unshare-net` fail, reproducible without any code from
either repository.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { mkdirSync, mkdtempSync } from "node:fs";
|
|
|
|
/**
|
|
* Creation modes that must not depend on the caller's ambient umask.
|
|
*
|
|
* `mkdir(path, { mode: 0o700 })` and `open(path, ..., 0o600)` are requests, not
|
|
* guarantees: the kernel subtracts the process umask from every one of them. A
|
|
* runner hardened with `umask 0777` therefore produces directories nobody can
|
|
* enter and files nobody can read, and the failure surfaces far from its cause
|
|
* — as `tar` failing to mkdir a nested path, or as EACCES opening a staging
|
|
* leaf this process created moments earlier.
|
|
*
|
|
* Release evidence has to be exactly private, so the mode is pinned rather than
|
|
* inherited. The pin is held across a synchronous call only: nothing else in
|
|
* this process can interleave, so the global umask is never observably changed.
|
|
*/
|
|
const PRIVATE_UMASK = 0o077;
|
|
|
|
export function withPrivateUmask<T>(operation: () => T): T {
|
|
const previous = process.umask(PRIVATE_UMASK);
|
|
try {
|
|
return operation();
|
|
} finally {
|
|
process.umask(previous);
|
|
}
|
|
}
|
|
|
|
/** Creates a uniquely named private directory under `prefix`. */
|
|
export function makePrivateTemporaryDirectory(prefix: string): string {
|
|
return withPrivateUmask(() => mkdtempSync(prefix));
|
|
}
|
|
|
|
/** Creates `target` privately, failing if it already exists. */
|
|
export function makePrivateDirectory(target: string): void {
|
|
withPrivateUmask(() => mkdirSync(target, { mode: 0o700 }));
|
|
}
|