Skip to content

fix(server): restore getClientIp helper for secret-proxy#694

Merged
buremba merged 1 commit into
mainfrom
fix/restore-getclientip
May 13, 2026
Merged

fix(server): restore getClientIp helper for secret-proxy#694
buremba merged 1 commit into
mainfrom
fix/restore-getclientip

Conversation

@buremba
Copy link
Copy Markdown
Member

@buremba buremba commented May 13, 2026

Summary

Test plan

  • bun run typecheck clean
  • bun run check:fix clean
  • Local make dev boots and /dev/devices renders + GET /api/me/devices returns 200 with the bootstrap PAT
  • Prod deploy boots cleanly and app.lobu.ai/<owner>/devices loads

#672 deleted getClientIp from rate-limiter.ts as dead code; #692
(hardening sweep) then added an import + call to it in
secret-proxy.ts. The gateway fails to boot from source with
"SyntaxError: ...does not provide an export named 'getClientIp'",
and the prod bundle would silently call undefined() on the legacy
header-swap path. Restore the helper.

Also fix biome noEmptyBlockStatements lint errors in
command-registry.test.ts (10 mock(async () => {}) bodies, all from
#685) — these blocked the pre-commit hook on main.
@buremba buremba merged commit 0faa2f7 into main May 13, 2026
9 of 14 checks passed
@buremba buremba deleted the fix/restore-getclientip branch May 13, 2026 14:05
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1a4e41f94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +7 to +9
const forwarded = headers.forwardedFor?.split(",")[0]?.trim().toLowerCase();
if (forwarded) {
return forwarded;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not trust worker-supplied X-Forwarded-For

When the legacy secret-swap path has no /a/{agentId} in the URL, secret-proxy uses this value as the source for ResolutionFailureLimiter; but worker requests can supply arbitrary x-forwarded-for values, and the gateway HTTP proxy copies request headers through unchanged (forwardHeaders = { ...req.headers }). In that scenario, a compromised worker probing bogus lobu_secret_* placeholders can rotate this header to get a fresh bucket each time and avoid the 20-failure throttle entirely, so the restored helper should not key security limits on an untrusted forwarded header unless it is set/validated by a trusted proxy layer.

Useful? React with 👍 / 👎.

buremba added a commit that referenced this pull request May 13, 2026
PR #694 restored the helper, but the merge of #693 left an earlier copy
intact — esbuild errors out on `Multiple exports with the same name
"getClientIp"` in src/gateway/utils/rate-limiter.ts, breaking
`make build-packages` on main (typecheck + integration CI jobs cascade
from there). Drop the older un-documented copy; keep the JSDoc'd one.

No behavior change — the two implementations were functionally identical.
buremba added a commit that referenced this pull request May 13, 2026
PR #694 restored the helper, but the merge of #693 left an earlier copy
intact — esbuild errors out on `Multiple exports with the same name
"getClientIp"` in src/gateway/utils/rate-limiter.ts, breaking
`make build-packages` on main (typecheck + integration CI jobs cascade
from there). Drop the older un-documented copy; keep the JSDoc'd one.

No behavior change — the two implementations were functionally identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant