Introduction
OpenClaw includes a built-in security audit tool that scans your gateway configuration for vulnerabilities, misconfigurations, and security anti-patterns. Integrating this audit into your CI/CD pipeline ensures that insecure configurations are caught before deployment.
Key Concepts
- Security Audit: The
openclaw security auditcommand that scans configuration files for security issues. - Deep Mode: The
--deepflag enables thorough scanning including dependency checks and permission analysis. - Auto-Fix: The
--fixflag automatically corrects common security issues. - JSON Output: The
--jsonflag produces machine-readable output for CI/CD integration.
Real World Context
A platform team adds the OpenClaw security audit to their GitHub Actions workflow. Every pull request that modifies gateway configuration triggers an audit. If any high-severity findings are detected, the PR is blocked until the issues are resolved. This prevents insecure configurations from reaching production.
Deep Dive
Run a security audit from the command line:
bash# Basic audit openclaw security audit # Deep audit with auto-fix and JSON output openclaw security audit --deep --fix --json # Output: # { # "findings": [ # { # "severity": "high", # "rule": "no-api-auth", # "message": "API endpoint has no authentication configured", # "fix": "Added api.auth.required = true" # } # ], # "summary": { # "high": 1, # "medium": 0, # "low": 2, # "fixed": 1 # } # }
The --deep flag enables checks beyond basic configuration: it scans for outdated dependencies, overly permissive tool policies, and sandbox escape vectors. The --fix flag automatically applies safe corrections. The --json output is designed for CI/CD parsing.
Integrate the audit into a GitHub Actions workflow:
yamlname: Security Audit on: pull_request: paths: - '.openclaw/**' - 'openclaw.json' jobs: audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install OpenClaw run: curl -fsSL https://openclaw.ai/install.sh | bash - name: Run Security Audit run: | result=$(openclaw security audit --deep --json) high=$(echo $result | jq '.summary.high') if [ "$high" -gt 0 ]; then echo "::error::Security audit found $high high-severity issues" exit 1 fi
This workflow runs on every PR that modifies OpenClaw configuration. It fails the check if any high-severity findings are detected.
Common Pitfalls
- Only running audits locally — Manual audits are easily forgotten. Automate them in CI/CD.
- Ignoring medium and low findings — Low-severity issues can compound into high-severity vulnerabilities over time.
Best Practices
- Block deployments on high-severity findings — Never deploy a configuration with unresolved high-severity audit findings.
- Run deep audits on a schedule — In addition to PR checks, run
--deepaudits nightly to catch issues from dependency updates.
Summary
openclaw security auditscans configuration for vulnerabilities and misconfigurations- The --deep flag enables thorough scanning including dependency checks
- The --fix flag auto-corrects common issues, --json produces CI-friendly output
- Integrate audits into CI/CD pipelines to catch issues before deployment
- Block deployments on high-severity findings and run deep audits on a schedule