clawarmor 3.1.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +147 -0
- package/README.md +49 -1
- package/clawgear-skills/clawarmor-live-monitor/SKILL.md +120 -0
- package/clawgear-skills/hardened-operator-baseline/SKILL.md +172 -0
- package/clawgear-skills/incident-response-playbook/SKILL.md +189 -0
- package/clawgear-skills/skill-security-scanner/SKILL.md +170 -0
- package/cli.js +65 -3
- package/lib/audit-quiet.js +89 -0
- package/lib/baseline-cmd.js +189 -0
- package/lib/baseline.js +106 -0
- package/lib/harden.js +225 -11
- package/lib/incident-cmd.js +201 -0
- package/lib/invariant-sync.js +668 -0
- package/lib/scan.js +88 -17
- package/lib/skill-verify.js +259 -0
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [3.4.0] — 2026-03-08
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
|
|
7
|
+
#### `clawarmor harden --report` — Structured Hardening Reports
|
|
8
|
+
Export a portable, structured summary of every hardening run — what was hardened, what was
|
|
9
|
+
skipped, why, and what was already good. The #1 feature gap for enterprise adoption.
|
|
10
|
+
|
|
11
|
+
**Flags:**
|
|
12
|
+
- `--report [path]` — Write JSON report (default: `~/.openclaw/clawarmor-harden-report-YYYY-MM-DD.json`)
|
|
13
|
+
- `--report-format text` — Write Markdown report instead of JSON
|
|
14
|
+
|
|
15
|
+
**JSON report structure:**
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"version": "3.4.0",
|
|
19
|
+
"timestamp": "...",
|
|
20
|
+
"system": { "os": "...", "openclaw_version": "..." },
|
|
21
|
+
"summary": { "total_checks": N, "hardened": N, "already_good": N, "skipped": N },
|
|
22
|
+
"items": [
|
|
23
|
+
{ "check": "exec.ask.off", "status": "hardened", "before": "off", "after": "on-miss", "action": "..." },
|
|
24
|
+
{ "check": "gateway.host.open", "status": "skipped", "skipped_reason": "Breaking fix..." }
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Examples:**
|
|
30
|
+
```bash
|
|
31
|
+
clawarmor harden --report
|
|
32
|
+
clawarmor harden --report /tmp/my-report.json
|
|
33
|
+
clawarmor harden --report /tmp/report.md --report-format text
|
|
34
|
+
clawarmor harden --auto --report
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Existing `clawarmor harden` behavior unchanged when `--report` is not passed.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## [3.3.0] — 2026-03-07
|
|
42
|
+
|
|
43
|
+
### New Features
|
|
44
|
+
|
|
45
|
+
#### `clawarmor invariant sync` — Invariant Deep Integration
|
|
46
|
+
The Invariant integration in v3.0 detected presence of `invariant-ai`. v3.3.0 does the real work:
|
|
47
|
+
it reads your latest audit findings and generates severity-tiered Invariant DSL policies that
|
|
48
|
+
actually enforce behavioral guardrails at runtime.
|
|
49
|
+
|
|
50
|
+
**Severity tiers:**
|
|
51
|
+
- `CRITICAL`/`HIGH` findings → `raise "..."` hard enforcement rules (blocks the trace)
|
|
52
|
+
- `MEDIUM` findings → `warn "..."` monitoring/alerting rules (logs but allows)
|
|
53
|
+
- `LOW`/`INFO` findings → `# informational` comments (guidance only)
|
|
54
|
+
|
|
55
|
+
**Policy mappings (finding → Invariant rule):**
|
|
56
|
+
| Finding type | Generated policy |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `exec.ask=off` / unrestricted exec | `raise` on any `exec` tool call |
|
|
59
|
+
| Credential files world-readable | `raise` on `read_file` to sensitive paths (`.ssh`, `.aws`, `agent-accounts`, `.openclaw`) |
|
|
60
|
+
| Open channel policy (no `allowFrom`) | `raise`/`warn` on `read_file → send_message` without channel restriction |
|
|
61
|
+
| Elevated tool calls unrestricted | `raise`/`warn` on elevated calls with no `allowFrom_restricted` metadata |
|
|
62
|
+
| Skill supply chain / unpinned | `raise`/`warn` on tool calls lacking `skill_verified` or `skill_pinned` metadata |
|
|
63
|
+
| API key/secret in config files | `raise`/`warn` on `read_file` output containing secret patterns → `send_message` |
|
|
64
|
+
| Baseline: prompt injection | `raise` on web content → outbound message (always included) |
|
|
65
|
+
|
|
66
|
+
**New commands:**
|
|
67
|
+
```
|
|
68
|
+
clawarmor invariant sync # generate tiered policies from latest audit
|
|
69
|
+
clawarmor invariant sync --dry-run # preview without writing
|
|
70
|
+
clawarmor invariant sync --push # generate + validate + push to Invariant instance
|
|
71
|
+
clawarmor invariant sync --push --host <host> --port <port>
|
|
72
|
+
clawarmor invariant sync --json # machine-readable output
|
|
73
|
+
clawarmor invariant status # show current policy file + last sync report
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Policy output:**
|
|
77
|
+
- Policy file: `~/.clawarmor/invariant-policies/clawarmor.inv`
|
|
78
|
+
- Sync report: `~/.clawarmor/invariant-policies/sync-report.json`
|
|
79
|
+
|
|
80
|
+
**`--push` behavior:**
|
|
81
|
+
1. Validates policy syntax via `LocalPolicy.from_file()` (requires `pip3 install invariant-ai`)
|
|
82
|
+
2. If Invariant instance running on `localhost:8000` → live-reloads policy immediately
|
|
83
|
+
3. If not running → policy written to disk, enforces on next Invariant start
|
|
84
|
+
|
|
85
|
+
**Relationship to `clawarmor stack`:**
|
|
86
|
+
- `stack deploy/sync` generates basic `.inv` rules in `~/.clawarmor/invariant-rules.inv`
|
|
87
|
+
- `invariant sync` generates richer severity-tiered policies in `~/.clawarmor/invariant-policies/clawarmor.inv`
|
|
88
|
+
- They are complementary; `invariant sync` is the recommended path for serious deployments
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## [3.2.0] — 2026-03-03
|
|
93
|
+
|
|
94
|
+
### New Features
|
|
95
|
+
|
|
96
|
+
#### `clawarmor scan --json`
|
|
97
|
+
- Added `--json` flag to `clawarmor scan`
|
|
98
|
+
- Outputs a clean JSON object to stdout with: `verdict` (PASS/WARN/BLOCK), `score`, `totalSkills`, `flaggedSkills`, `findings[]`, `scannedAt`
|
|
99
|
+
- Verdict rules: BLOCK if any CRITICAL findings, WARN if any HIGH findings, PASS otherwise
|
|
100
|
+
- Designed for scripting and CI/CD integration (pipe to `jq`, parse in shell scripts)
|
|
101
|
+
|
|
102
|
+
#### `clawarmor baseline` command
|
|
103
|
+
- New command: `clawarmor baseline save [--name <label>]` — saves current audit result as a named baseline to `~/.openclaw/workspace/memory/clawarmor-baselines/`
|
|
104
|
+
- `clawarmor baseline list` — lists all saved baselines with date and score
|
|
105
|
+
- `clawarmor baseline diff [--from <label>] [--to <label>]` — diffs two baselines showing score delta, new findings, and resolved findings
|
|
106
|
+
- Enables tracking security posture over time and catching regressions after skill installs
|
|
107
|
+
|
|
108
|
+
#### `clawarmor incident` command
|
|
109
|
+
- New command: `clawarmor incident create --finding <description> --severity <CRITICAL|HIGH|MEDIUM> [--action <quarantine|rollback|notify>]`
|
|
110
|
+
- Creates a structured markdown incident log at `~/.openclaw/workspace/memory/incidents/YYYY-MM-DD-<slug>.md`
|
|
111
|
+
- `--action rollback` automatically triggers config rollback via existing snapshot system
|
|
112
|
+
- `clawarmor incident list` — lists all logged incidents with date and severity
|
|
113
|
+
|
|
114
|
+
#### `clawarmor skill verify <skill-dir>`
|
|
115
|
+
- New command that validates a skill directory against ClawGear publishing standards
|
|
116
|
+
- Checks: SKILL.md presence, no hardcoded credentials, no obfuscation, permissions declared if exec used, no fetches to unknown hosts, description in frontmatter
|
|
117
|
+
- Exit codes: 0=VERIFIED, 1=WARN, 2=BLOCK
|
|
118
|
+
- Human-readable output with emoji status per check
|
|
119
|
+
|
|
120
|
+
### ClawGear Security Skills
|
|
121
|
+
- Added 4 security skill SKILL.md files in `clawgear-skills/`:
|
|
122
|
+
- `clawarmor-live-monitor` — heartbeat monitoring with Telegram alerts on score drops
|
|
123
|
+
- `skill-security-scanner` — pre-install gate for skills using `scan --json`
|
|
124
|
+
- `hardened-operator-baseline` — 3-command full hardening sequence
|
|
125
|
+
- `incident-response-playbook` — automated incident response with rollback + alerting
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## [3.1.0] — 2026-02-XX
|
|
130
|
+
|
|
131
|
+
- Stack honesty fix + post-install audit + contextual profiles
|
|
132
|
+
|
|
133
|
+
## [3.0.1] — 2026-02-XX
|
|
134
|
+
|
|
135
|
+
- README rewrite — control plane positioning, stack orchestration docs
|
|
136
|
+
|
|
137
|
+
## [3.0.0] — 2026-02-XX
|
|
138
|
+
|
|
139
|
+
- Stack orchestrator — Invariant + IronCurtain integration
|
|
140
|
+
|
|
141
|
+
## [2.2.1] — 2026-01-XX
|
|
142
|
+
|
|
143
|
+
- Fix npm bloat (6.2MB→273KB), clean up README with v2.2 features
|
|
144
|
+
|
|
145
|
+
## [2.2.0] — 2026-01-XX
|
|
146
|
+
|
|
147
|
+
- Config snapshots + rollback, monitor mode for harden
|
package/README.md
CHANGED
|
@@ -51,9 +51,11 @@ ClawArmor sits at the foundation and orchestrates the layers above it:
|
|
|
51
51
|
|---|---|
|
|
52
52
|
| `audit` | Score your OpenClaw config (0–100), live gateway probes, plain-English verdict |
|
|
53
53
|
| `scan` | Scan all installed skill files for malicious code and SKILL.md instructions |
|
|
54
|
+
| `scan --json` | Machine-readable scan output — pipe to CI, scripts, or dashboards |
|
|
54
55
|
| `prescan <skill>` | Pre-scan a skill before installing — blocks on CRITICAL findings |
|
|
56
|
+
| `skill verify <name>` | Deep-verify a specific installed skill — checks SKILL.md + all referenced scripts |
|
|
55
57
|
| `fix` | Auto-apply safe fixes (--dry-run to preview, --apply to run) |
|
|
56
|
-
| `harden` | Interactive hardening wizard (--dry-run, --auto, --monitor) |
|
|
58
|
+
| `harden` | Interactive hardening wizard (--dry-run, --auto, --monitor, --report) |
|
|
57
59
|
| `status` | One-screen security posture dashboard |
|
|
58
60
|
| `verify` | Re-run only previously-failed checks (CI-friendly, exit 0 = all fixed) |
|
|
59
61
|
|
|
@@ -67,6 +69,31 @@ ClawArmor sits at the foundation and orchestrates the layers above it:
|
|
|
67
69
|
| `stack sync` | Regenerate stack configs from latest audit — run after harden/fix |
|
|
68
70
|
| `stack teardown` | Remove deployed stack components |
|
|
69
71
|
|
|
72
|
+
### Invariant Deep Integration (v3.3.0)
|
|
73
|
+
|
|
74
|
+
| Command | Description |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `invariant sync` | Generate severity-tiered Invariant policies from latest audit findings |
|
|
77
|
+
| `invariant sync --dry-run` | Preview policies without writing |
|
|
78
|
+
| `invariant sync --push` | Generate + validate + push to running Invariant instance |
|
|
79
|
+
| `invariant sync --json` | Machine-readable output for scripting |
|
|
80
|
+
| `invariant status` | Show current policy file and last sync report |
|
|
81
|
+
|
|
82
|
+
**Severity tiers:**
|
|
83
|
+
- `CRITICAL`/`HIGH` findings → `raise "..."` (hard enforcement — blocks trace)
|
|
84
|
+
- `MEDIUM` findings → `warn "..."` (monitoring/alerting — logged)
|
|
85
|
+
- `LOW`/`INFO` findings → `# comment` (informational only)
|
|
86
|
+
|
|
87
|
+
Policies are written to `~/.clawarmor/invariant-policies/clawarmor.inv`. With `--push`, ClawArmor validates the policy syntax via `invariant-ai` and live-reloads a running Invariant instance. If no instance is running, the policy is written to disk and enforces on next start.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip3 install invariant-ai # required for --push validation
|
|
91
|
+
clawarmor audit # run audit to capture findings
|
|
92
|
+
clawarmor invariant sync # generate tiered policies
|
|
93
|
+
clawarmor invariant sync --push # push to running Invariant instance
|
|
94
|
+
clawarmor invariant status # check what's deployed
|
|
95
|
+
```
|
|
96
|
+
|
|
70
97
|
### History & Monitoring
|
|
71
98
|
|
|
72
99
|
| Command | Description |
|
|
@@ -76,6 +103,9 @@ ClawArmor sits at the foundation and orchestrates the layers above it:
|
|
|
76
103
|
| `log` | View the audit event log |
|
|
77
104
|
| `digest` | Show weekly security digest |
|
|
78
105
|
| `watch` | Monitor config and skill changes in real time |
|
|
106
|
+
| `baseline save` | Save current scan results as baseline |
|
|
107
|
+
| `baseline diff` | Compare current scan against saved baseline — see what changed |
|
|
108
|
+
| `incident create` | Log a security incident with timestamp, findings, and remediation notes |
|
|
79
109
|
| `protect --install` | Install guard hook, shell intercept (zsh/bash/fish), and watch daemon |
|
|
80
110
|
| `snapshot` | Save a config snapshot manually (auto-saved before every harden/fix) |
|
|
81
111
|
| `rollback` | Restore config from auto-snapshot (--list, --id <id>) |
|
|
@@ -116,6 +146,24 @@ clawarmor harden --monitor-report # see what it observed
|
|
|
116
146
|
clawarmor harden --monitor-off # stop monitoring
|
|
117
147
|
```
|
|
118
148
|
|
|
149
|
+
**Hardening reports** (v3.4.0) — Export a structured report after hardening:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Write JSON report to default location (~/.openclaw/clawarmor-harden-report-YYYY-MM-DD.json)
|
|
153
|
+
clawarmor harden --report
|
|
154
|
+
|
|
155
|
+
# Write JSON report to a custom path
|
|
156
|
+
clawarmor harden --report /path/to/report.json
|
|
157
|
+
|
|
158
|
+
# Write Markdown report (human-readable, shareable)
|
|
159
|
+
clawarmor harden --report /path/to/report.md --report-format text
|
|
160
|
+
|
|
161
|
+
# Combine with auto mode
|
|
162
|
+
clawarmor harden --auto --report
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Report structure includes: version, timestamp, OS/OpenClaw info, summary counts (hardened/skipped/already-good), and per-check action details with before/after values.
|
|
166
|
+
|
|
119
167
|
## Philosophy
|
|
120
168
|
|
|
121
169
|
ClawArmor runs entirely on your machine — no telemetry, no cloud, no accounts.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clawarmor-live-monitor
|
|
3
|
+
description: Monitors your OpenClaw agent security posture on every heartbeat. Diffs against a saved baseline and sends a Telegram alert if your score drops (e.g., after installing a new skill). Uses clawarmor baseline diff under the hood.
|
|
4
|
+
category: security
|
|
5
|
+
tags: [security, monitoring, heartbeat, clawarmor]
|
|
6
|
+
requires: clawarmor >= 3.2.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# clawarmor-live-monitor
|
|
10
|
+
|
|
11
|
+
Monitors your OpenClaw agent's security posture on every heartbeat cycle. After a new skill is installed, your score can silently drop — this skill catches that and alerts you before it becomes a problem.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
|
|
15
|
+
On every heartbeat, this skill:
|
|
16
|
+
1. Saves the current security posture as a `current` baseline
|
|
17
|
+
2. Diffs it against the saved `initial` baseline
|
|
18
|
+
3. If the score dropped by more than 5 points, fires a Telegram alert via `openclaw system event`
|
|
19
|
+
|
|
20
|
+
It uses `clawarmor baseline diff` under the hood — no custom scoring logic, just wiring.
|
|
21
|
+
|
|
22
|
+
## Why it matters
|
|
23
|
+
|
|
24
|
+
You install a skill, it looks fine. But it quietly adds an exec call or an outbound network fetch that ClawArmor would flag. Without continuous monitoring, you'd never know until the next manual audit. This skill closes that gap.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Scripts
|
|
29
|
+
|
|
30
|
+
### `baseline-init.sh`
|
|
31
|
+
|
|
32
|
+
Run this once on first install to save your initial baseline.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
#!/usr/bin/env bash
|
|
36
|
+
# baseline-init.sh — save initial security baseline
|
|
37
|
+
set -e
|
|
38
|
+
|
|
39
|
+
echo "[clawarmor-live-monitor] Saving initial baseline..."
|
|
40
|
+
clawarmor baseline save --name initial
|
|
41
|
+
echo "[clawarmor-live-monitor] Initial baseline saved."
|
|
42
|
+
echo "Now paste heartbeat-fragment.md into your HEARTBEAT.md to enable continuous monitoring."
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `monitor.sh`
|
|
46
|
+
|
|
47
|
+
Run on every heartbeat to check for score regressions.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
#!/usr/bin/env bash
|
|
51
|
+
# monitor.sh — diff current posture against initial baseline
|
|
52
|
+
set -e
|
|
53
|
+
|
|
54
|
+
SKILL_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
55
|
+
|
|
56
|
+
# Save current posture
|
|
57
|
+
clawarmor baseline save --name current
|
|
58
|
+
|
|
59
|
+
# Diff against initial
|
|
60
|
+
DIFF_OUTPUT=$(clawarmor baseline diff --from initial --to current 2>&1)
|
|
61
|
+
SCORE_DELTA=$(echo "$DIFF_OUTPUT" | grep -oP 'Delta:\s*\K[+-]?\d+' | head -1)
|
|
62
|
+
|
|
63
|
+
echo "[clawarmor-live-monitor] Score delta: ${SCORE_DELTA:-0}"
|
|
64
|
+
|
|
65
|
+
# Alert if score dropped more than 5 points
|
|
66
|
+
if [ -n "$SCORE_DELTA" ] && [ "$SCORE_DELTA" -lt -5 ]; then
|
|
67
|
+
openclaw system event \
|
|
68
|
+
--text "⚠️ ClawArmor score dropped ${SCORE_DELTA} points since initial baseline. Run: clawarmor audit" \
|
|
69
|
+
--mode now
|
|
70
|
+
echo "[clawarmor-live-monitor] Alert sent."
|
|
71
|
+
fi
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `heartbeat-fragment.md`
|
|
75
|
+
|
|
76
|
+
Paste this snippet into your `HEARTBEAT.md` to enable automatic monitoring:
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
## Security Monitor
|
|
80
|
+
|
|
81
|
+
Run bash monitor.sh from skills/clawarmor-live-monitor/ — if score dropped, alert Alberto.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Setup
|
|
87
|
+
|
|
88
|
+
1. **Install ClawArmor 3.2.0+**: `npm install -g clawarmor`
|
|
89
|
+
2. **Save your initial baseline** (run once):
|
|
90
|
+
```bash
|
|
91
|
+
bash ~/.openclaw/workspace/skills/clawarmor-live-monitor/baseline-init.sh
|
|
92
|
+
```
|
|
93
|
+
3. **Enable heartbeat monitoring** — paste the contents of `heartbeat-fragment.md` into your `HEARTBEAT.md`
|
|
94
|
+
|
|
95
|
+
That's it. On every heartbeat, your score will be checked against the initial baseline.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Manual usage
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Check current posture vs initial baseline
|
|
103
|
+
bash ~/.openclaw/workspace/skills/clawarmor-live-monitor/monitor.sh
|
|
104
|
+
|
|
105
|
+
# See all saved baselines
|
|
106
|
+
clawarmor baseline list
|
|
107
|
+
|
|
108
|
+
# Detailed diff
|
|
109
|
+
clawarmor baseline diff --from initial --to current
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Notes
|
|
115
|
+
|
|
116
|
+
- Requires clawarmor 3.2.0+ for the `baseline` commands
|
|
117
|
+
- The `current` baseline is overwritten on every heartbeat — it tracks the most recent posture only
|
|
118
|
+
- The `initial` baseline persists until you re-run `baseline-init.sh`
|
|
119
|
+
- Alert threshold is hardcoded at -5 points; edit `monitor.sh` to adjust
|
|
120
|
+
- Telegram delivery requires `openclaw system event` to be configured with a Telegram channel
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hardened-operator-baseline
|
|
3
|
+
description: Full ClawArmor hardening in 3 commands. Detects your operator role (coding/browsing/messaging), applies contextual hardening, deploys Invariant + IronCurtain stack, saves a security baseline, and writes a SECURITY_RUNBOOK.md to your workspace. One-time setup for production-grade security posture.
|
|
4
|
+
category: security
|
|
5
|
+
tags: [security, hardening, baseline, clawarmor, invariant, ironcurtain]
|
|
6
|
+
requires: clawarmor >= 3.2.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# hardened-operator-baseline
|
|
10
|
+
|
|
11
|
+
Production-grade security hardening in 3 commands. Run this once to go from default OpenClaw config to a hardened, monitored, documented security posture.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
|
|
15
|
+
1. **Detects your operator role** (`clawarmor profile detect`) — coding, browsing, or messaging
|
|
16
|
+
2. **Applies contextual hardening** (`clawarmor harden --profile <detected>`) — tightens the settings that matter for your role without breaking your workflow
|
|
17
|
+
3. **Deploys the security stack and saves a baseline** (`clawarmor stack deploy && clawarmor baseline save --name post-harden`) — Invariant flow guardrails + IronCurtain instruction boundaries + a snapshot of your hardened posture
|
|
18
|
+
|
|
19
|
+
After running, a `SECURITY_RUNBOOK.md` is written to your workspace documenting what was done and how to respond to incidents.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## The 3 commands
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Step 1: Detect your operator role
|
|
27
|
+
clawarmor profile detect
|
|
28
|
+
|
|
29
|
+
# Step 2: Apply contextual hardening (replace <profile> with detected value)
|
|
30
|
+
clawarmor harden --profile <profile>
|
|
31
|
+
|
|
32
|
+
# Step 3: Deploy security stack and save baseline
|
|
33
|
+
clawarmor stack deploy && clawarmor baseline save --name post-harden
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Script
|
|
39
|
+
|
|
40
|
+
### `setup.sh`
|
|
41
|
+
|
|
42
|
+
Runs all 3 steps in sequence and writes `SECURITY_RUNBOOK.md` to your workspace.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
#!/usr/bin/env bash
|
|
46
|
+
# setup.sh — full ClawArmor hardening sequence
|
|
47
|
+
# Run once to set up production-grade security posture
|
|
48
|
+
|
|
49
|
+
set -e
|
|
50
|
+
|
|
51
|
+
WORKSPACE="$HOME/.openclaw/workspace"
|
|
52
|
+
RUNBOOK="$WORKSPACE/SECURITY_RUNBOOK.md"
|
|
53
|
+
|
|
54
|
+
echo ""
|
|
55
|
+
echo "=== ClawArmor Hardened Operator Baseline ==="
|
|
56
|
+
echo ""
|
|
57
|
+
|
|
58
|
+
# Step 1: Detect profile
|
|
59
|
+
echo "[1/3] Detecting operator profile..."
|
|
60
|
+
PROFILE=$(clawarmor profile detect 2>/dev/null | grep -oP 'Detected:\s*\K\w+' | head -1)
|
|
61
|
+
if [ -z "$PROFILE" ]; then
|
|
62
|
+
PROFILE="general"
|
|
63
|
+
echo " Profile detection failed — using 'general'"
|
|
64
|
+
else
|
|
65
|
+
echo " Detected profile: $PROFILE"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
# Step 2: Apply hardening
|
|
69
|
+
echo ""
|
|
70
|
+
echo "[2/3] Applying contextual hardening (profile: $PROFILE)..."
|
|
71
|
+
clawarmor harden --profile "$PROFILE" --auto
|
|
72
|
+
echo " Hardening applied."
|
|
73
|
+
|
|
74
|
+
# Step 3: Deploy stack and save baseline
|
|
75
|
+
echo ""
|
|
76
|
+
echo "[3/3] Deploying security stack and saving baseline..."
|
|
77
|
+
clawarmor stack deploy
|
|
78
|
+
clawarmor baseline save --name post-harden
|
|
79
|
+
SCORE=$(clawarmor baseline list 2>/dev/null | grep -A2 'post-harden' | grep -oP 'Score:\s*\K[\d]+' | head -1)
|
|
80
|
+
SCORE="${SCORE:-unknown}"
|
|
81
|
+
echo " Stack deployed. Baseline saved. Score: $SCORE/100"
|
|
82
|
+
|
|
83
|
+
# Write SECURITY_RUNBOOK.md
|
|
84
|
+
DATE=$(date +%Y-%m-%d)
|
|
85
|
+
mkdir -p "$WORKSPACE"
|
|
86
|
+
|
|
87
|
+
cat > "$RUNBOOK" << EOF
|
|
88
|
+
# Security Runbook
|
|
89
|
+
**Hardened:** $DATE
|
|
90
|
+
**Profile:** $PROFILE
|
|
91
|
+
**Score:** $SCORE/100
|
|
92
|
+
**Stack:** Invariant + IronCurtain
|
|
93
|
+
|
|
94
|
+
## What's Protected
|
|
95
|
+
- Config locked via clawarmor harden
|
|
96
|
+
- Runtime guardrails via Invariant
|
|
97
|
+
- Instruction boundaries via IronCurtain
|
|
98
|
+
|
|
99
|
+
## Incident Response
|
|
100
|
+
1. Run: clawarmor audit
|
|
101
|
+
2. Check: clawarmor incident list
|
|
102
|
+
3. If CRITICAL: clawarmor rollback && clawarmor incident create --finding "..." --severity CRITICAL
|
|
103
|
+
|
|
104
|
+
## Contacts
|
|
105
|
+
- ClawArmor docs: github.com/pinzasai/clawarmor
|
|
106
|
+
- ClawGear support: clawgear.io
|
|
107
|
+
EOF
|
|
108
|
+
|
|
109
|
+
echo ""
|
|
110
|
+
echo "=== Done ==="
|
|
111
|
+
echo ""
|
|
112
|
+
echo " SECURITY_RUNBOOK.md written to: $RUNBOOK"
|
|
113
|
+
echo " Baseline saved as: post-harden"
|
|
114
|
+
echo " Score: $SCORE/100"
|
|
115
|
+
echo ""
|
|
116
|
+
echo " Next steps:"
|
|
117
|
+
echo " - Review SECURITY_RUNBOOK.md"
|
|
118
|
+
echo " - Run 'clawarmor audit' anytime to check current posture"
|
|
119
|
+
echo " - Run 'clawarmor baseline diff --from post-harden --to <new>' to track changes"
|
|
120
|
+
echo ""
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## After running
|
|
126
|
+
|
|
127
|
+
Your workspace will contain:
|
|
128
|
+
- **`SECURITY_RUNBOOK.md`** — incident response procedures, what's protected, contacts
|
|
129
|
+
- **`post-harden` baseline** — snapshot of your hardened posture for future diffs
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Check posture after any config changes
|
|
133
|
+
clawarmor baseline save --name $(date +%Y-%m-%d) && \
|
|
134
|
+
clawarmor baseline diff --from post-harden --to $(date +%Y-%m-%d)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## SECURITY_RUNBOOK.md template
|
|
140
|
+
|
|
141
|
+
The script generates this file automatically. You can also create it manually:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
# Security Runbook
|
|
145
|
+
**Hardened:** <date>
|
|
146
|
+
**Profile:** <profile>
|
|
147
|
+
**Score:** <score>/100
|
|
148
|
+
**Stack:** Invariant + IronCurtain
|
|
149
|
+
|
|
150
|
+
## What's Protected
|
|
151
|
+
- Config locked via clawarmor harden
|
|
152
|
+
- Runtime guardrails via Invariant
|
|
153
|
+
- Instruction boundaries via IronCurtain
|
|
154
|
+
|
|
155
|
+
## Incident Response
|
|
156
|
+
1. Run: clawarmor audit
|
|
157
|
+
2. Check: clawarmor incident list
|
|
158
|
+
3. If CRITICAL: clawarmor rollback && clawarmor incident create --finding "..." --severity CRITICAL
|
|
159
|
+
|
|
160
|
+
## Contacts
|
|
161
|
+
- ClawArmor docs: github.com/pinzasai/clawarmor
|
|
162
|
+
- ClawGear support: clawgear.io
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Notes
|
|
168
|
+
|
|
169
|
+
- Run `clawarmor baseline save` after any significant config changes to keep your diff history meaningful
|
|
170
|
+
- The `--auto` flag on harden applies SAFE and CAUTION fixes without prompting — omit it if you want to review each fix interactively
|
|
171
|
+
- Stack deploy requires Invariant and IronCurtain to be available in your environment
|
|
172
|
+
- Requires clawarmor 3.2.0+ for baseline commands
|