Skip to content

Security: Tokenectomy-Labs/Tokenectomy

Security

SECURITY.md

πŸ”’ Security Policy β€” Tokenectomy Razor

Last Updated: September 2026
Version: 1.0


βœ… Supported Versions

Version Security Updates Status
v1.3.0 βœ… Active Current Release
v1.2.0 – v1.2.3 βœ… Supported Maintenance
< v1.2.0 ⚠️ End of Life Upgrade recommended

πŸ›‘οΈ Security Features & Invariants

Tokenectomy Razor is architected with uncompromising security-first principles for handling sensitive infrastructure logs, stack traces, and credentials:

1. ReDoS Immunity ($O(N)$ Evaluation) βœ…

  • Linear-Time Regex Evaluation: All pattern matching executes via Rust's guaranteed linear-time finite automaton regex engineβ€”immune to catastrophic backtracking.
  • Hardware-Audited Proof: 50,000-character malicious pathological payloads evaluated in 1.44 ms with zero memory spikes (verified in release benchmark suite).
  • Guaranteed Bound: Rust's regex crate uses finite automata (DFA/NFA) providing strict linear-time guarantees $O(N)$ with respect to input length, preventing algorithmic complexity attacks and ReDoS vulnerabilities.

2. Secret Redaction (Zero-Knowledge Invariant) βœ…

  • Redaction Prior to Parsing: Raw error logs and stack traces are scrubbed for credentials before context extraction and AST processing, ensuring secrets never enter memory ASTs or prompt representations.
  • Zero Cloud Leakage: All regex scanning and sanitization occurs 100% locally on your machine or private CI runner before any prompt or context is shared.
  • Redaction Patterns:
    • AWS Access Keys & Secret Keys (AKIA..., aws_secret_access_key)
    • GitHub / GitLab / Gitea Personal Access Tokens (PATs)
    • OpenAI, Anthropic, and generic AI API keys (sk-...)
    • PostgreSQL, MySQL, Redis, MongoDB connection URIs
    • Slack & Discord Webhooks / Bot Tokens
    • JSON Web Tokens (JWTs) (eyJ...)
    • SSH / RSA / Ed25519 Private Keys
    • Database passwords and auth headers

3. Workspace Boundary Enforcement (Single Security Perimeter) βœ…

  • Centralized WorkspaceBoundary: All filesystem operations (read, write, resolve, and context extraction) are mediated through a single, strict security boundary.
  • Canonicalized Path Traversal Immunity: Target paths and workspace roots are strictly canonicalized. Directory escapes (../), null-byte injection (\0), and out-of-boundary symlink traversals are rejected before any I/O occurs.

4. Automated Patch Verification & 0 Dirty Diff Rollback βœ…

  • Fail-Safe Patching (apply_code_patch): Any patch applied by autonomous agents creates an in-memory backup state and immediately triggers language-specific syntax validation (cargo check, py_compile, node --check).
  • Deterministic Auto-Rollback: If syntax or compilation verification fails, the original file is instantly restored, guaranteeing 0 dirty diffs in version control.

5. Network Proxy Hardening & Remote Mode Authentication βœ…

  • Loopback Default Invariant: Reverse proxy binds strictly to local loopback (127.0.0.1, [::1]) by default.
  • Mandatory Remote Auth: Binding to external interfaces (0.0.0.0) requires explicit --allow-remote flag AND a mandatory proxy bearer token (--proxy-token or TOKENECTOMY_PROXY_TOKEN).
  • Resource Bounds & DoS Resistance: Strict upper limits enforced: MAX_HEADER_SIZE (64 KB), MAX_BODY_SIZE (10 MB), client/upstream timeouts (30s / 60s), and concurrency throttling via asynchronous permits (max 128 concurrent connections).

6. Memory Safety & Zero Allocations βœ…

  • Pure Rust Guarantee: Zero buffer overflows, use-after-free, or data races guaranteed by the Rust compiler.
  • Zero Unsafe Code: No unvetted unsafe blocks in trace parsing, workspace boundaries, or redaction paths.

7. Cryptographic Integrity βœ…

  • SHA-256 Cache Keying: Content hashes and response caches use SHA-256 (not vulnerable non-cryptographic hashers).
  • Secure File Permissions: Temporary caches enforce strict POSIX permissions (0700).

