ci(security): release 단계가 의존성 advisory를 템플릿 정책으로 판정해 남긴다
문제: 의존성 취약점 판정은 운영 승격의 외부 provider에만 있었다. 로컬 supply chain은 스캔하지 않고 provider: UNCONFIGURED를 썼다. 그래서 lockfile이 템플릿 자신의 정책(high 이상 차단, 예외 0건)을 어겨도 merge· release 단계에서는 아무 신호가 없었고, provider가 없는 복사본은 끝까지 몰랐다. 갱신 자동화도 없었다(짝 백엔드에는 renovate.json이 있다). 고른 방법: - scan:dependency-advisories(scripts/scan-dependency-advisories.ts)가 pnpm audit --json에 config/security/vulnerability-policy.json과 예외 파일을 적용한다. 판정은 승격이 쓰는 validateVulnerabilityReport를 그대로 쓴다. 결과는 PASS / POLICY_VIOLATION(승격에서 막힐 항목 목록) / UNVERIFIED(레지스트리에 닿지 못함)이고, 운영·개발 의존성별 개수와 함께 gate 로그와 artifacts/security/dependency-advisories.json에 남는다. - FE-GATE-027(release-admission, release 단계, 후보 빌드 직후)이 이 명령을 두 번째로 돈다. 명령은 항상 exit 0이다. - renovate.json을 둔다(보안 업데이트만, 사람이 리뷰·merge). - 남은 운영 의존성 위반 2건과 올리지 않은 이유, 다시 볼 날짜 (2026-12-04)를 ci-quality-gates.md에 적는다. 버린 대안: merge 차단 audit(코드가 안 바뀌어도 advisory DB 변경으로 merge가 깨진다), 로컬 스캐너를 provider로 내장(서명 주체 분리라는 원래 목적이 사라진다), 새 evidence 산출물·스키마 등록(계약 변경이 커진다. gate 로그가 이미 release 단계 산출물이다). 위험·한계: 비차단이라 신호를 읽는 사람이 있어야 한다. 네트워크가 없는 runner에서는 UNVERIFIED로 남는다. Renovate runner는 붙어 있지 않아 renovate.json은 아직 동작하지 않는다. 남은 zod·react-router high 2건은 dependency-change-evidence의 reviewer(owner와 다른 사람)와 zod의 번들 예산 결정이 있어야 고칠 수 있다. 계약 기준선(contract-baseline.json)을 명령 100개·참조 104개로 다시 기록했다. 검증: dependency-advisories.test.ts 5건(정책 위반 판정, PASS, 유효한 예외, 보고서 없음 → UNVERIFIED, FE-GATE-027 배선과 exit 0). 상태 판정을 PASS로 고정하는 변이를 넣으면 실패한다. 실제 실행: POLICY_VIOLATION (운영 high 2, 개발 moderate 2), exit 0. 죽은 프록시로 돌리면 UNVERIFIED, exit 0. check:ci PASS, CI workflow bytes PASS, ci-workflow-generation· product-ci-overlay·ungated-scripts·removal-fixture·supply-chain 489건 통과, verify:documentation PASS_SCOPED. Refs: docs/reviews/2026-11-03-maturity-review/13-build-release-supply-chain.md 13-03
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"owner": "frontend-platform",
|
||||
"reason": "U7: FE-GATE-020 runs test:feature-scaffold, which creates a feature with create:feature in a copy and runs the merge gates on it",
|
||||
"owner": "DongHyeonka",
|
||||
"reason": "1103/13-03: FE-GATE-027 also runs scan:dependency-advisories, a non-blocking release-stage advisory signal",
|
||||
"gates": 27,
|
||||
"commands": 99,
|
||||
"commandReferences": 103,
|
||||
"commands": 100,
|
||||
"commandReferences": 104,
|
||||
"artifacts": 110,
|
||||
"stages": 5,
|
||||
"gateShapeSha256": "02e87e35b87fbc5114af7e1b1ce1ec030062c60ae8bd03c151f1ec9538f2db3b"
|
||||
"gateShapeSha256": "6225494d6447a2065d921a34597a744d180a7a68e601119e32f8fc42e18eb1c1"
|
||||
}
|
||||
|
||||
@@ -595,6 +595,11 @@
|
||||
"id": "check-release-admission",
|
||||
"script": "check:release-admission",
|
||||
"expect": "pass"
|
||||
},
|
||||
{
|
||||
"id": "scan-dependency-advisories",
|
||||
"script": "scan:dependency-advisories",
|
||||
"expect": "pass"
|
||||
}
|
||||
],
|
||||
"artifactSchemas": [
|
||||
@@ -2200,7 +2205,8 @@
|
||||
"id": "FE-GATE-027",
|
||||
"name": "release-admission",
|
||||
"commandIds": [
|
||||
"check-release-admission"
|
||||
"check-release-admission",
|
||||
"scan-dependency-advisories"
|
||||
],
|
||||
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-027-txt",
|
||||
"evidenceArtifactIds": [
|
||||
|
||||
@@ -476,6 +476,18 @@ Repository variables required by higher tiers:
|
||||
job runs FE-GATE-015 and then FE-GATE-027, and FE-GATE-027 refuses the
|
||||
candidate when `APP_PROFILE` is set and differs from `RELEASE_TARGET`. Both are
|
||||
repository-wide variables, so set them together for each release.
|
||||
FE-GATE-027 then runs `scan:dependency-advisories` (1103/13-03). It applies
|
||||
`config/security/vulnerability-policy.json` and its exceptions to the
|
||||
registry's advisory report for the lockfile (pnpm's audit command with
|
||||
`--json`) and writes the result to the gate log
|
||||
and `artifacts/security/dependency-advisories.json`: `PASS`,
|
||||
`POLICY_VIOLATION` (what the production promotion would refuse, with the
|
||||
findings) or `UNVERIFIED` (no registry). It never fails the gate, because an
|
||||
advisory database that changes under unchanged code would break releases;
|
||||
the signed verdict of the vulnerability provider still decides promotion.
|
||||
`renovate.json` opens security update PRs once a Renovate runner is attached;
|
||||
a dependency update re-approves the dependency baseline in the same change
|
||||
(`update:dependency-baseline`).
|
||||
- `FIELD_WEB_VITALS_INPUT` for the privacy-approved field sample document
|
||||
- `MIN_ELIGIBLE_SAMPLES` after the baseline decision
|
||||
- `VULNERABILITY_PROVIDER_COMMAND` and `PROVENANCE_PROVIDER_COMMAND` for the
|
||||
@@ -484,6 +496,17 @@ Repository variables required by higher tiers:
|
||||
`PROVENANCE_PUBLIC_KEY_PATH`, and `PROVENANCE_KEY_ID` for separately managed
|
||||
trusted Ed25519 verification material
|
||||
|
||||
Advisories at or above the policy's `high` that `scan:dependency-advisories`
|
||||
reports for this lockfile, checked 2026-11-04 (review 1103/13-03). Check again
|
||||
by 2026-12-04 or when the update below is made. The development-only ones
|
||||
(storybook, vite, vitest, undici, brace-expansion, nanoid, source-map-js) were
|
||||
updated within their declared ranges and are gone.
|
||||
|
||||
| Advisory | Package | Fixed in | Why it is not updated yet |
|
||||
|---|---|---|---|
|
||||
| GHSA-mrhx-c7xc-m3w5 (high) | `zod` 4.4.3 (production) | 4.6.6 | A direct production upgrade needs a `config/security/dependency-change-evidence.json` entry whose reviewer is not its owner. 4.6.7 also adds about 7 KB gzip of initial JavaScript, over the bundle budget, so the update needs a budget decision as well. The app reads HTTP bodies with a byte limit, which narrows the large-collection input the advisory needs (review estimate) |
|
||||
| GHSA-qwww-vcr4-c8h2 (high) | `react-router` 7.18.1, through `react-router-dom` (production) | 7.18.2 | Same evidence rule. The advisory concerns RSC mode, which this browser-router SPA does not use (review estimate, not verified). 7.18.5 adds about 470 B of initial JavaScript |
|
||||
|
||||
두 provider role은 서로 다른 key ID뿐 아니라 canonical DER-SPKI public-key bytes도
|
||||
사용해야 한다. 동일 key를 서로 다른 ID로 재등록한 구성도 finalizer가 거절한다.
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"check:adapter-inventory": "node scripts/check-adapter-inventory.ts",
|
||||
"check:remediation-ledger": "node scripts/check-remediation-ledger.ts",
|
||||
"check:release-admission": "node scripts/generate-product-feature-index.ts && node scripts/check-release-admission.ts",
|
||||
"scan:dependency-advisories": "node scripts/scan-dependency-advisories.ts",
|
||||
"check:diagnostics": "node scripts/generate-product-feature-index.ts && node scripts/check-diagnostics.ts",
|
||||
"check:diagnostics:fixture": "node scripts/generate-product-feature-index.ts && node scripts/check-diagnostics.ts --fixture",
|
||||
"check:types": "corepack pnpm check:types:app && corepack pnpm check:types:node && corepack pnpm check:types:test && corepack pnpm check:types:recipes && corepack pnpm check:types:web-worker && corepack pnpm check:types:service-worker",
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"description": [
|
||||
"Review 1103/13-03: dependency security updates. The template had no update automation, so a known advisory stayed in every copy until someone ran pnpm audit by hand.",
|
||||
"Inert until a Renovate runner is attached to the Gitea instance; the release-stage signal is `corepack pnpm scan:dependency-advisories` (FE-GATE-027).",
|
||||
"Renovate regenerates pnpm-lock.yaml. A maintainer re-approves the dependency baseline in the same PR (`DEPENDENCY_BASELINE_OWNER=... DEPENDENCY_BASELINE_REASON=... corepack pnpm update:dependency-baseline`) and reviews the inventory diff before the PR can merge.",
|
||||
"Versions stay exact (pnpm-workspace.yaml saveExact) and a release must be a day old, the pnpm minimumReleaseAge default."
|
||||
],
|
||||
"extends": [
|
||||
"config:recommended",
|
||||
"security:only-security-updates"
|
||||
],
|
||||
"rangeStrategy": "pin",
|
||||
"minimumReleaseAge": "1 day",
|
||||
"vulnerabilityAlerts": {
|
||||
"description": "A vulnerability alert opens a security PR at once, ignoring the schedule.",
|
||||
"enabled": true,
|
||||
"labels": [
|
||||
"security",
|
||||
"dependencies"
|
||||
]
|
||||
},
|
||||
"osvVulnerabilityAlerts": true,
|
||||
"packageRules": [
|
||||
{
|
||||
"description": "Every update is reviewed and merged by a person after the merge gates pass.",
|
||||
"matchUpdateTypes": [
|
||||
"patch",
|
||||
"pin",
|
||||
"digest",
|
||||
"minor",
|
||||
"major"
|
||||
],
|
||||
"automerge": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
import { validateVulnerabilityReport } from "./supply-chain.ts";
|
||||
|
||||
/**
|
||||
* 1103/13-03. The vulnerability verdict belongs to the external provider of
|
||||
* the production promotion (signed, independent of the build). Without a
|
||||
* provider nothing told the project that its lockfile already broke the
|
||||
* template's own policy (high and above, no exception). This summary is the
|
||||
* early signal: it reads `pnpm audit --json` and applies that policy, so it
|
||||
* names what the promotion would refuse. It does not replace the provider and
|
||||
* blocks nothing.
|
||||
*/
|
||||
export type AdvisoryStatus = "PASS" | "POLICY_VIOLATION" | "UNVERIFIED";
|
||||
type Severity = "critical" | "high" | "moderate" | "low" | "info";
|
||||
type SeverityCounts = Record<Severity, number>;
|
||||
|
||||
export type DependencyAdvisorySummary = Readonly<{
|
||||
status: AdvisoryStatus;
|
||||
reason: string | null;
|
||||
counts: Readonly<{ production: SeverityCounts; development: SeverityCounts }>;
|
||||
/** Findings the vulnerability policy would block at promotion: `id:package@version:severity`. */
|
||||
blocking: readonly string[];
|
||||
advisories: readonly Readonly<{
|
||||
id: string;
|
||||
packageName: string;
|
||||
versions: readonly string[];
|
||||
severity: string;
|
||||
development: boolean;
|
||||
patchedVersions: string;
|
||||
}>[];
|
||||
}>;
|
||||
|
||||
const SEVERITIES: readonly Severity[] = ["critical", "high", "moderate", "low", "info"];
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function emptyCounts(): SeverityCounts {
|
||||
return { critical: 0, high: 0, moderate: 0, low: 0, info: 0 };
|
||||
}
|
||||
|
||||
export function summarizeDependencyAdvisories(
|
||||
audit: unknown,
|
||||
policy: Readonly<Record<string, unknown>>,
|
||||
exceptions: Readonly<Record<string, unknown>>,
|
||||
lockfileSha256: string,
|
||||
now: Date = new Date(),
|
||||
): DependencyAdvisorySummary {
|
||||
const counts = { production: emptyCounts(), development: emptyCounts() };
|
||||
if (!isRecord(audit) || !isRecord(audit["advisories"]) || !isRecord(audit["metadata"])) {
|
||||
return {
|
||||
status: "UNVERIFIED",
|
||||
reason: "pnpm audit returned no advisory report (network or registry unavailable)",
|
||||
counts,
|
||||
blocking: [],
|
||||
advisories: [],
|
||||
};
|
||||
}
|
||||
const advisories = Object.values(audit["advisories"]).filter(isRecord).map((advisory) => {
|
||||
const findings = Array.isArray(advisory["findings"]) ? advisory["findings"].filter(isRecord) : [];
|
||||
return {
|
||||
id: String(advisory["github_advisory_id"] ?? advisory["id"] ?? "unknown"),
|
||||
packageName: String(advisory["module_name"] ?? "unknown"),
|
||||
versions: findings.map((finding) => String(finding["version"] ?? "unknown")),
|
||||
severity: String(advisory["severity"] ?? "unknown").toLowerCase(),
|
||||
// A package reached only through development dependencies never ships.
|
||||
development: findings.length > 0 && findings.every((finding) => finding["dev"] === true),
|
||||
patchedVersions: String(advisory["patched_versions"] ?? ""),
|
||||
};
|
||||
});
|
||||
for (const advisory of advisories) {
|
||||
const scope = advisory.development ? counts.development : counts.production;
|
||||
if ((SEVERITIES as readonly string[]).includes(advisory.severity)) scope[advisory.severity as Severity] += 1;
|
||||
}
|
||||
const verdict = validateVulnerabilityReport(
|
||||
{
|
||||
provider: "pnpm-audit (local, not the promotion provider)",
|
||||
scannedLockfileSha256: lockfileSha256,
|
||||
findings: advisories.flatMap((advisory) =>
|
||||
advisory.versions.map((version) => ({
|
||||
id: advisory.id,
|
||||
packageName: advisory.packageName,
|
||||
version,
|
||||
severity: advisory.severity,
|
||||
})),
|
||||
),
|
||||
},
|
||||
policy,
|
||||
exceptions,
|
||||
lockfileSha256,
|
||||
now,
|
||||
);
|
||||
return {
|
||||
status: verdict.blocking.length > 0 ? "POLICY_VIOLATION" : "PASS",
|
||||
reason: null,
|
||||
counts,
|
||||
blocking: verdict.blocking,
|
||||
advisories,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
|
||||
import { summarizeDependencyAdvisories } from "./lib/dependency-advisories.ts";
|
||||
|
||||
/**
|
||||
* 1103/13-03. Release-stage signal for known dependency advisories
|
||||
* (FE-GATE-027, next to the release admission of the candidate). It runs
|
||||
* `pnpm audit --json` over the lockfile and applies
|
||||
* config/security/vulnerability-policy.json with its exceptions, the policy the
|
||||
* production promotion provider is held to. The result is a line in the gate
|
||||
* log and artifacts/security/dependency-advisories.json.
|
||||
*
|
||||
* It never fails the gate. An advisory database that changes under unchanged
|
||||
* code would otherwise break a release run, and without the registry the
|
||||
* result is UNVERIFIED, not PASS. The signed verdict of the vulnerability
|
||||
* provider stays the only one that decides a promotion.
|
||||
*/
|
||||
const RECORD_PATH = "artifacts/security/dependency-advisories.json";
|
||||
|
||||
const [policy, exceptions, lockfile] = await Promise.all([
|
||||
readFile("config/security/vulnerability-policy.json", "utf8").then((text) => JSON.parse(text) as Record<string, unknown>),
|
||||
readFile("config/security/vulnerability-exceptions.json", "utf8").then((text) => JSON.parse(text) as Record<string, unknown>),
|
||||
readFile("pnpm-lock.yaml"),
|
||||
]);
|
||||
const lockfileSha256 = createHash("sha256").update(lockfile).digest("hex");
|
||||
|
||||
// pnpm audit exits 1 when it finds advisories; the JSON on stdout is the result.
|
||||
const run = spawnSync("corepack", ["pnpm", "audit", "--json"], {
|
||||
encoding: "utf8",
|
||||
maxBuffer: 64 * 1024 * 1024,
|
||||
timeout: 120_000,
|
||||
});
|
||||
let audit: unknown;
|
||||
try {
|
||||
audit = JSON.parse(run.stdout ?? "");
|
||||
} catch {
|
||||
audit = null;
|
||||
}
|
||||
const summary = summarizeDependencyAdvisories(audit, policy, exceptions, lockfileSha256);
|
||||
|
||||
await mkdir("artifacts/security", { recursive: true });
|
||||
await writeFile(
|
||||
RECORD_PATH,
|
||||
`${JSON.stringify(
|
||||
{
|
||||
schemaVersion: 1,
|
||||
generatedAt: new Date().toISOString(),
|
||||
source: "pnpm audit --json",
|
||||
authoritative: false,
|
||||
lockfileSha256,
|
||||
blockAtSeverity: policy["blockAtSeverity"] ?? null,
|
||||
...summary,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
)}\n`,
|
||||
);
|
||||
|
||||
const count = (scope: Readonly<Record<string, number>>) =>
|
||||
`critical ${scope["critical"]}, high ${scope["high"]}, moderate ${scope["moderate"]}, low ${scope["low"]}`;
|
||||
process.stdout.write(
|
||||
`Dependency advisories: ${summary.status} (production: ${count(summary.counts.production)}; ` +
|
||||
`development: ${count(summary.counts.development)}); record at ${RECORD_PATH}. ` +
|
||||
"Not blocking: the production promotion provider decides.\n",
|
||||
);
|
||||
if (summary.status === "POLICY_VIOLATION") {
|
||||
process.stderr.write(
|
||||
`WARNING: the vulnerability policy (block at ${String(policy["blockAtSeverity"])}) would refuse this lockfile at production promotion:\n` +
|
||||
summary.blocking.map((finding) => ` ${finding}\n`).join("") +
|
||||
"Update the dependency or record a reviewed exception in config/security/vulnerability-exceptions.json.\n",
|
||||
);
|
||||
}
|
||||
if (summary.status === "UNVERIFIED") {
|
||||
process.stderr.write(`WARNING: dependency advisories UNVERIFIED: ${summary.reason}\n`);
|
||||
}
|
||||
@@ -195,8 +195,8 @@ describe("CI gate contract", () => {
|
||||
).filter((gateId) => gateId !== "FE-GATE-016"),
|
||||
);
|
||||
expect(contract.jobs).toHaveLength(10);
|
||||
expect(contract.commands).toHaveLength(99);
|
||||
expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(103);
|
||||
expect(contract.commands).toHaveLength(100);
|
||||
expect(contract.gates.reduce((total, gate) => total + gate.commandIds.length, 0)).toBe(104);
|
||||
expect(contract.commands.filter(({ expect }) => expect === "fail")).toHaveLength(30);
|
||||
expect(contract.gates.reduce((total, gate) => total + gate.evidenceArtifactIds.length, 0)).toBe(88);
|
||||
expect(contract.artifacts).toHaveLength(110);
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { summarizeDependencyAdvisories } from "../../scripts/lib/dependency-advisories.ts";
|
||||
|
||||
/**
|
||||
* 1103/13-03. The lockfile broke the template's own vulnerability policy
|
||||
* (high and above, no exception) and nothing said so before the production
|
||||
* promotion provider, which a template copy may not have. The summary applies
|
||||
* that policy to `pnpm audit --json`.
|
||||
*/
|
||||
const POLICY = { blockAtSeverity: "high" };
|
||||
const NO_EXCEPTIONS = { schemaVersion: 1, exceptions: [] };
|
||||
const LOCKFILE = "a".repeat(64);
|
||||
|
||||
const advisory = (
|
||||
id: string,
|
||||
module: string,
|
||||
severity: string,
|
||||
findings: readonly Readonly<{ version: string; dev: boolean }>[],
|
||||
) => ({
|
||||
github_advisory_id: id,
|
||||
module_name: module,
|
||||
severity,
|
||||
patched_versions: ">=9.9.9",
|
||||
findings: findings.map((finding) => ({ ...finding, paths: [`.>${module}`] })),
|
||||
});
|
||||
const audit = (...advisories: ReturnType<typeof advisory>[]) => ({
|
||||
advisories: Object.fromEntries(advisories.map((entry, index) => [String(index), entry])),
|
||||
metadata: { vulnerabilities: {} },
|
||||
});
|
||||
|
||||
describe("dependency advisory summary (1103/13-03)", () => {
|
||||
it("names what the policy would block at promotion, in production and development", () => {
|
||||
const summary = summarizeDependencyAdvisories(
|
||||
audit(
|
||||
advisory("GHSA-prod-high", "zod", "high", [{ version: "4.4.3", dev: false }]),
|
||||
advisory("GHSA-dev-critical", "storybook", "critical", [{ version: "10.5.4", dev: true }]),
|
||||
advisory("GHSA-dev-moderate", "postcss", "moderate", [{ version: "8.5.22", dev: true }]),
|
||||
),
|
||||
POLICY,
|
||||
NO_EXCEPTIONS,
|
||||
LOCKFILE,
|
||||
);
|
||||
expect(summary.status).toBe("POLICY_VIOLATION");
|
||||
expect(summary.blocking).toEqual([
|
||||
"GHSA-prod-high:zod@4.4.3:high",
|
||||
"GHSA-dev-critical:storybook@10.5.4:critical",
|
||||
]);
|
||||
expect(summary.counts.production).toMatchObject({ high: 1, critical: 0 });
|
||||
expect(summary.counts.development).toMatchObject({ critical: 1, moderate: 1 });
|
||||
});
|
||||
|
||||
it("passes when nothing reaches the blocking severity", () => {
|
||||
const summary = summarizeDependencyAdvisories(
|
||||
audit(advisory("GHSA-dev-moderate", "postcss", "moderate", [{ version: "8.5.22", dev: true }])),
|
||||
POLICY,
|
||||
NO_EXCEPTIONS,
|
||||
LOCKFILE,
|
||||
);
|
||||
expect(summary).toMatchObject({ status: "PASS", blocking: [] });
|
||||
});
|
||||
|
||||
it("honours a valid exception the way the promotion verdict does", () => {
|
||||
const exceptions = {
|
||||
schemaVersion: 1,
|
||||
exceptions: [
|
||||
{
|
||||
vulnerabilityId: "GHSA-prod-high",
|
||||
packageName: "zod",
|
||||
owner: "frontend-platform",
|
||||
reviewer: "security-review",
|
||||
reason: "not reachable",
|
||||
expiresAt: "2027-01-01T00:00:00.000Z",
|
||||
},
|
||||
],
|
||||
};
|
||||
expect(
|
||||
summarizeDependencyAdvisories(
|
||||
audit(advisory("GHSA-prod-high", "zod", "high", [{ version: "4.4.3", dev: false }])),
|
||||
POLICY,
|
||||
exceptions,
|
||||
LOCKFILE,
|
||||
new Date("2026-11-04T00:00:00.000Z"),
|
||||
),
|
||||
).toMatchObject({ status: "PASS", blocking: [] });
|
||||
});
|
||||
|
||||
it("is UNVERIFIED, not PASS, when the audit returned no report", () => {
|
||||
for (const output of [null, {}, { error: { code: "ENOTFOUND" } }]) {
|
||||
expect(summarizeDependencyAdvisories(output, POLICY, NO_EXCEPTIONS, LOCKFILE)).toMatchObject({
|
||||
status: "UNVERIFIED",
|
||||
reason: expect.stringContaining("pnpm audit"),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("runs at release admission (FE-GATE-027) and never fails the gate by itself", async () => {
|
||||
const contract = JSON.parse(await readFile("config/ci/gates.json", "utf8")) as {
|
||||
gates: { id: string; commandIds: string[] }[];
|
||||
commands: { id: string; script: string }[];
|
||||
};
|
||||
const scripts = (contract.gates.find(({ id }) => id === "FE-GATE-027")?.commandIds ?? []).map(
|
||||
(commandId) => contract.commands.find(({ id }) => id === commandId)?.script,
|
||||
);
|
||||
expect(scripts).toEqual(["check:release-admission", "scan:dependency-advisories"]);
|
||||
const source = await readFile("scripts/scan-dependency-advisories.ts", "utf8");
|
||||
expect(source).not.toMatch(/process\.exit(?:Code)?\s*(?:=|\()\s*[1-9]/u);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user