diff --git a/docs/manual/03-outside-feature-folder.md b/docs/manual/03-outside-feature-folder.md index 1c13012f..c7639bfd 100644 --- a/docs/manual/03-outside-feature-folder.md +++ b/docs/manual/03-outside-feature-folder.md @@ -106,6 +106,8 @@ release admission refused for staging: - 템플릿 파일 `src/bootstrap/runtime-adapters.ts`는 고치지 않는다. - `src/contracts/product-contracts.ts`: 제품 인증 프로필이나 제품 런타임 설정 키가 필요할 때. - 템플릿 파일 `src/contracts/rest-profiles.ts`는 고치지 않는다. + - 설정 키 이름에 `TOKEN`·`COOKIE`·`SECRET`·`PASSWORD` 같은 조각(`src/contracts/env.ts`의 `FORBIDDEN_CONFIG_NAME_FRAGMENTS`, 대소문자 무관)을 넣지 않는다. 부팅이 `CONFIG_SECRET_NAME_REJECTED`로 멈춘다. `test:unit`의 `env-registry-coverage`가 먼저 `Forbidden client configuration key: <키>`로 실패한다. + - FE-REG-ENV 행의 `required`·`defaultValue`는 zod 필드가 키가 없을 때 하는 것과 같게 적는다. 기본값이 없으면 `defaultValue: null`이다. 같은 테스트가 대조한다. - `config/runtime/.json`: 환경별로 기능을 끄고 싶을 때(`FEATURE_OVERRIDES`). - `package.json`, lockfile, `config/security/dependency-change-evidence.json`: 계약 패키지를 더할 때(B절). diff --git a/tests/unit/env-registry-coverage.test.ts b/tests/unit/env-registry-coverage.test.ts index e5efe327..4098c556 100644 --- a/tests/unit/env-registry-coverage.test.ts +++ b/tests/unit/env-registry-coverage.test.ts @@ -3,6 +3,7 @@ import { isDeepStrictEqual } from "node:util"; import { describe, expect, it } from "vitest"; import { + assertSafeConfigNames, ENV_REGISTRY, type EnvironmentDefinition, } from "../../src/contracts/env.ts"; @@ -61,4 +62,23 @@ describe("FE-REG-ENV coverage", () => { expect(differences).toEqual([]); }); + + // 1103/07-04. The boot refuses a config.json key with a credential-like + // name (`assertSafeConfigNames`). Checking every key the schema reads, with + // the nested keys of its defaults, fails here instead of at the first boot, + // and the error names the key. + it("names no runtime config key the boot would refuse", () => { + const keys = new Set([ + ...Object.keys(shape), + ...Object.keys(rows).filter((key) => rows[key]!.phase === "runtime"), + ]); + const document = Object.fromEntries( + [...keys].map((key) => [ + key, + Object.hasOwn(shape, key) ? schemaDeclaration(key).defaultValue : null, + ]), + ); + + expect(() => assertSafeConfigNames(document)).not.toThrow(); + }); });