mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
fix(homepage): check allowlisted private service reachability (#1479)
* fix(homepage): check allowlisted private service reachability * test(css): exercise the configured PostCSS plugin chain
This commit is contained in:
1 parent
3b9a1bacf0
commit
2824b49ba9
11 files changed
+232
-10
No files matched your search
@@ -281,3 +281,38 @@ describe("safeOutboundFetch", () => {
|
||||
}
|
||||
}, 10_000);
|
||||
});
|
||||
|
||||
describe("redirect handling", () => {
|
||||
it.each([undefined, "error", "follow", "manual"] as const)(
|
||||
"never follows redirects with mode %s",
|
||||
async (redirect) => {
|
||||
const paths: string[] = [];
|
||||
const server = createServer((req, res) => {
|
||||
paths.push(req.url!);
|
||||
res.writeHead(302, { Location: "/private-target" });
|
||||
res.end();
|
||||
});
|
||||
await new Promise<void>((resolve) =>
|
||||
server.listen(0, "127.0.0.1", resolve),
|
||||
);
|
||||
const { port } = server.address() as AddressInfo;
|
||||
try {
|
||||
const response = safeOutboundFetch(
|
||||
`http://127.0.0.1:${port}/`,
|
||||
{ redirect },
|
||||
["127.0.0.1"],
|
||||
);
|
||||
if (redirect === "manual") {
|
||||
const result = await response;
|
||||
expect(result.status).toBe(302);
|
||||
await result.body?.cancel();
|
||||
} else {
|
||||
await expect(response).rejects.toThrow();
|
||||
}
|
||||
expect(paths).toEqual(["/"]);
|
||||
} finally {
|
||||
await new Promise<void>((resolve) => server.close(() => resolve()));
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user