โ† Back to all stories

Building Caro with Security in Mind

Security isn't an afterthought at Caroโ€”it's foundational to everything we build. As a CLI tool that generates and executes shell commands, we take our responsibility to protect users seriously.

Why Security Matters for Caro

Caro converts natural language into shell commands using AI. This power comes with significant responsibility: a malicious or buggy command could harm user systems. That's why we've built multiple layers of security into both the tool itself and our development practices.

This post walks through our security posture, the GitHub security features we use, and the practices that make Caro a security-conscious project.

GitHub Security Features We Use

Dependabot: Automated Dependency Updates

Dependabot is GitHub's automated dependency update service. It monitors our dependencies for known vulnerabilities and outdated packages, automatically creating pull requests when updates are available.

Our Dependabot configuration monitors Cargo (Rust) dependencies and GitHub Actions weekly, with grouped updates to reduce PR noise.

When Dependabot finds a vulnerability, it creates a pull request with the fix, links to the security advisory, and shows us the severity level. This automation means we catch security issues quickly without manual monitoring.

Dependency Review: PR-Level Security Checks

Every pull request that modifies Cargo.toml, Cargo.lock, or package manifests triggers our Dependency Review workflow. This action:

  • Scans new and updated dependencies for known vulnerabilities
  • Fails the PR if high or critical vulnerabilities are found
  • Validates licenses against our approved list (MIT, Apache-2.0, BSD, etc.)
  • Posts a summary comment on the PR with findings

This prevents vulnerable code from ever reaching our main branch. If a contributor adds a dependency with a known CVE, they'll see the failure immediately and can address it before merge.

cargo-audit: Rust-Specific Security Scanning

We run cargo-audit on every push and pull request. This tool checks our Cargo.lock against the RustSec Advisory Databaseโ€”a community-maintained database of security vulnerabilities in Rust crates. We also use cargo-deny for additional checks on licenses, duplicate dependencies, and source trust validation.

Security Advisories and Private Reporting

GitHub's Security Advisories feature allows security researchers to report vulnerabilities privately. We document our full vulnerability disclosure process in our SECURITY.md file.

Our response commitments:

  • 48 hours: Acknowledgment of report
  • 7 days: Initial assessment and severity classification
  • 30 days: Target fix for critical vulnerabilities
  • 90 days: Target fix for moderate vulnerabilities

Application-Level Security

Safety Validation: 52+ Dangerous Patterns

Caro's safety module is the heart of our security model. Before any command is presented to the user, it passes through our pattern-based validator that checks for:

  • Filesystem destruction: rm -rf /, mkfs, dd if=/dev/zero
  • Fork bombs: :(){ :|:& };: and variants
  • Privilege escalation: sudo su, chmod 777 /
  • System path tampering: Operations on /bin, /usr, /etc
  • Device manipulation: Direct writes to block devices

Commands are classified into risk levels: Safe, Moderate, High, and Critical. High-risk commands require explicit confirmation, and critical commands are blocked entirely unless the user opts in with --allow-dangerous.

A Real-World Lesson: While writing this very blog post, we encountered an unexpected deployment failure. Including a fork bomb example in the documentation caused our Astro build to failโ€”the parser interpreted the shell syntax as JavaScript expressions. This incident reinforced an important lesson: even documenting dangerous commands requires careful handling. Security awareness must extend beyond runtime validation to every layer of our toolchain. You can see the resolving PR for details.

Defense in Depth

We don't rely on a single security control. Our defense-in-depth strategy includes:

  1. Input sanitization: Prompts are validated before reaching the model
  2. Output validation: Generated commands are checked against safety patterns
  3. User confirmation: Commands require explicit approval before execution
  4. Fail-safe defaults: Dangerous operations are blocked by default
  5. Least privilege: We never encourage running as root

Development Practices

CI/CD Security Pipeline

Every commit to Caro runs through our comprehensive CI pipeline:

  • Clippy linting with -D warnings to catch common mistakes
  • cargo-audit for dependency vulnerabilities
  • cargo-deny for license compliance
  • Dependency review for PRs touching dependencies
  • Cross-platform testing on Linux, macOS, and Windows

Code Review Standards

All changes to security-sensitive code (safety validation, command execution, model interaction) receive extra scrutiny:

  • Security-focused review checklist
  • Property-based testing with proptest for edge cases
  • Integration tests covering execution paths
  • Manual security testing before releases

Minimal Dependencies

Every dependency is an attack surface. We consciously minimize our dependency tree, carefully evaluate new dependencies, and prefer well-maintained crates with strong security track records. Dependencies are pinned in Cargo.lock for reproducible builds.

Community and Transparency

Security Hall of Fame

We maintain a Security Hall of Fame in our SECURITY.md to recognize researchers who responsibly disclose vulnerabilities. Contributors receive:

  • Public acknowledgment in security advisories
  • Credit in release notes
  • Listing in the Hall of Fame

Open Development

Security through obscurity doesn't work. Our entire codebase, including the safety validation patterns, is open source. This transparency allows:

  • Community review of security implementations
  • External security audits
  • Contributions to improve our safety patterns
  • Trust through verifiability

Best Practices for Users

While we build security into Caro, users play a role too:

  1. Always review generated commands before execution
  2. Never use --auto mode for destructive operations
  3. Keep Caro updated for the latest security fixes
  4. Limit --allow-dangerous to specific, understood cases
  5. Report suspicious behavior through our security advisory process

Looking Ahead

Security is an ongoing journey, not a destination. We're continuously improving:

  • Expanding safety patterns based on community feedback
  • Enhancing model output validation for edge cases
  • Exploring sandboxed execution for high-risk environments
  • Regular security audits as the project matures

Security is a community effort. If you find a vulnerability, please report it through our GitHub Security Advisories. Together, we can keep Caro safe for everyone.

Resources


Built with Rust | Safety First | Open Source