惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
Engineering at Meta
Engineering at Meta
I
InfoQ
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 【当耐特】
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
腾讯CDC
雷峰网
雷峰网
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
D
Docker

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: allow trusted-proxy local password fallback · opencl...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -902,6 +902,9 @@ describe("trusted-proxy auth", () => {

902902

function authorizeLocalDirect(options?: {

903903

token?: string;

904904

connectToken?: string;

905+

password?: string;

906+

connectPassword?: string;

907+

rateLimiter?: AuthRateLimiter;

905908

trustedProxy?: GatewayConnectInput["auth"]["trustedProxy"];

906909

trustedProxies?: string[];

907910

}) {

@@ -913,8 +916,13 @@ describe("trusted-proxy auth", () => {

913916

? { trustedProxy: options?.trustedProxy }

914917

: { trustedProxy: trustedProxyConfig }),

915918

token: options?.token,

919+

password: options?.password, // pragma: allowlist secret

916920

},

917-

connectAuth: options?.connectToken ? { token: options.connectToken } : null,

921+

connectAuth:

922+

options?.connectToken || options?.connectPassword

923+

? { token: options.connectToken, password: options.connectPassword }

924+

: null,

925+

rateLimiter: options?.rateLimiter,

918926

trustedProxies: options?.trustedProxies ?? ["127.0.0.1"],

919927

req: {

920928

socket: { remoteAddress: "127.0.0.1" },

@@ -956,6 +964,67 @@ describe("trusted-proxy auth", () => {

956964

expect(res.reason).toBe("trusted_proxy_loopback_source");

957965

});

958966967+

it("accepts local-direct password fallback when trusted-proxy auth fails", async () => {

968+

const limiter = createLimiterSpy();

969+

const res = await authorizeLocalDirect({

970+

password: "local-password", // pragma: allowlist secret

971+

connectPassword: "local-password", // pragma: allowlist secret

972+

rateLimiter: limiter,

973+

});

974+975+

expect(res).toEqual({ ok: true, method: "password" });

976+

expect(limiter.check).toHaveBeenCalledWith("127.0.0.1", "shared-secret");

977+

expect(limiter.reset).toHaveBeenCalledWith("127.0.0.1", "shared-secret");

978+

expect(limiter.recordFailure).not.toHaveBeenCalled();

979+

});

980+981+

it("rejects wrong local-direct password fallback and records the failure", async () => {

982+

const limiter = createLimiterSpy();

983+

const res = await authorizeLocalDirect({

984+

password: "local-password", // pragma: allowlist secret

985+

connectPassword: "wrong-password", // pragma: allowlist secret

986+

rateLimiter: limiter,

987+

});

988+989+

expect(res).toEqual({ ok: false, reason: "password_mismatch" });

990+

expect(limiter.check).toHaveBeenCalledWith("127.0.0.1", "shared-secret");

991+

expect(limiter.recordFailure).toHaveBeenCalledWith("127.0.0.1", "shared-secret");

992+

expect(limiter.reset).not.toHaveBeenCalled();

993+

});

994+995+

it("enforces rate-limit lockout before local-direct password fallback", async () => {

996+

const limiter = createLimiterSpy();

997+

limiter.check.mockReturnValueOnce({

998+

allowed: false,

999+

remaining: 0,

1000+

retryAfterMs: 2500,

1001+

});

1002+1003+

const res = await authorizeLocalDirect({

1004+

password: "local-password", // pragma: allowlist secret

1005+

connectPassword: "local-password", // pragma: allowlist secret

1006+

rateLimiter: limiter,

1007+

});

1008+1009+

expect(res).toEqual({

1010+

ok: false,

1011+

reason: "rate_limited",

1012+

rateLimited: true,

1013+

retryAfterMs: 2500,

1014+

});

1015+

expect(limiter.recordFailure).not.toHaveBeenCalled();

1016+

expect(limiter.reset).not.toHaveBeenCalled();

1017+

});

1018+1019+

it("keeps local-direct trusted-proxy on proxy failure when no password is supplied", async () => {

1020+

const res = await authorizeLocalDirect({

1021+

password: "local-password", // pragma: allowlist secret

1022+

});

1023+1024+

expect(res.ok).toBe(false);

1025+

expect(res.reason).toBe("trusted_proxy_loopback_source");

1026+

});

1027+9591028

it("rejects trusted-proxy identity headers from loopback sources", async () => {

9601029

const res = await authorizeGatewayConnect({

9611030

auth: {

@@ -984,9 +1053,9 @@ describe("trusted-proxy auth", () => {

9841053

mode: "trusted-proxy",

9851054

allowTailscale: false,

9861055

trustedProxy: trustedProxyConfig,

987-

token: "secret",

1056+

password: "secret", // pragma: allowlist secret

9881057

},

989-

connectAuth: null,

1058+

connectAuth: { password: "secret" },

9901059

trustedProxies: ["127.0.0.1"],

9911060

req: {

9921061

socket: { remoteAddress: "127.0.0.1" },

@@ -1048,8 +1117,8 @@ describe("trusted-proxy auth", () => {

1048111710491118

it("still fails closed when trusted-proxy config is missing", async () => {

10501119

const res = await authorizeLocalDirect({

1051-

token: "secret",

1052-

connectToken: "secret",

1120+

password: "secret", // pragma: allowlist secret

1121+

connectPassword: "secret", // pragma: allowlist secret

10531122

trustedProxy: undefined,

10541123

});

10551124

expect(res.ok).toBe(false);

@@ -1058,8 +1127,8 @@ describe("trusted-proxy auth", () => {

1058112710591128

it("still fails closed when trusted proxies are not configured", async () => {

10601129

const res = await authorizeLocalDirect({

1061-

token: "secret",

1062-

connectToken: "secret",

1130+

password: "secret", // pragma: allowlist secret

1131+

connectPassword: "secret", // pragma: allowlist secret

10631132

trustedProxies: [],

10641133

});

10651134

expect(res.ok).toBe(false);