Skip to content

Commit a25eaf9

Browse files
committed
[red] Quarantine exposed pending firmware
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th> (cherry picked from commit 1dca8153e93b206e6438f19ae11323ec349c2bb2)
1 parent 2e026ec commit a25eaf9

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

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

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

92+
it("quarantines the burned pre-public firmware candidate", async () => {
93+
const config = await readFile(
94+
join(deploymentRoot, "nginx", "10-pyble-dev-https.conf"),
95+
"utf8",
96+
);
97+
const quarantine =
98+
/location \^~ \/firmware\/v0\.4\.1\/\s*\{([\s\S]*?)\n\s*\}/.exec(
99+
config,
100+
)?.[1];
101+
const quarantineIndex = config.indexOf(
102+
"location ^~ /firmware/v0.4.1/",
103+
);
104+
const generalFirmwareIndex = config.indexOf("location ^~ /firmware/ {");
105+
106+
expect(quarantine).toBeDefined();
107+
expect.soft(quarantine).toMatch(/Cache-Control\s+"no-store"/);
108+
expect.soft(quarantine).toMatch(/return\s+404/);
109+
expect(quarantineIndex).toBeGreaterThan(-1);
110+
expect(quarantineIndex).toBeLessThan(generalFirmwareIndex);
111+
});
112+
92113
it("preserves path and query while canonicalizing every alternate host", async () => {
93114
const [httpConfig, devConfig, orgConfig] = await Promise.all([
94115
readFile(join(deploymentRoot, "nginx", "00-pyble-http.conf"), "utf8"),

0 commit comments

Comments
 (0)