Commit graph

597 commits

Author SHA1 Message Date
Argenis
322f24fd63
fix(tools): add 10 MB file size limit to file_read tool
Security fix: add 10 MB file size limit to file_read tool
2026-02-15 09:38:53 -05:00
Argenis
6899ad4b8e
feat: add GitHub Copilot as a provider
Add support for GitHub Copilot's OpenAI-compatible API at https://api.githubcopilot.com
2026-02-15 09:29:20 -05:00
Argenis
35b63d6b12
feat: SkillForge — automated skill discovery, evaluation & integration engine (#144)
* feat: add SkillForge — automated skill discovery, evaluation, and integration engine

SkillForge adds a 3-stage pipeline for autonomous skill management:

- Scout: discovers candidate skills from GitHub (extensible to ClawHub, HuggingFace)
- Evaluate: scores candidates on compatibility, quality, and security (weighted 0.30/0.35/0.35)
- Integrate: generates standard SKILL.toml + SKILL.md manifests for approved candidates

Thresholds: >=0.7 auto-integrate, 0.4-0.7 manual review, <0.4 skip.
Uses only existing dependencies (reqwest, serde, tokio, tracing, chrono, anyhow).
Includes unit tests for all modules.

* fix: address code review feedback on SkillForge PR #115

- evaluate: whole-word matching for BAD_PATTERNS (fixes hackathon false positive)
- evaluate: guard against future timestamps in recency bonus
- integrate: escape URLs in TOML output via escape_toml()
- integrate: handle control chars (\n, \r, \t, \b, \f) in escape_toml()
- mod: redact github_token in Debug impl to prevent log leakage
- mod: fix auto_integrated count when auto_integrate=false
- mod: per-candidate error handling (single failure no longer aborts pipeline)
- scout: add 30s request timeout, remove unused token field
- deps: enable chrono serde feature for DateTime serialization
- tests: add hackathon/exact-hack tests, update escape_toml test coverage

* fix: address round-2 CodeRabbit review feedback

- integrate: add sanitize_path_component() to prevent directory traversal
- mod: GitHub scout failure now logs warning and continues (no pipeline abort)
- scout: network/parse errors per-query use warn+continue instead of ?
- scout: implement std::str::FromStr for ScoutSource (replaces custom from_str)
- tests: add path sanitization tests (traversal, separators, dot trimming)

---------

Co-authored-by: stawky <stakeswky@gmail.com>
2026-02-15 09:26:13 -05:00
Argenis
2ac571f406
fix: harden private host detection against SSRF bypass via IP parsing
Security fix for browser tool SSRF prevention via proper IP parsing.
2026-02-15 09:13:12 -05:00
Argenis
1eadd88cf5
feat: Support Responses API fallback for OpenAI-compatible providers (#134)
- Add new structs for Responses API request/response format
- Add helper functions for extracting text from Responses API responses
- Refactor auth header application into a shared apply_auth_header method
- When chat completions returns 404 NOT_FOUND, fall back to Responses API
- Add tests for Responses API text extraction

This enables compatibility with providers that implement the Responses API
instead of Chat Completions (e.g., some newer Groq models).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 09:03:42 -05:00
Argenis
1e21c24e1b
fix: harden private host detection against SSRF bypass via IP parsing (#133)
- Handle IPv6 addresses with brackets correctly
- Parse IP addresses properly to catch all representations (decimal, hex, octal)
- Check for IPv4-mapped IPv6 addresses
- Check for IPv6 private ranges (unique-local fc00::/7, link-local fe80::/10)
- Add tests for IPv6 SSRF protection

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:52:01 -05:00
Argenis
031683aae6
fix(security): use path-component matching for forbidden paths (#132)
- Use Path::components() to check for actual .. path components instead of
  simple string matching (which was too conservative)
- Block URL-encoded traversal attempts (e.g., ..%2f)
- Expand tilde (~) for comparison
- Use path-component-aware matching for forbidden paths
- Update test to allow .. in filenames but block actual path traversal

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:30:48 -05:00
Argenis
73ced20765
fix(tools): check for symlinks before writing and reorder mkdir (#131)
- Move create_dir_all before canonicalize to prevent race condition where
  an attacker could create a symlink after the check but before the write
- Reject symlinks at the target path to prevent symlink attacks

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:26:39 -05:00
Argenis
b722189ef1
fix: clear environment variables in shell tool to prevent secret leakage
This fix addresses CWE-200 by clearing environment variables before
executing shell commands and only re-adding safe, functional variables.

- Add SAFE_ENV_VARS constant with whitelist of safe variables
- Use .env_clear() before executing commands
- Add tests for environment variable isolation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:24:01 -05:00
Argenis
1e19b12efd
fix(providers): warn on shared API key for fallbacks and warm up all providers (#130)
- Warn when fallback providers share the same API key as primary (could fail
  if providers require different keys)
- Warm up all providers instead of just the first, continuing on warmup failures

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:23:50 -05:00
Argenis
0fe4d2f712
chore: fix CHANGELOG date for version 0.1.0 (#128) 2026-02-15 08:20:45 -05:00
Argenis
641a5bf917
fix(skills): prevent path traversal in skill remove command
- Fix URL validation to check for https:// or http:// prefixes instead of partial string matching which could be bypassed
- Add path traversal protection in skill remove command to reject .., /, and verify canonical path is inside the skills directory
2026-02-15 08:15:41 -05:00
Argenis
da453f0b4b
fix: prevent panics from byte-level string slicing on multi-byte UTF-8
Uses floor_char_boundary() instead of direct byte indexing to prevent panics when slicing strings containing multi-byte UTF-8 characters.
2026-02-15 08:06:04 -05:00
Argenis
e3791aebcb
fix(imessage): escape newlines in AppleScript string interpolation
Prevents code injection via line breaks by escaping newline and carriage return characters in AppleScript string interpolation.
2026-02-15 08:00:59 -05:00
Argenis
e89415fc9a
chore: add .wt-pr37 Windsurf directory to gitignore
Also removes dead inject_openclaw_identity function and replaces unreachable macros with anyhow bail for cleaner error handling.
2026-02-15 07:44:50 -05:00
Edvard Schøyen
6725eb2995
fix(gateway): use constant-time comparison for WhatsApp verify_token
Uses constant_time_eq for verify_token to prevent timing attacks. Removes unused whatsapp_app_secret signature verification code for simplification.
2026-02-15 07:42:52 -05:00
Edvard Schøyen
bd02d73ecc
test: add comprehensive pairing code consumption tests
Add comprehensive tests for pairing code consumption feature
2026-02-15 07:36:54 -05:00
Argenis
dc654f6835
Merge pull request #121 from theonlyhennygod/docs/ram-update-final
docs: ZeroClaw <5MB RAM
2026-02-15 07:28:08 -05:00
argenis de la rosa
21607a72fa docs: update ZeroClaw RAM spec to <5MB 2026-02-15 07:28:04 -05:00
Argenis
ae97a76e64
Merge pull request #120 from theonlyhennygod/docs/comprehensive-benchmarks
docs: comprehensive benchmarks for ZeroClaw vs Others
2026-02-15 07:13:55 -05:00
argenis de la rosa
3c5166248a docs: add comprehensive benchmarks (NanoBot, PicoClaw, OpenClaw) 2026-02-15 07:12:15 -05:00
argenis de la rosa
80c599f215 fix: correct truncate_with_ellipsis to trim trailing whitespace
- Update truncate_with_ellipsis to trim trailing whitespace for cleaner output
- Fix test expectations to match trimmed behavior
- This resolves merge conflicts and ensures consistent string truncation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 07:06:56 -05:00
argenis de la rosa
b1c2cf865a merge: resolve conflicts with main and update README benchmarks 2026-02-15 07:02:41 -05:00
argenis de la rosa
fa5babb6a9 docs: update README with benchmarks, features, and specs comparison image 2026-02-15 06:58:30 -05:00
argenis de la rosa
085b57aa30 refactor: consolidate CLI command definitions to lib.rs
- Move all CLI command enums (ChannelCommands, SkillCommands, CronCommands, IntegrationCommands, MigrateCommands, ServiceCommands) to lib.rs
- Add clap derives for use in main.rs CLI parsing
- Update all modules to use crate:: prefix instead of super:: for command types
- Add mod util; to main.rs for binary compilation
- Export Config type from lib.rs for main.rs

This refactoring eliminates code duplication between library modules and binary, centralizing all CLI command definitions in one place.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:52:33 -05:00
Argenis
7b5e77f03c
fix: use safe Unicode string truncation to prevent panics (CWE-119)
Merge pull request #117 from theonlyhennygod/fix/unicode-truncation-panic
2026-02-15 06:49:48 -05:00
argenis de la rosa
9aaa5bfef1 fix: use safe Unicode string truncation to prevent panics (CWE-119)
Fixes Issue #55: Unicode string truncation causes panics with non-ASCII input

Previously, code used byte-index slicing (`&s[..n]`) which panics when the
slice boundary falls in the middle of a multi-byte UTF-8 character (emoji,
CJK, accented characters).

Changes:
- Added `truncate_with_ellipsis()` helper in `src/util.rs` that uses
  `char_indices()` to find safe character boundaries
- Replaced 2 unsafe truncations in `src/channels/mod.rs` with the safe helper
- Added 12 comprehensive tests covering emoji, CJK, accented chars, and edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:46:37 -05:00
argenis de la rosa
47c5006de4 Merge remote-tracking branch 'origin/feat/whatsapp-email-channels'
# Conflicts:
#	Cargo.lock
#	src/config/schema.rs
#	src/cron/mod.rs
#	src/security/secrets.rs
#	src/service/mod.rs
2026-02-15 06:37:51 -05:00
Argenis
5cc02c5813
fix: add WhatsApp webhook signature verification (X-Hub-Signature-256)
Closes #51

- Add HMAC-SHA256 signature verification for WhatsApp webhooks
- Prevents message spoofing attacks (CWE-345)
- Add whatsapp_app_secret config field with ZEROCLAW_WHATSAPP_APP_SECRET env override
- Add 13 comprehensive unit tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:17:24 -05:00
jbradf0rd
13748b590c feat: add Windows headless daemon support via Task Scheduler
Adds Windows branches to all 5 service commands (install/start/stop/
status/uninstall) using schtasks to register a "ZeroClaw Daemon"
scheduled task that runs at logon with highest privileges. A wrapper
.cmd script handles stdout/stderr redirection to the logs directory.

Also fixes symlink_tests.rs to compile on Windows by using the
correct std::os::windows::fs::symlink_dir API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:05:17 -06:00
jbradf0rd
9d0e29972c feat: add dedicated GLM provider with JWT auth and GLM-4.7 support
The GLM/Zhipu provider was using the generic OpenAI-compatible provider,
which failed because:
- Zhipu requires JWT authentication (HS256 with sign_type: SIGN header),
  not raw Bearer tokens
- The endpoint uses /v4/chat/completions, not /v1/
- default_model_for_provider() had no GLM case, silently defaulting to
  a Claude model

Changes:
- Add src/providers/glm.rs with JWT token generation, caching, and
  correct Z.AI international endpoint
- Wire GLM provider into factory (mod.rs) replacing the broken
  OpenAI-compatible shim
- Add ring dependency for HMAC-SHA256 signing
- Add GLM-4.7 and GLM-4.7-Flash to onboarding wizard model list
- Fix default_model_for_provider() to return glm-4.7 for GLM provider

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 23:18:00 -06:00
Argenis
026a917544
Merge pull request #76 from ecschoye/fix/provider-warmup-cold-start
fix: add provider warmup to prevent cold-start timeout on first channel message
2026-02-14 22:40:51 -05:00
Argenis
6c445d5db7
Merge pull request #71 from fettpl/fix/bearer-token-hashing
fix: store bearer tokens as SHA-256 hashes instead of plaintext
2026-02-14 22:32:10 -05:00
argenis de la rosa
7a03a01fbf Merge remote-tracking branch 'origin/main' into fix/bearer-token-hashing
# Conflicts:
#	src/security/pairing.rs
2026-02-14 21:51:28 -05:00
Argenis
7468b39693
Merge pull request #68 from fettpl/fix/key-generation-csprng
fix: replace UUID v4 key generation with direct CSPRNG
2026-02-14 21:41:43 -05:00
Argenis
e5cd3f1378
Merge pull request #75 from theonlyhennygod/fix/imessage-sql-injection-50
fix(imessage): replace sqlite CLI path with rusqlite parameterized reads
2026-02-14 21:24:41 -05:00
Argenis
cd2517b5b7
Merge pull request #74 from fettpl/fix/gateway-timeout-layer
fix: apply TimeoutLayer to gateway router for request timeouts
2026-02-14 21:23:31 -05:00
Argenis
f70bf3f943
Merge pull request #72 from fettpl/fix/windows-key-permissions-warning
fix: log warning when Windows key file permissions fail to set
2026-02-14 21:21:30 -05:00
Argenis
c327260e28
Merge pull request #73 from fettpl/fix/constant-time-eq-length-leak
fix: constant_time_eq no longer leaks secret length via early return
2026-02-14 21:20:07 -05:00
Argenis
0a94b54b79
Merge pull request #87 from fettpl/fix/stable-hex-check
fix: replace unstable is_multiple_of with modulo and fix flaky temp test
2026-02-14 20:45:20 -05:00
fettpl
e56bcf7a89 Merge remote-tracking branch 'origin/main' into fix/stable-hex-check
# Conflicts:
#	src/security/secrets.rs
2026-02-15 02:30:30 +01:00
fettpl
6d68e89ef0 Merge remote-tracking branch 'origin/main' into fix/windows-key-permissions-warning
# Conflicts:
#	src/security/secrets.rs
2026-02-15 02:29:59 +01:00
fettpl
82601f17f5 Merge remote-tracking branch 'origin/main' into fix/gateway-timeout-layer
# Conflicts:
#	src/security/secrets.rs
2026-02-15 02:29:40 +01:00
fettpl
b5071c13f3 Merge remote-tracking branch 'origin/main' into fix/constant-time-eq-length-leak
# Conflicts:
#	src/security/secrets.rs
2026-02-15 02:29:24 +01:00
fettpl
65c22ff027 Merge remote-tracking branch 'origin/main' into fix/bearer-token-hashing
# Conflicts:
#	src/security/secrets.rs
2026-02-15 02:29:09 +01:00
fettpl
2741e0f024 Merge remote-tracking branch 'origin/main' into fix/key-generation-csprng
# Conflicts:
#	src/security/secrets.rs
2026-02-15 02:28:52 +01:00
fettpl
33f64c7146 fix: consolidate env-var override tests to eliminate parallel races
Tests that set/remove the same environment variables can race when
cargo test runs them in parallel. Merges each racing pair into a
single test function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:27:13 +01:00
fettpl
e62b7c9153 fix: consolidate env-var override tests to eliminate parallel races
Tests that set/remove the same environment variables can race when
cargo test runs them in parallel. Merges each racing pair into a
single test function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:27:08 +01:00
fettpl
f87cbb28f2 fix: consolidate env-var override tests to eliminate parallel races
Tests that set/remove the same environment variables can race when
cargo test runs them in parallel. Merges each racing pair into a
single test function.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:27:02 +01:00
fettpl
882e1320dc fix: consolidate all env-var override tests to eliminate parallel races
Extends the temperature test fix to also cover provider, api_key, port,
and host env-var tests that had the same race condition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:26:51 +01:00