Configuration
Complete reference for the railgun.toml configuration file.
Railgun is configured via a TOML file, typically named railgun.toml.
Config File Location
Railgun searches for configuration in this order:
- Explicit
-cflag railgun.tomlin current directory~/.config/railgun/railgun.toml- Built-in defaults (all scanners enabled)
Full Example
Policy Section
| Field | Type | Default | Description |
|---|---|---|---|
mode | String | "strict" | "strict" blocks violations, "monitor" logs only |
fail_closed | bool | true | Any panic becomes Deny (security-critical) |
Modes
strict— Block tool calls that violate policymonitor— Log violations but allow through (for testing)
Secrets Detection
| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Enable secret scanning |
entropy_threshold | f64 | 4.5 | Shannon entropy threshold for high-entropy strings |
detect_aws_keys | bool | true | Detect AKIA... patterns |
detect_github_tokens | bool | true | Detect ghp_, gho_, etc. |
detect_openai_keys | bool | true | Detect sk-... patterns |
detect_private_keys | bool | true | Detect -----BEGIN...PRIVATE KEY----- |
Custom Patterns
Add custom secret patterns:
Command Blocking
| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Enable command pattern blocking |
block_patterns | String[] | (built-in) | Regex patterns to block |
allow_patterns | String[] | [] | Override blocks for specific patterns |
Built-in Block Patterns
rm -rf /orrm -rf ~(recursive delete)- Fork bombs
mkfs.(disk format)dd if=(raw disk write)chmod 777(dangerous permissions)
Protected Paths
| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Enable path protection |
blocked | String[] | (built-in) | Glob patterns for protected paths |
Built-in Protected Paths
**/.env,**/.env.***/*.pem,**/*.key**/.ssh/****/.aws/credentials**/.gnupg/**
Network Protection
| Field | Type | Default | Description |
|---|---|---|---|
enabled | bool | true | Enable network domain blocking |
block_domains | String[] | (built-in) | Domains to block |
Built-in Blocked Domains
pastebin.comngrok.iowebhook.siterequestbin.com
Tool Permissions
| Field | Type | Description |
|---|---|---|
allow | String[] | Tools that skip all inspection |
deny | String[] | Tools that are always blocked |
ask | String[] | Tools that require user confirmation |
Patterns support glob syntax: * matches any characters, ? matches single character.
MCP Server Permissions
MCP tools use format mcp__<server>__<tool>. Server-level rules apply to all tools from that server.
Evaluation Order
- Tool-level check — Is this tool allowed/denied/ask?
- Parameter inspection — If not early-exit:
- Secret scanning
- Command pattern matching
- Path protection
- Network domain checking
- Verdict — Allow, Deny, or Ask
Next Steps
- Policy Engine — How inspection works
- CLI Reference — Command-line options