Skip to content

Security: kimhons/Ralph-Loop-Ultra

Security

docs/SECURITY.md

Ralph Ultra Security Model

Ralph Ultra implements a three-tier security model to balance development velocity with system safety. This document explains how the security model works and how to configure it for your project.


Overview

The security model protects your system from potentially destructive operations while giving you flexibility based on your trust level and project requirements.

Security Tiers

Tier Trust Level Default Behavior Use Case
Sandbox Low Read-only, safe operations only Initial exploration, untrusted code
Standard Medium Allowlist-based, regex patterns Most development work
YOLO High Full permissions, minimal restrictions Rapid prototyping, trusted environments

Tier 1: Sandbox Mode (Default)

Philosophy: "Read everything, write nothing without permission."

What's Allowed

  • Reading files and directories
  • Running analysis commands (grep, find, ls)
  • Git status/log (read-only operations)
  • Package manager info commands (npm list, pip show)

What's Blocked

  • File writes (unless explicitly approved)
  • Package installations
  • Git commits/pushes
  • Database operations
  • System configuration changes
  • Network operations (API calls, curl)

Configuration

Sandbox mode is active by default. No configuration needed.

# Run in sandbox mode (default)
ralph run

Tier 2: Standard Mode

Philosophy: "Allow common safe operations, block dangerous ones."

Allowlist-Based Permissions

Standard mode uses regex patterns to permit specific commands while blocking everything else.

Default Allowlist

{
  "security": {
    "mode": "standard",
    "allowlist": [
      "^npm (install|ci|run|test|run build)$",
      "^git (add|commit|status|log|diff|branch)$",
      "^pytest",
      "^flutter (pub get|test|analyze|run)$",
      "^npx (eslint|prettier|tsc)$",
      "^docker-compose up -d$"
    ]
  }
}

Extending the Allowlist

Add custom patterns to .ralph/config.json:

{
  "security": {
    "mode": "standard",
    "allowlist": [
      "^curl https://api\\.mycompany\\.com/.*$",
      "^python scripts/custom_tool\\.py$",
      "^make (build|test|clean)$"
    ]
  }
}

What's Always Blocked (Blocklist)

Even in standard mode, these operations are always blocked:

# Destructive git operations
git reset --hard
git clean -fdx
git push --force
git branch -D

# System-level changes
sudo rm -rf
chmod 777
chown

# Database drops
DROP DATABASE
DELETE FROM

# Environment tampering
export AWS_SECRET_KEY=
rm -rf ~/.ssh

Tier 3: YOLO Mode

Philosophy: "Maximum velocity, minimum friction."

What's Allowed

Everything. The AI agent has full system permissions.

Safeguards

Even in YOLO mode, Ralph Ultra includes:

  1. Interactive Confirmation: You must explicitly approve YOLO mode on each run.
  2. Audit Logging: All commands are logged to .ralph/audit.log.
  3. Revert Points: Git commits are created before destructive operations.

Enabling YOLO Mode

You must use the --security yolo flag AND interactively confirm:

ralph run --security yolo
⚠️  WARNING: You are about to run in YOLO mode.
⚠️  This gives the AI agent unrestricted system access.
⚠️  Type 'CONFIRM' to proceed:

When to Use YOLO Mode

  • Rapid prototyping: "Just make it work, I'll review later."
  • Trusted private projects: Solo development on your local machine.
  • Experimental features: Testing new AI capabilities.

When NOT to Use YOLO Mode

  • Production systems: Never on servers with real data.
  • Shared repositories: Risk of unintended changes to team code.
  • Unfamiliar codebases: Without understanding the system, YOLO is dangerous.

Per-Project Configuration

Configure security settings in .ralph/config.json:

{
  "security": {
    "mode": "standard",
    "allowlist": [
      "^npm (install|test|run build)$",
      "^git (add|commit|status)$"
    ],
    "blocklist": [
      "^rm -rf /$",
      "^sudo"
    ],
    "require_approval": [
      "^git push",
      "^npm publish"
    ]
  }
}

Configuration Fields

Field Type Description
mode "sandbox" | "standard" | "yolo" Active security tier
allowlist string[] Regex patterns for allowed commands (standard mode)
blocklist string[] Regex patterns for always-blocked commands
require_approval string[] Commands that require human approval before execution

Command Validation Flow

┌─────────────────────────────────┐
│   AI Agent Proposes Command     │
└───────────────┬─────────────────┘
                │
                ▼
┌─────────────────────────────────┐
│  Check Blocklist (Always First) │
└───────────────┬─────────────────┘
                │
         ┌──────┴──────┐
         │  Blocked?   │
         └──────┬──────┘
         Yes    │    No
          │     │
          ▼     ▼
      [DENY] [Continue]
                │
                ▼
┌─────────────────────────────────┐
│   Check Security Mode           │
└───────────────┬─────────────────┘
                │
       ┌────────┼────────┐
       │        │        │
    Sandbox  Standard  YOLO
       │        │        │
       ▼        ▼        ▼
   [Safe?]  [Allowlist?] [ALLOW]
       │        │
    Yes│No   Yes│No
       │        │
       ▼        ▼
   [ALLOW]  [DENY]

Best Practices

1. Start Conservative

Begin with sandbox mode to understand what the agent is trying to do. Gradually promote to standard mode with a custom allowlist.

2. Use YOLO Sparingly

YOLO mode is powerful but dangerous. Reserve it for isolated experiments, not production work.

3. Review Audit Logs

After each Ralph session, review .ralph/audit.log to see what commands were executed.

tail -n 50 .ralph/audit.log

4. Customize for Your Stack

Tailor the allowlist to your specific tools and workflows. For example, a Python project might allow:

{
  "allowlist": [
    "^pip install -r requirements\\.txt$",
    "^pytest",
    "^mypy \\.",
    "^ruff check \\."
  ]
}

5. Never Commit Secrets

Even in YOLO mode, Ralph Ultra never commits files containing secrets. The security auditor skill scans for:

  • API keys (e.g., API_KEY=sk-...)
  • Private keys (e.g., BEGIN PRIVATE KEY)
  • AWS credentials
  • Database passwords

Security Auditor Skill

Ralph Ultra includes a dedicated security-auditor skill that runs automatically before every commit. It scans for:

  • Hardcoded secrets
  • SQL injection vulnerabilities
  • XSS vulnerabilities
  • Insecure dependencies (via npm audit or safety check)

Forcing a Security Audit

ralph skill run security-auditor

Bypassing the Security Audit (Not Recommended)

ralph run --skip-security-audit

Warning: Only use this for throwaway code or non-sensitive projects.


Frequently Asked Questions

Q: Can I run Ralph Ultra on a production server?

A: Not recommended. Ralph Ultra is designed for development environments. For production deployments, use ralph deploy which has additional safeguards.

Q: What if I need to run a command that's blocked?

A: Add it to your allowlist in .ralph/config.json. If it's a one-time operation, you can also run it manually outside of Ralph.

Q: How do I know which mode I'm in?

A: Run ralph status. It shows the current security mode at the top.

Q: Is YOLO mode safe on my personal laptop?

A: It's safer than on shared systems, but still use caution. YOLO mode can delete files, install packages, and make network requests. Always review the PRD before running in YOLO mode.


Reporting Security Issues

If you discover a security vulnerability in Ralph Ultra, please report it to:

Email: security@ralph-ultra.dev (or file a GitHub issue marked [SECURITY])

Do not publicly disclose the vulnerability until it has been addressed.


Last Updated: January 31, 2026 Version: Ralph Ultra 1.0

There aren’t any published security advisories