8. Declarative Advisory Control Envelope (Anti-Prompt-Injection Architecture) βœ…

  • Advisory Declarative Metadata: Control-plane fields are declarative advisory hints, not imperative instructions, to avoid resembling prompt-injection patterns and to keep the control envelope safe for consumption by third-party agents with independent reasoning.
  • Explicit Advisory Disclaimer: Every emitted control envelope explicitly specifies [ADVISORY_ONLY=true].
  • Non-Imperative Field Vocabulary: Directives are framed without imperative verbs ([SUGGESTED_NEXT_FRAME=<file:line>] rather than imperative action commands like INSPECT_CALLER_AT_), ensuring static security scanners, enterprise tool-safety audits, and client-side prompt-injection classifiers do not flag M2M telemetry as adversarial execution directives.

9. Downstream Forks, Clones & Acceptable Use Disclaimer βš–οΈ

  • Independent Third-Party Custody: Tokenectomy Razor is open-source software provided under the MIT License exclusively for defensive observability, crash log sanitization, token budgeting, and developer productivity.
  • Zero Liability for Downstream Abuse: Any third-party fork, clone, private deployment, modified binary, or derivative work operates completely outside the custody, telemetry, and control of Tokenectomy Labs and its maintainers. Under no circumstances shall the original author (@daffa2555), Tokenectomy Labs, or contributors be held liable or legally responsible for any illegal, unlawful, malicious, abusive, or unauthorized acts committed by downstream users or fork operators.
  • Sole Operator Liability: Downstream users, fork maintainers, and individual operators assume 100% personal, commercial, and legal accountability for their usage and compliance with all applicable cybercrime, privacy, and intellectual property laws. See DISCLAIMER.md for complete details.

πŸ“‹ Security Audit History

Date Auditor Scope Result Reference
Sep 2026 RustSec Advisory DB Dependency tree audit βœ… 0 known CVEs rustsec.org
Sep 2026 Internal Stress Fuzzing ReDoS, pathological stack traces βœ… Passed (1.44ms / 50K chars) Benchmark Suite
Sep 2026 Bare-Metal Live Suite Native GitHub API & Secret Redaction βœ… 100% Verified (0 leaks) Issue #2 Audit

🚨 Reporting a Vulnerability

Do NOT open a public GitHub issue for security vulnerabilities.

Private Disclosure Channels

  1. GitHub Security Advisory (Recommended):
    πŸ‘‰ Open a Private Security Advisory
  2. Direct Maintainer Contact:
    Contact maintainer directly via GitHub profile: @daffa2555.

What to Include

  • Detailed description of the vulnerability.
  • Minimal reproducible proof of concept (PoC).
  • Affected version(s) of Tokenectomy Razor.
  • Impact assessment (e.g. potential for secret leakage, denial of service).

Response Timeline Commitments

  • Initial Acknowledgment: Within 24 hours.
  • Triage & Assessment: Within 48 hours.
  • Patch Release: Within 72 hours for Critical/High severity.
  • Public Advisory: Coordinated disclosure after fix release.

πŸ” Best Practices for Users

  1. Keep Tokenectomy Updated:
    cargo install --force tokenectomy
  2. Surgically Scrub CI Logs Before LLM Triage:
    - name: Sanitize Failure Logs
      if: failure()
      uses: Tokenectomy-Labs/Tokenectomy@v1
      with:
        log-file: 'build.log'
        output-file: 'sanitized.log'
  3. Audit Local MCP Config: Ensure AI agent configurations pass explicit workspace directory boundaries.

πŸ—οΈ Security Architecture Data Flow

   Raw Error Dump / Stack Trace
               ↓
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚   Tokenectomy Razor (Local Engine)     β”‚
 β”‚   β”œβ”€ Polyglot Stack Extractor          β”‚ βž” Strips node_modules, site-packages, etc.
 β”‚   β”œβ”€ Deterministic Secret Redactor     β”‚ βž” Redacts AWS, PATs, JWTs, DB URIs
 β”‚   └─ SHA-256 Fast Response Cache       β”‚ βž” 0700 Local Permissions
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓
   Sanitized Context (2K–10K Tokens)
               ↓
   Safe Transmission to LLM Brain / Issue Tracker

Key Security Invariant: Secrets never cross the boundary from local sanitization to external systems or AI context windows.


πŸ§ͺ Verifiable Security Test Suite

Developers can independently verify all security properties on their physical hardware:

# Verify dependency security
cargo audit

# Verify secret redaction on live fixtures
cargo test test_redact -- --nocapture

# Verify ReDoS immunity under pathological load
cargo test --release test_redos_immunity -- --nocapture

# Full release verification suite
cargo test --release

🀝 Responsible Disclosure Acknowledgments

We publicly credit and thank all security researchers who report vulnerabilities responsibly through our private channels.

Tokenectomy Razor β€” Uncompromising context safety and secret redaction for autonomous AI agents.

There aren't any published security advisories