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

推荐订阅源

Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
Vercel News
Vercel News
Martin Fowler
Martin Fowler
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LangChain Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
Google DeepMind News
Google DeepMind News
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs

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(gateway): allow trusted-proxy local-direct password f...
joshavant · 2026-05-17 · via Recent Commits to openclaw:main

@@ -144,6 +144,7 @@ describe("gateway auth", () => {

144144

{ name: "X-Forwarded-For", headers: { "x-forwarded-for": "203.0.113.10" } },

145145

{ name: "X-Forwarded-Proto", headers: { "x-forwarded-proto": "https" } },

146146

{ name: "X-Forwarded-Host", headers: { "x-forwarded-host": "gateway.example" } },

147+

{ name: "X-Forwarded-User", headers: { "x-forwarded-user": "nick@example.com" } },

147148

{ name: "X-Real-IP", headers: { "x-real-ip": "203.0.113.10" } },

148149

])("treats $name as forwarded request evidence", ({ headers }) => {

149150

const req = {

@@ -1024,35 +1025,35 @@ describe("trusted-proxy auth", () => {

10241025

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

10251026

});

102610271027-

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

1028+

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

10281029

const limiter = createLimiterSpy();

10291030

const res = await authorizeLocalDirect({

10301031

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

10311032

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

10321033

rateLimiter: limiter,

10331034

});

103410351035-

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

1036-

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

1037-

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

1036+

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

1037+

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

1038+

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

10381039

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

10391040

});

104010411041-

it("ignores wrong local-direct password credentials when trusted-proxy auth fails", async () => {

1042+

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

10421043

const limiter = createLimiterSpy();

10431044

const res = await authorizeLocalDirect({

10441045

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

10451046

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

10461047

rateLimiter: limiter,

10471048

});

104810491049-

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

1050-

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

1051-

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

1050+

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

1051+

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

1052+

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

10521053

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

10531054

});

105410551055-

it("does not apply shared-secret rate limits to trusted-proxy failures", async () => {

1056+

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

10561057

const limiter = createLimiterSpy();

10571058

limiter.check.mockReturnValueOnce({

10581059

allowed: false,

@@ -1066,12 +1067,29 @@ describe("trusted-proxy auth", () => {

10661067

rateLimiter: limiter,

10671068

});

106810691069-

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

1070-

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

1070+

expect(res).toEqual({

1071+

ok: false,

1072+

reason: "rate_limited",

1073+

rateLimited: true,

1074+

retryAfterMs: 2500,

1075+

});

10711076

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

10721077

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

10731078

});

107410791080+

it("accepts local-direct password fallback before required-header failure", async () => {

1081+

const res = await authorizeLocalDirect({

1082+

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

1083+

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

1084+

trustedProxy: {

1085+

...trustedProxyConfig,

1086+

allowLoopback: true,

1087+

},

1088+

});

1089+1090+

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

1091+

});

1092+10751093

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

10761094

const res = await authorizeLocalDirect({

10771095

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