Commit Graph

1363 Commits

Author SHA1 Message Date
ZeroClaw Bot fd1a9b7a07 fix(auth): address CodeRabbit review feedback on OAuth UX
Made-with: Cursor
2026-02-28 18:33:17 -05:00
ZeroClaw Bot 2d5c0142d2 feat(auth): improve OAuth UX for server environments
Add stale pending login detection (auto-cleanup after 24h), improved
device-code flow error messages with Cloudflare/403 detection, shared
OAuth helpers, and Box::pin fixes for large async futures.

Made-with: Cursor
2026-02-28 18:33:17 -05:00
argenis de la rosa 7058b15cc4 fix(security): harden git config readonly checks 2026-02-28 18:23:37 -05:00
argenis de la rosa 4ce4ec5f34 feat(security): allow read-only git config operations
Previously, `is_args_safe()` blocked ALL `git config`, `git alias`,
and `git -c` subcommands unconditionally. This forced administrators
to pre-create `.gitconfig` files outside ZeroClaw.

Now allow read-only git config operations:
- `git config --get <key>` - read single value
- `git config --list` / `git config -l` - list all config
- `git config --get-all <key>` - get all values for key
- `git config --get-regexp <pattern>` - list matching keys
- `git config --get-urlmatch <pattern>` - URL matching

Write operations remain blocked:
- `git config user.name "value"` (plain write)
- `git config --unset <key>`
- `git config --add <key> <value>`
- `git config --global <key> <value>` (scoped write)
- `git config -e` / `--edit` (opens editor)
- `git alias.*` and `git -c` remain fully blocked

Security impact: Read operations have no side effects and cannot
be used for code execution. The dangerous keys (core.editor,
credential.helper, alias.*) remain protected since we only allow
explicitly read-only operations.

Fixes #1398

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:23:37 -05:00
argenis de la rosa 728782d369 fix(agent): close run() wrapper calls in replayed hook wiring 2026-02-28 18:19:48 -05:00
argenis de la rosa 408616b34e feat(agent): expose hooks parameter in public run() entry point
Add `hooks: Option<&crate::hooks::HookRunner>` as the last parameter
to the public `agent::run()` (re-exported from `loop_::run`).

This enables library consumers to inject custom HookHandler
implementations (before_tool_call, on_after_tool_call) without
patching the crate. The hooks are threaded through to
`run_tool_call_loop` which already accepts and dispatches them.

All existing call sites pass `None`, preserving backward compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:19:48 -05:00
argenis de la rosa fe688d6b1a fix(agent): remove stale loop session imports 2026-02-28 18:18:43 -05:00
argenis de la rosa b0a3fbd338 test(security): assert /mnt in default forbidden path checks 2026-02-28 18:09:35 -05:00
Antigravity Agent 28b9d81464 security: add /mnt to default forbidden_paths 2026-02-28 18:09:35 -05:00
argenis de la rosa 9ffe9c381b fix(tools): register bg_run tools in runtime registry 2026-02-28 17:54:22 -05:00
Daniel Willitzer d943f9c28c feat(tools): add bg_run — background tool execution with security hardening
Adds async background tool execution with auto-injection of completed results:
- BgRunTool: Dispatches any tool in background, returns job_id immediately
- BgStatusTool: Queries job status by ID or lists all jobs
- BgJobStore: In-memory job tracking per session
- Auto-injection: Completed jobs appear as <bg_result> XML in agent history

Security hardening (Track C):
- MAX_CONCURRENT_JOBS=5 prevents resource exhaustion
- XML escaping prevents injection attacks in format_bg_result_for_injection
- Recursion guard blocks bg_run spawning itself or bg_status
- Hard 600s timeout per job guaranteed
- One-time delivery prevents duplicate injection
- 5-minute auto-expiry bounds memory growth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:54:22 -05:00
Shadman Hossain d5cea40fed fix(bedrock): auto-refresh AWS credentials before STS token expiry
Add CachedCredentials with 50-minute TTL that transparently refreshes
from the ECS container credential endpoint, env vars, or EC2 IMDS.

- Add from_ecs() to credential resolve chain for ECS/Fargate support
- Move streaming credential fetch into async context for TTL validation
- Remove sync credential fallback (all paths now use TTL-aware cache)
- Double-checked locking prevents thundering herd on refresh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 17:51:57 -05:00
argenis de la rosa 61d538b6d6 feat(slack): support listening on multiple configured channel IDs 2026-02-28 17:48:20 -05:00
argenis de la rosa 7f645e1a5c Merge remote-tracking branch 'origin/main' into pr2093-mainmerge 2026-02-28 17:43:48 -05:00
argenis de la rosa c07314bd92 merge(main): resolve #2093 conflicts and restore session build/test parity 2026-02-28 17:42:37 -05:00
argenis de la rosa e663ad274e fix(acp): harden process lifecycle and health validation 2026-02-28 17:36:39 -05:00
argenis de la rosa 1b8d747e1f fix(acp): stabilize send path, remove unreachable arms, and fix docs tables 2026-02-28 17:36:39 -05:00
feishiheng 579f0f3d9a feat(channels): add comprehensive ACP channel tests and fix implementation bugs (conflict resolution)
- Add 14 test functions for ACP channel (allowlist logic and JSON-RPC structures)
- Fix mutex guard across await in send() method using take() pattern
- Add acp: None default fields to ChannelsConfig in schema.rs
- Integrate ACP channel into channels/mod.rs and collect_configured_channels()
- Update channels-reference.md documentation
- Resolve merge conflicts with upstream/dev

