Commit Graph

9919 Commits

Author SHA1 Message Date
Nick Taylor
8a0a1a3e66 chore(protocol): regenerate Swift models for authMode 2026-02-14 12:26:01 +01:00
Nick Taylor
8d16861eec chore: removed unnecessary comments 2026-02-14 12:26:01 +01:00
Nick Taylor
c9bdce95f6 chore: fixed lint errors 2026-02-14 12:26:01 +01:00
Nick Taylor
7a5404a4b6 chore: formatting 2026-02-14 12:26:01 +01:00
Nick Taylor
83014d9d09 chore: removed unused code 2026-02-14 12:26:01 +01:00
Nick Taylor
63c1268b2b fix(docker): fix trustedProxies JSON generation and permissions in entrypoint
- Fix invalid JSON array generation (paste + jq instead of tr)
- Create /claw/.openclaw directory in Dockerfile
- Move chown before config commands in entrypoint
- Add jq dependency for robust JSON handling

Fixes critical bugs preventing trusted-proxy auth in Docker deployments.

Part of #1560
2026-02-14 12:26:01 +01:00
Nick Taylor
c37081e612 feat(gateway): implement trusted-proxy auth logic
- Add 'trusted-proxy' to ResolvedGatewayAuthMode
- Add trustedProxy field to ResolvedGatewayAuth
- Add authorizeTrustedProxy() helper function
- Update authorizeGatewayConnect() to handle trusted-proxy mode
- Validate proxy source IP against trustedProxies list
- Support required headers and user allowlist validation

Part of #1560

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Nick Taylor
cd77ee076f docs(gateway): remove misleading Tailscale safety comparison
Changed 'When NOT to Use' section to avoid implying Tailscale is
'safer' than identity-aware proxies like Pomerium.

Pomerium is a security-focused identity-aware proxy - it's not less
safe than Tailscale, just a different approach (multi-user vs personal).

Updated to focus on actual inappropriate use cases:
- No authentication (TLS terminator only)
- Bypass paths exist
- Header handling uncertain
- Single-user scenarios (where Tailscale may be simpler, not safer)
2026-02-14 12:26:01 +01:00
Nick Taylor
4aaae739b3 docs(gateway): update trusted-proxy-auth docs to use OpenClaw name
Changed all references from 'Clawdbot' to 'OpenClaw' and
'clawdbot' to 'openclaw' to reflect the new project name.

Updated:
- Documentation headers and frontmatter
- Configuration examples
- Proxy setup examples (Pomerium, Caddy, nginx, Traefik)
- Command examples (openclaw security audit)
- Domain examples (openclaw.example.com)
2026-02-14 12:26:01 +01:00
Nick Taylor
f691ffcd21 refactor(ui): change to 'Trusted Proxy mode' for clarity
'mode' suffix makes it clearer this is an authentication method,
balancing simplicity with explicit meaning.
2026-02-14 12:26:01 +01:00
Nick Taylor
86e56a29e8 refactor(ui): simplify trusted-proxy text to just 'Trusted Proxy'
Removed '(no token required)' - context makes it obvious.
Clean, minimal, gets the point across.
2026-02-14 12:26:01 +01:00
Nick Taylor
b45330f4c2 refactor(ui): simplify trusted-proxy mode display
Changed from large callout box to simple inline message:
- Keeps same field structure as token/password inputs
- Shows 'Trusted Proxy (no token required)' in muted style
- Much cleaner, less visual clutter
- Maintains 'Gateway Token' label for consistency

Before: Large blue callout with multiple lines of explanation
After: Single line muted text matching UI style
2026-02-14 12:26:01 +01:00
Nick Taylor
f09023cc63 test(gateway): add explicit backward compatibility tests for trusted proxy matching
Added dedicated 'backward compatibility' test suite to verify:
- Exact IP matching still works (no CIDR notation)
- Plain IPs are NOT treated as /32 CIDR (exact match only)
- IPv4-mapped IPv6 normalization preserved (existing normalizeIp behavior)

These tests document that the CIDR matching addition does not break
existing exact-IP configurations and preserves all previous behavior.
2026-02-14 12:26:01 +01:00
Nick Taylor
0ccce67e9f fix(gateway): add CIDR subnet matching for trusted proxies
The isTrustedProxyAddress() function was doing exact IP matching only,
which broke when trustedProxies contained CIDR notation (e.g., '10.42.0.1/24').

Issue: Pomerium connecting from 10.42.0.59 was rejected even though
trustedProxies contained '10.42.0.1/24'.

Root cause: The function used normalizeIp() comparison which stripped
the /24 suffix and compared '10.42.0.1' === '10.42.0.59' (false).

