mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Security audit: suggest valid gateway.nodes.denyCommands entries (#29713)
Merged via squash.
Prepared head SHA: db23298f98
Co-authored-by: liquidhorizon88-bot <257047709+liquidhorizon88-bot@users.noreply.github.com>
Co-authored-by: grp06 <1573959+grp06@users.noreply.github.com>
Reviewed-by: @grp06
This commit is contained in:
committed by
GitHub
parent
e8cb0484ce
commit
d95cf256e7
@@ -77,9 +77,12 @@ describe("createFeishuWSClient proxy handling", () => {
|
||||
expect(options?.agent).toBeUndefined();
|
||||
});
|
||||
|
||||
it("prefers HTTPS proxy vars over HTTP proxy vars across runtimes", () => {
|
||||
it("uses proxy env precedence: https_proxy first, then HTTPS_PROXY, then http_proxy/HTTP_PROXY", () => {
|
||||
// NOTE: On Windows, environment variables are case-insensitive, so it's not
|
||||
// possible to set both https_proxy and HTTPS_PROXY to different values.
|
||||
// Keep this test cross-platform by asserting precedence via mutually-exclusive
|
||||
// setups.
|
||||
process.env.https_proxy = "http://lower-https:8001";
|
||||
process.env.HTTPS_PROXY = "http://upper-https:8002";
|
||||
process.env.http_proxy = "http://lower-http:8003";
|
||||
process.env.HTTP_PROXY = "http://upper-http:8004";
|
||||
|
||||
@@ -108,6 +111,18 @@ describe("createFeishuWSClient proxy handling", () => {
|
||||
expect(options.agent).toEqual({ proxyUrl: expectedHttpsProxy });
|
||||
});
|
||||
|
||||
it("uses HTTPS_PROXY when https_proxy is unset", () => {
|
||||
process.env.HTTPS_PROXY = "http://upper-https:8002";
|
||||
process.env.http_proxy = "http://lower-http:8003";
|
||||
|
||||
createFeishuWSClient(baseAccount);
|
||||
|
||||
expect(httpsProxyAgentCtorMock).toHaveBeenCalledTimes(1);
|
||||
expect(httpsProxyAgentCtorMock).toHaveBeenCalledWith("http://upper-https:8002");
|
||||
const options = firstWsClientOptions();
|
||||
expect(options.agent).toEqual({ proxyUrl: "http://upper-https:8002" });
|
||||
});
|
||||
|
||||
it("passes HTTP_PROXY to ws client when https vars are unset", () => {
|
||||
process.env.HTTP_PROXY = "http://upper-http:8999";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user