All 17 ACP tests pass successfully.
2026-02-28 17:36:39 -05:00
argenis de la rosa f7de9cda3a Merge remote-tracking branch 'origin/main' into pr2093-mainmerge 2026-02-28 17:33:17 -05:00
argenis de la rosa 17921f24fc fix(cron): require recurring opt-in for agent cron schedules 2026-02-28 17:25:22 -05:00
argenis de la rosa 9a6d7e03c4 fix(cron): require explicit opt-in for recurring agent jobs 2026-02-28 17:25:22 -05:00
argenis de la rosa af314611af test(memory): verify cortex bridge failure preserves local sqlite writes 2026-02-28 17:25:03 -05:00
argenis de la rosa f4d06a3a73 feat(memory): add optional cortex-mem backend profile and bridge 2026-02-28 17:25:03 -05:00
argenis de la rosa 9b9c36e84d test(channels): lock assistant autosave key namespace 2026-02-28 17:24:31 -05:00
argenis de la rosa 6a24f25f91 fix(memory): auto-save assistant responses alongside user messages 2026-02-28 17:24:31 -05:00
Preventnetworkhacking d89e7ab415 fix(utf8): prevent panic on CJK text truncation [CDV-27]
Fix UTF-8 boundary panics in two locations not covered by PR #2154:

1. telegram.rs:3112 - OTP/approval message preview truncation
   - Changed from byte-based `&raw_args[..260]` to char-based truncation
   - Uses existing `truncate_with_ellipsis` utility

2. detection.rs:222 - Tool output hash prefix
   - Changed from `&output[..4096]` to UTF-8-safe boundary
   - Uses existing `floor_utf8_char_boundary` utility

Added test: hash_output_utf8_boundary_safe() verifies no panic on CJK text.