Fix:
- Added ipMatchesCIDR() helper for IPv4 CIDR matching using bit masks
- Updated isTrustedProxyAddress() to check CIDR blocks when proxy
  contains '/' character, otherwise exact IP match
- Supports /0 through /32 prefix lengths
- Validates IP and prefix length format

Tests:
- Exact IP matching (existing behavior)
- CIDR /24, /16, /32 subnet matching
- Mixed exact IPs and CIDR notation in same array
- Edge cases (undefined, empty, invalid CIDR)

This was the ACTUAL bug preventing Docker deployment with Pomerium.
The entrypoint correctly detected and configured trustedProxies with
CIDR notation, but the gateway rejected connections due to this bug.
2026-02-14 12:26:01 +01:00
Nick Taylor
c7871813a7 docs(test): document that runtime config tests cover both validation layers
Added comment to clarify that the lan binding + trusted-proxy test
validates both:
1. CLI startup validation (src/cli/gateway-cli/run.ts line 246)
2. Runtime config validation (src/gateway/server-runtime-config.ts line 99)

Both layers must allow lan binding with trusted-proxy auth mode.
The runtime config test implicitly validates both code paths since
they use the same logic (checking for shared secret).
2026-02-14 12:26:01 +01:00
Nick Taylor
57ae179bbc fix(gateway-cli): allow lan binding with trusted-proxy in CLI startup
There were TWO validations for lan binding without auth:
1. src/gateway/server-runtime-config.ts (FIXED in 563052d)
2. src/cli/gateway-cli/run.ts (THIS FIX)

The CLI startup validation was rejecting lan binding when using
trusted-proxy auth mode because it only checked for token/password.

This is the ACTUAL bug causing the crash loop - the CLI validation
runs before the runtime config validation, so it was failing first.

Fix: Add && resolvedAuthMode !== 'trusted-proxy' to the CLI check
on line 246, matching the fix in server-runtime-config.ts.
2026-02-14 12:26:01 +01:00
Nick Taylor
a9f7069060 test(browser): add tests for trusted-proxy auto-token prevention
Add tests to verify that browser control auth doesn't auto-generate
tokens when gateway.auth.mode is 'trusted-proxy' or 'password'.

Covers:
- Trusted-proxy mode: no token generation
- Password mode: no token generation (even if password unset)
- Token mode: respects existing token
- Test environment: skips auto-generation
2026-02-14 12:26:01 +01:00
Nick Taylor
267ff35e57 fix(browser): prevent auto-token generation from overwriting trusted-proxy auth
The browser control service was auto-generating a gateway.auth.token when
no token/password was detected, even when gateway.auth.mode was set to
'trusted-proxy'. This overwrote the trusted-proxy configuration and
switched the gateway back to token mode.

Fix: Skip auto-token generation when auth mode is 'trusted-proxy',
similar to how it already skips for 'password' mode.

This prevents the browser service from mangling the trusted-proxy config
during startup.
2026-02-14 12:26:01 +01:00
Nick Taylor
befb4d59a8 test(gateway): add tests for trusted-proxy lan binding validation
Add comprehensive tests for gateway runtime config validation:
- Trusted-proxy mode allows lan binding
- Trusted-proxy mode rejects loopback binding
- Trusted-proxy mode requires trustedProxies configured
- Token mode requires token to be set
- Token mode allows lan binding when token is provided

These tests validate the fix for the lan binding validation bug
and prevent regression.
2026-02-14 12:26:01 +01:00
Nick Taylor
702cf6545b fix(gateway): allow lan binding with trusted-proxy auth mode
Critical bug: Gateway startup validation rejected lan binding when using
trusted-proxy auth mode because it only checked for token/password.

