#!/usr/bin/env bun /** * Lint: no internal hosts or real WorkOS identifiers in the public repo. * * This repo is public and indexed, so a real hostname or identifier in any * tracked file (a test fixture, a doc example, a script default) discloses * deployment topology or a customer. Examples use fictional values instead: * `nb.example.com`, `tenant-a.nb.example.com`, `brain.acme.com`. * * What this flags, in every git-tracked text file: * * 1. `company-subdomain` — a subdomain of the company domain that is * not in `PUBLIC_COMPANY_SUBDOMAINS`. Anything else on that domain is * internal: hosted tenants, companion services, environments. * 2. `authkit-subdomain` — a `.authkit.app` host whose * subdomain is not in `FICTIONAL_AUTHKIT_SUBDOMAINS`. * 3. `workos-client-id` — the WorkOS client-id shape: `client_01` plus * 24 Crockford base-32 characters. Tests use a non-conforming id such * as `client_test`, which the shape never matches. * * Allow-lists: `PUBLIC_COMPANY_SUBDOMAINS` holds the public sites, and * `FICTIONAL_AUTHKIT_SUBDOMAINS` holds the AuthKit labels that are provably * placeholders: the documented example (`myapp`) and the test issuer * (`testapp`). Both hold exact labels, not patterns. Nothing else is exempt: * no per-line marker, no file exemption. A value that must be * real at runtime comes from an argument or the environment, never from * source. * * Scope: every file `git ls-files` lists, skipping binaries (any NUL byte). * * Exports `findInternalHosts` for the self-test under `test/unit/scripts/`. */ import { readFileSync } from "node:fs"; import { join } from "node:path"; const ROOT = join(import.meta.dirname ?? __dirname, ".."); /** Exact `