Fixes #2276
2026-02-28 16:35:09 -05:00
argenis de la rosa df9ebcb3d2 fix(model): resolve provider-aware fallback model IDs 2026-02-28 16:33:04 -05:00
argenis de la rosa 5d248bf6bf fix(build): restore gateway and cursor compile compatibility 2026-02-28 16:32:38 -05:00
argenis de la rosa 9e4ecc0ee6 fix(slack): resolve sender display names with cache 2026-02-28 16:23:45 -05:00
argenis de la rosa bd0a12ad3c fix(gateway): persist ws chat history by session 2026-02-28 16:23:15 -05:00
argenis de la rosa a30869112e fix(lark,config): complete feishu dedupe and profile config compatibility 2026-02-28 16:17:24 -05:00
argenis de la rosa 4f32b6d8e4 fix(lark): dedupe ws and webhook events by event key 2026-02-28 16:17:24 -05:00
argenis de la rosa 991955ddce fix(gateway): pass optional session id in github webhook path 2026-02-28 16:01:42 -05:00
argenis de la rosa 4af196ab04 fix(routing): normalize hint whitespace for default_model routes 2026-02-28 16:01:42 -05:00
argenis de la rosa 12018b4a03 fix(provider): include quota metadata in cursor chat response 2026-02-28 16:01:42 -05:00
argenis de la rosa 2d91536f92 feat(routing): support hint default_model during startup 2026-02-28 16:01:42 -05:00
xj 11e68485e9 fix(fmt): correct remaining rustfmt violations on main (#2282)
Fixes formatting in auth_profile.rs and quota_tools.rs missed by #2280.

Co-authored-by: xj <gh-xj@users.noreply.github.com>
2026-02-28 13:01:21 -08:00
maxtongwang e37a53c690 fix(web-fetch): remove dead feature gates and add noise stripping (#2262)
* fix(web-fetch): remove dead feature gates, add noise stripping, add docstrings

The nanohtml2text and fast_html2md providers were both guarded by
cfg(feature) checks for features (web-fetch-plaintext, web-fetch-html2md)
that are never declared in Cargo.toml. This caused every web_fetch call
to silently return an error instead of fetching content.

Changes:
- Add strip_noise_elements() which removes <script>, <style>, <nav>,
  <header>, <footer>, <aside>, <noscript>, <form>, <button> blocks
  before text extraction, eliminating menu/ad/boilerplate noise.
- Fix fast_html2md path: when web-fetch-html2md feature is not compiled
  in, fall through to nanohtml2text rather than returning an error.
- Fix nanohtml2text path: remove dead cfg(feature = "web-fetch-plaintext")
  gate; nanohtml2text is a direct dependency and needs no feature flag.
- Both previously gated tests (html_to_markdown_conversion_preserves_structure,
  html_to_plaintext_conversion_removes_html_tags) are now always-on.
  Added strip_noise_removes_nav_scripts_footer test.
- Add docstrings to all public/private methods to meet coverage threshold.

Tavily and firecrawl providers are unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(web-fetch): align default provider to nanohtml2text, remove dead feature

- Change empty-provider default from deprecated 'fast_html2md' to
  'nanohtml2text' to match WEB_FETCH_PROVIDER_HELP and PR description.
- Remove dead 'web-fetch-plaintext' feature from Cargo.toml (no code
  references it after the feature-gate removal).
- Apply cargo fmt to strip_noise_elements array formatting.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: xj <gh-xj@users.noreply.github.com>
2026-02-28 12:19:40 -08:00
argenis de la rosa 3825eca3dc fix(memory): thread session IDs through runtime paths 2026-02-28 15:00:27 -05:00
argenis de la rosa 352adb5a82 fix(agent): avoid orphan tool messages after compaction 2026-02-28 14:41:13 -05:00
argenis de la rosa 9784e3bfc1 feat(channel): add github native channel MVP 2026-02-28 14:03:10 -05:00
argenis de la rosa 5aac1af065 feat(channel): support onebot aliases for napcat config 2026-02-28 14:00:35 -05:00
argenis de la rosa aa319e71b0 test(cli): add coverage for config show/get/set 2026-02-28 14:00:35 -05:00
argenis de la rosa 20ed60d2a0 feat(config): add show/get/set subcommands for runtime config inspection and modification 2026-02-28 14:00:35 -05:00
dexter f6278373cb feat: add cursor headless cli support (#2195)
* Initial plan

* feat(providers): add Cursor headless CLI provider

Co-authored-by: langhuihui <3647405+langhuihui@users.noreply.github.com>

* fix(cursor): harden headless CLI invocation and safety guards

* chore(pr): retrigger intake after template and linear updates

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: langhuihui <3647405+langhuihui@users.noreply.github.com>
Co-authored-by: argenis de la rosa <theonlyhennygod@gmail.com>
2026-02-28 13:41:56 -05:00
argenis de la rosa 3f70cbbf9b feat(gateway): add paired devices API and dashboard tab 2026-02-28 13:34:33 -05:00
argenis de la rosa 0253752bc9 feat(memory): add observation memory tool 2026-02-28 13:32:13 -05:00
argenis de la rosa e3e648eea7 fix(tools): harden pptx_read ordering and extraction limits 2026-02-28 13:29:05 -05:00
argenis de la rosa 5cc482ebe1 fix(pptx_read): handle empty a:t tags safely 2026-02-28 13:29:05 -05:00
reidliu41 cb1cd14cbb feat(tools): add pptx_read tool for PowerPoint text extraction
- Problem: Agent cannot read PPTX files — file_read returns garbled binary, making presentations inaccessible
  - Why it matters: PPTX is the last major Office format gap after pdf_read and docx_read; presentations are ubiquitous in
  business and education workflows
  - What changed: Added pptx_read tool using existing zip + quick-xml to extract plain text from all slides in order
  - What did not change: No changes to existing tools, agent loop, security policy, config schema, or dependencies

  Label Snapshot (required)

  - Risk label: risk: low
  - Size label: size: S
  - Scope labels: tool
  - Module labels: tool: pptx_read

  Change Metadata

  - Change type: feature
  - Primary scope: tool

  Linked Issue

  - Closes #

  Validation Evidence (required)

  cargo fmt --all -- --check   # pass
  cargo clippy --all-targets -- -D warnings   # pass (zero new warnings)
  cargo test pptx_read   # 14/14 passed

  - Evidence provided: test results

  Security Impact (required)

  - New permissions/capabilities? No
  - New external network calls? No
  - Secrets/tokens handling changed? No
  - File system access scope changed? No

  Privacy and Data Hygiene (required)

  - Data-hygiene status: pass
  - Redaction/anonymization notes: Test fixtures use neutral content ("Hello PPTX", "Slide One", "Slide Two")
  - Neutral wording confirmation: Yes

  Compatibility / Migration

  - Backward compatible? Yes
  - Config/env changes? No
  - Migration needed? No

  i18n Follow-Through

  - i18n follow-through triggered? No

  Human Verification (required)

  - Verified scenarios: Multi-slide extraction produces correct ordered text
  - Edge cases checked: invalid ZIP, missing slides, symlink escape, path traversal, rate limiting, truncation
  - What was not verified: encrypted PPTX (out of scope), speaker notes

  Side Effects / Blast Radius (required)

  - Affected subsystems/workflows: Tool registry only
  - Potential unintended effects: None — additive only
  - Guardrails/monitoring: Identical security chain as pdf_read/docx_read

  Rollback Plan (required)

  - Fast rollback command/path: git revert <commit>
  - Feature flags or config toggles: None needed
  - Observable failure symptoms: pptx_read tool missing from tool list

  Risks and Mitigations

  - Risk: None — zero new dependencies, follows established pattern exactly
    - Mitigation: N/A
2026-02-28 13:29:05 -05:00