The validation on line 99 threw 'refusing to bind gateway to lan without auth'
even when authMode was 'trusted-proxy', because hasSharedSecret is false
for trusted-proxy mode (it doesn't use tokens/passwords).

Fix: Allow lan binding when authMode is 'trusted-proxy' by adding
&& authMode !== 'trusted-proxy' to the condition.

This allows the gateway to start with bind=lan when configured for
trusted-proxy authentication (e.g., behind Pomerium).

Without this fix, users get crash-loop with 'refusing to bind' error
even though trusted-proxy mode is correctly configured.
2026-02-14 12:26:01 +01:00
Nick Taylor
25ed7828f4 refactor(ui): make trusted-proxy callout more concise and mobile-friendly
- Shorten heading: 'Trusted Proxy Auth' (was 'Trusted Proxy Authentication')
- Condense description: Remove redundant text, keep essential info
- Improve mobile readability:
  - Shorter sentences
  - Better line-height for small screens
  - Compact layout without losing clarity
- Use div wrapping instead of <br> for better responsive flow

Before (verbose):
'This gateway is configured for trusted-proxy auth mode.
User identity is managed by your reverse proxy (Pomerium, Caddy, Traefik, etc.).'

After (concise):
'Gateway configured for trusted-proxy mode.
Identity managed by reverse proxy.'

Mobile-tested layout works well on small screens (400px+).
2026-02-14 12:26:01 +01:00
Nick Taylor
d23d26e0b5 feat(ui): hide token/password fields when gateway is in trusted-proxy mode
- Add authMode to gateway snapshot schema (protocol)
- Resolve and expose auth mode in buildGatewaySnapshot()
- Update Control UI overview to conditionally render based on authMode
- When authMode is 'trusted-proxy':
  - Hide Gateway Token field
  - Hide Password field
  - Show informational callout explaining trusted-proxy auth
  - Display auth mode and clarify no token needed
- When authMode is 'token', 'password', or 'none':
  - Show token and password fields as before (unchanged UX)

Benefits:
- Clearer UX: users won't be confused trying to enter tokens
- Security clarity: makes it obvious proxy handles auth
- Better feedback: explains what trusted-proxy mode means

UI shows:
'This gateway is configured for trusted-proxy auth mode.
User identity is managed by your reverse proxy (Pomerium, Caddy, Traefik, etc.).
Auth Mode: trusted-proxy
No gateway token required — authentication handled by proxy'
2026-02-14 12:26:01 +01:00
Nick Taylor
1fc97ebe23 test(cli): add tests for trusted-proxy auth configuration
- Add tests for buildGatewayAuthConfig with trusted-proxy mode
- Test all trusted-proxy options (userHeader, requiredHeaders, allowUsers)
- Test minimal trusted-proxy config (userHeader only)
- Test preserving allowTailscale when switching to trusted-proxy
- Test error when trustedProxy config missing
- Test dropping token/password when switching to trusted-proxy
- Add integration tests for interactive gateway prompting flow
- Test trusted-proxy with all options and with minimal options

Test coverage:
- 5 new tests in configure.gateway-auth.test.ts
- 2 new tests in configure.gateway.test.ts

All tests verify proper handling of the new trusted-proxy auth mode.
2026-02-14 12:26:01 +01:00
Nick Taylor
e1ce11c4b7 feat(cli): add trusted-proxy auth mode to gateway configuration
- Add 'trusted-proxy' option to gateway auth mode selection
- Prompt for trusted-proxy config: userHeader, requiredHeaders, allowUsers
- Prompt for trustedProxies IP list (required for trusted-proxy mode)
- Update buildGatewayAuthConfig to handle trusted-proxy mode
- Add helpful note explaining trusted-proxy use cases and docs link

Enables CLI configuration of trusted-proxy auth during:
- Initial onboarding (openclaw onboard)
- Gateway configuration (openclaw configure)

Example prompts:
- User identity header: x-forwarded-user (default)
- Required headers: x-forwarded-proto,x-forwarded-host (optional)
- Allowed users: nick@example.com,admin@company.com (optional)
- Trusted proxy IPs: 10.0.1.10,192.168.1.5 (required)

Refs: feat/trusted-proxy auth implementation
2026-02-14 12:26:01 +01:00
Nick Taylor
164c2053ee docs(gateway): add trusted-proxy auth documentation
- Explain when to use and when not to use
- Configuration reference with examples
- Pomerium, Caddy, nginx, and Traefik setup guides
- Security checklist
- Troubleshooting guide

Closes #1560

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Nick Taylor
097a2f5bd1 test(security): add trusted-proxy audit tests
- Test trusted-proxy mode flagged as critical
- Test missing trustedProxies finding
- Test missing userHeader finding
- Test empty allowUsers warning
- Fix env isolation for bind_no_auth test

Part of #1560

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Nick Taylor
b4f6e26ae9 test(gateway): add trusted-proxy auth tests
- Test valid request from trusted proxy
- Test rejection of untrusted source
- Test missing user header handling
- Test missing required headers
- Test user allowlist enforcement
- Test Pomerium-style headers
- Test whitespace trimming

Part of #1560

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Nick Taylor
47de0ce1db feat(security): add audit findings for trusted-proxy mode
- Add critical finding when trusted-proxy auth is enabled
- Flag missing trustedProxies configuration
- Flag missing userHeader configuration
- Warn when allowUsers is empty (allows any authenticated user)

Part of #1560

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Nick Taylor
711fb49a98 feat(gateway): update runtime config guard for trusted-proxy
- Allow non-loopback bind with trusted-proxy auth mode
- Reject trusted-proxy + loopback combination (nonsensical)
- Require trustedProxies to be configured for trusted-proxy mode

Part of #1560

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Nick Taylor
f3ec913489 feat(gateway): add trusted-proxy auth mode types and schema
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:26:01 +01:00
Artale
3a330e681b fix(feishu): remove typing indicator on NO_REPLY cleanup (openclaw#15508) thanks @arosstale
Verified:
- pnpm build
- pnpm check
- pnpm test

Co-authored-by: arosstale <117890364+arosstale@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
2026-02-14 05:24:27 -06:00
Peter Steinberger
6182d3ef85 test: increase live-model retry token budget for reasoning-first providers 2026-02-14 12:23:51 +01:00
Pejman Pour-Moezzi
9475791d98 fix: update remaining replyToMode "first" defaults to "off"
- src/channels/dock.ts: core channel dock fallback
- src/auto-reply/reply/reply-routing.test.ts: test expectation
- docs/zh-CN/channels/telegram.md: Chinese docs reference

Comprehensive grep confirms no remaining Telegram-specific "first"
defaults after this commit.
2026-02-13 23:31:17 -08:00
Pejman Pour-Moezzi
c17a109daa fix: align extension plugin and docs with new replyToMode default
Update the Telegram extension channel plugin fallback and documentation
to reflect the new "off" default, as flagged by Greptile review.
2026-02-13 23:31:17 -08:00
Pejman Pour-Moezzi
ad96c126ed fix(telegram): change default replyToMode from "first" to "off"
In 2026.2.13, the combination of implicit reply threading (#14976) and
the existing Telegram default replyToMode="first" causes every bot
response in DMs to be sent as a native Telegram reply (quoted message
bubble), even for simple exchanges like "Hi" → "Hey".

This is a UX regression: prior to 2026.2.13, reply threading was less
consistent so the "first" default rarely produced visible quote bubbles
in DMs. Now that implicit threading works reliably, the default
effectively means every first message in a response gets quoted —
which feels noisy and unexpected in 1:1 conversations.

Changing the default to "off" restores the pre-2026.2.13 DM experience.
Users who want reply threading can still opt in via config:

  channels.telegram.replyToMode: "first" | "all"

Tested by toggling replyToMode on a live 2026.2.13 instance:
- replyToMode="first" → every response quotes the user message
- replyToMode="off" → clean responses without quote bubbles

No test changes needed: existing tests explicitly set replyToMode
rather than relying on the default.
2026-02-13 23:31:17 -08:00
Vignesh Natarajan
4c79a63eb8 fix: default QMD search mode (#16047) (thanks @togotago) 2026-02-13 23:14:34 -08:00
vignesh07
e38ed4f640 fix(memory): default qmd searchMode to search + scope search/vsearch to collections 2026-02-13 23:14:34 -08:00
Peter Steinberger
a50638eead perf(test): disable vector index in OpenAI batch tests 2026-02-14 05:25:40 +00:00
Peter Steinberger
0e5e72edb4 perf(test): shrink memory embedding batch fixtures 2026-02-14 05:25:40 +00:00
Peter Steinberger
98bb4225fd perf(test): minimize gateway startup in vitest 2026-02-14 05:25:40 +00:00
Peter Steinberger
db72184de6 perf(test): speed up Matrix send tests 2026-02-14 05:25:40 +00:00
Tyler Yust
45e12d2388 bluebubbles: gracefully handle disabled private API with action/tool filtering and fallbacks (#16002)
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 243cc0cc9a
Co-authored-by: tyler6204 <243?+tyler6204@users.noreply.github.com>
Co-authored-by: tyler6204 <64381258+tyler6204@users.noreply.github.com>
Reviewed-by: @tyler6204
2026-02-13 21:15:56 -08:00
Peter Steinberger
d8beddc8b7 refactor(onboard): unify auth-choice aliases and provider flags 2026-02-14 05:58:26 +01:00
Peter Steinberger
2f4cef2021 perf(test): remove last-route polling in partial reply gating 2026-02-14 04:57:28 +00:00
Peter Steinberger
4335668d28 chore(test): fix cron every-jobs-fire unused import 2026-02-14 04:57:28 +00:00
Peter Steinberger
e6d5b5fb11 perf(test): remove slow port inspection and reconnect sleeps 2026-02-14 04:57:28 +00:00
Peter Steinberger
1f432ffb93 docs(changelog): clarify Hugging Face support in 2026.2.13 2026-02-14 05:51:52 +01:00
Peter Steinberger
eab9dc538a refactor(onboard): unify auth-choice catalog for CLI help 2026-02-14 05:51:17 +01:00
Peter Steinberger
fdda261478 fix: align NVIDIA provider docs and model ids (#11606) 2026-02-14 05:48:40 +01:00
Gabriel
e0132514f6 fix: needed to use format:fix 2026-02-14 05:48:40 +01:00