Skip to content

feat: add anti-track / anti-upgrade module#8

Open
Malkovich-666 wants to merge 6 commits intolingcoder:mainfrom
Malkovich-666:feat/anti-track-module
Open

feat: add anti-track / anti-upgrade module#8
Malkovich-666 wants to merge 6 commits intolingcoder:mainfrom
Malkovich-666:feat/anti-track-module

Conversation

@Malkovich-666
Copy link
Copy Markdown

Summary

This PR introduces an Anti-Track / Anti-Upgrade module to crab-code, giving users control over telemetry, version checks, and request sanitization.

What’s added

  • crates/api/src/anti_track.rs — New module providing:

    • AntiTrackConfig (exposed from crab_config) with switches for:
      • disable_version_check
      • disable_telemetry
      • disable_update_check
      • block_tracking_domains
      • spoof_version + custom spoofed_version
      • disable_crash_reports
      • disable_feedback
    • sanitize_request() — strips tracking headers (X-Claude-Client-Version, X-Analytics, etc.) and optionally spoofs User-Agent.
    • should_block_url() — blocks known tracking domains (e.g. telemetry.anthropic.com, api.segment.io) and version-check endpoints.
    • Unit tests for domain blocking and header sanitization.
  • crates/config/src/settings.rs — Adds AntiTrackConfig struct and anti_track: Option<AntiTrackConfig> to Settings, with proper three-level merge support.

  • crates/api/src/lib.rs — Exposes pub mod anti_track and wires settings.anti_track into create_backend().

  • crates/api/src/anthropic/client.rs & crates/api/src/openai/client.rs — Integrates anti-track sanitization into every outgoing HTTP request (stream, send, list_models, health_check).

How to use

Add to ~/.crab/settings.json:

{
  "antiTrack": {
    "disableTelemetry": true,
    "disableUpdateCheck": true,
    "blockTrackingDomains": true,
    "spoofVersion": true,
    "spoofedVersion": "1.0.0"
  }
}

Design notes

  • The implementation is adapted from the anti-track work in rusty-ai-cli (a Rust rewrite of Claude Code).
  • Code analysis, extraction, and porting were assisted by the Hermes Agent.
  • The module follows crab-code’s existing crate boundaries (crab_config for settings, crab_api for request sanitization) and keeps API-client changes minimally invasive.

Checklist

  • New module with tests
  • Config integration
  • Anthropic client wired
  • OpenAI client wired
  • Backward-compatible (defaults to None, no behavior change unless configured)

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