Skip to content

Commit 25bc300

Browse files
committed
[red] Guard active Nginx configuration parity
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th>
1 parent 6b6e1c2 commit 25bc300

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎tools/web/src/test/vps-deployment-contract.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,29 @@ describe("Cloudflare-fronted VPS deployment", () => {
8989
expect(headers).toContain("Strict-Transport-Security");
9090
});
9191

92+
it("refuses deployment when active Nginx contracts differ from source", async () => {
93+
const script = await readFile(
94+
join(deploymentRoot, "vps", "deploy.sh"),
95+
"utf8",
96+
);
97+
const parityIndex = script.indexOf("verify_remote_runtime_config");
98+
const buildIndex = script.indexOf("NEXT_TELEMETRY_DISABLED=1 npm run check");
99+
const uploadIndex = script.search(/\brsync\b/);
100+
101+
expect(parityIndex).toBeGreaterThan(-1);
102+
expect(parityIndex).toBeLessThan(buildIndex);
103+
expect(parityIndex).toBeLessThan(uploadIndex);
104+
expect(script).toContain(
105+
"/etc/nginx/sites-available/10-pyble-dev-https.conf",
106+
);
107+
expect(script).toContain(
108+
"/etc/nginx/snippets/pyble-security-headers.conf",
109+
);
110+
expect(script).toMatch(
111+
/verify_remote_runtime_config\(\)[\s\S]*?shasum[\s\S]*?ssh[\s\S]*?sha256sum[\s\S]*?(?:mismatch|differs)/i,
112+
);
113+
});
114+
92115
it("keeps firmware 404 responses non-cacheable through the shared error page", async () => {
93116
const config = await readFile(
94117
join(deploymentRoot, "nginx", "10-pyble-dev-https.conf"),

0 commit comments

Comments
 (0)