@f4bioo/berry-shield 2026.3.3-1
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/CONTRIBUTING.md +32 -0
- package/LICENSE +201 -0
- package/README.md +251 -0
- package/SECURITY_AUDIT.md +96 -0
- package/docs/wiki/README.md +108 -0
- package/docs/wiki/decision/README.md +48 -0
- package/docs/wiki/decision/modes.md +176 -0
- package/docs/wiki/decision/patterns.md +137 -0
- package/docs/wiki/decision/posture.md +68 -0
- package/docs/wiki/deploy/README.md +51 -0
- package/docs/wiki/deploy/auditing.md +56 -0
- package/docs/wiki/deploy/build.md +92 -0
- package/docs/wiki/deploy/github-ci-cd.md +107 -0
- package/docs/wiki/deploy/installation.md +348 -0
- package/docs/wiki/engine/README.md +53 -0
- package/docs/wiki/engine/match-engine.md +91 -0
- package/docs/wiki/engine/performance.md +114 -0
- package/docs/wiki/engine/redaction.md +120 -0
- package/docs/wiki/layers/README.md +68 -0
- package/docs/wiki/layers/leaf.md +126 -0
- package/docs/wiki/layers/pulp.md +139 -0
- package/docs/wiki/layers/root.md +130 -0
- package/docs/wiki/layers/stem.md +139 -0
- package/docs/wiki/layers/thorn.md +139 -0
- package/docs/wiki/layers/vine.md +154 -0
- package/docs/wiki/operation/README.md +31 -0
- package/docs/wiki/operation/cli/README.md +122 -0
- package/docs/wiki/operation/cli/add.md +157 -0
- package/docs/wiki/operation/cli/help.md +83 -0
- package/docs/wiki/operation/cli/init.md +52 -0
- package/docs/wiki/operation/cli/list.md +78 -0
- package/docs/wiki/operation/cli/mode.md +93 -0
- package/docs/wiki/operation/cli/policy.md +202 -0
- package/docs/wiki/operation/cli/profile.md +98 -0
- package/docs/wiki/operation/cli/remove.md +96 -0
- package/docs/wiki/operation/cli/report.md +66 -0
- package/docs/wiki/operation/cli/reset.md +99 -0
- package/docs/wiki/operation/cli/rules.md +161 -0
- package/docs/wiki/operation/cli/status.md +103 -0
- package/docs/wiki/operation/cli/test.md +119 -0
- package/docs/wiki/operation/cli/toggle.md +90 -0
- package/docs/wiki/operation/cli/vine.md +193 -0
- package/docs/wiki/operation/web/README.md +27 -0
- package/docs/wiki/tutorials/README.md +40 -0
- package/docs/wiki/tutorials/audit-to-enforce-rollout.md +99 -0
- package/docs/wiki/tutorials/build-custom-rules.md +99 -0
- package/docs/wiki/tutorials/choose-profile.md +91 -0
- package/docs/wiki/tutorials/incident-triage-report.md +99 -0
- package/docs/wiki/tutorials/secure-session.md +115 -0
- package/docs/wiki/tutorials/tune-policy.md +111 -0
- package/openclaw.plugin.json +293 -0
- package/package.json +70 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "GitHub Actions release workflow reference for prepare-release and publish-release"
|
|
3
|
+
read_when:
|
|
4
|
+
- You are preparing an official Berry Shield release
|
|
5
|
+
- You need to run publish-release safely with target version
|
|
6
|
+
- You need deterministic recovery for partial release failures
|
|
7
|
+
title: "github-ci-cd"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# `GitHub CI/CD Release Flow`
|
|
11
|
+
|
|
12
|
+
This page documents the official release workflow executed in GitHub Actions.
|
|
13
|
+
It is self-contained and intended for operators with no prior project context.
|
|
14
|
+
|
|
15
|
+
## Preconditions
|
|
16
|
+
|
|
17
|
+
- Repository flow is trunk-based (`master` only).
|
|
18
|
+
- `NPM_TOKEN` is configured in repository secrets.
|
|
19
|
+
- `BERRY_SHIELD_APP_ID` is configured in repository secrets.
|
|
20
|
+
- `BERRY_SHIELD_APP_PRIVATE_KEY` is configured in repository secrets.
|
|
21
|
+
- Repository permissions allow workflow-created branches, tags, PRs, and releases.
|
|
22
|
+
|
|
23
|
+
## Workflow 1: Prepare Release (`master`)
|
|
24
|
+
|
|
25
|
+
### Trigger
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
GitHub Actions -> Prepare Release -> Run workflow (branch: master)
|
|
29
|
+
```
|
|
30
|
+
Expected: workflow runs on `master` and does not skip.
|
|
31
|
+
|
|
32
|
+
### What it does
|
|
33
|
+
|
|
34
|
+
1. Evaluates CalVer date vs current date.
|
|
35
|
+
2. Decides whether to bump, reuse, or no-op based on workflow inputs.
|
|
36
|
+
3. Creates or updates PR `release/v{version} -> master`.
|
|
37
|
+
4. Writes `Release-Mode` in PR body (`release_now` or `bump_only`).
|
|
38
|
+
5. On merge of release PR, if `release_now`:
|
|
39
|
+
- creates tag `v{version}`
|
|
40
|
+
- creates draft release
|
|
41
|
+
- attaches `.tgz` and `SHA256SUMS`.
|
|
42
|
+
6. If there is no required bump and `create_release_after_merge=true`, workflow can create draft release directly from `prepare` when skip conditions are met (no empty PR).
|
|
43
|
+
7. If there is no required bump and `create_release_after_merge=false`, workflow ends as `NO_OP/IDLE` (no branch, no PR, no release).
|
|
44
|
+
|
|
45
|
+
### Expected output
|
|
46
|
+
|
|
47
|
+
- A release branch exists or an existing release PR is updated.
|
|
48
|
+
- A release PR to `master` exists with `Release-Mode` marker in body.
|
|
49
|
+
- Or `NO_OP/IDLE` is reported explicitly when no release action is required.
|
|
50
|
+
|
|
51
|
+
## Release Notes Behavior (Draft Creation)
|
|
52
|
+
|
|
53
|
+
When draft release notes are generated:
|
|
54
|
+
- only PR titles with public types are included (`feat`, `fix`, `perf`, `security`);
|
|
55
|
+
- bot-authored PRs are excluded;
|
|
56
|
+
- first release falls back to `firstReleaseNotes` from `.github/common-contract.json`. <!-- doc-sanity:ignore "firstReleaseNotes" -->
|
|
57
|
+
|
|
58
|
+
## Workflow 2: Publish Release (`master`)
|
|
59
|
+
|
|
60
|
+
### Trigger
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
GitHub Actions -> Publish Release -> Run workflow (branch: master)
|
|
64
|
+
```
|
|
65
|
+
Expected: workflow runs on `master` and does not skip.
|
|
66
|
+
|
|
67
|
+
### Inputs
|
|
68
|
+
|
|
69
|
+
- `target_version` (required): `vYYYY.M.D` or `YYYY.M.D` (supports `-N`)
|
|
70
|
+
- `confirm_publish` (required): must be `PUBLISH_NOW`
|
|
71
|
+
|
|
72
|
+
## Publish flow
|
|
73
|
+
|
|
74
|
+
1. Resolves draft release by exact `target_version` (fail-closed).
|
|
75
|
+
2. Downloads draft assets.
|
|
76
|
+
3. Validates `SHA256SUMS`.
|
|
77
|
+
4. Verifies npm target version does not already exist.
|
|
78
|
+
5. Publishes the exact downloaded `.tgz`.
|
|
79
|
+
6. Promotes release draft to published.
|
|
80
|
+
|
|
81
|
+
## Release Assets Contract
|
|
82
|
+
|
|
83
|
+
Every successful publish must end with GitHub Release assets:
|
|
84
|
+
- `<package>-<version>.tgz` (from `npm pack`)
|
|
85
|
+
- `SHA256SUMS` (hash file for the same `.tgz`)
|
|
86
|
+
|
|
87
|
+
This keeps artifact parity between npm and GitHub Release.
|
|
88
|
+
|
|
89
|
+
## Operational DoD (Required Evidence per release cycle)
|
|
90
|
+
|
|
91
|
+
1. `prepare-release` completed successfully.
|
|
92
|
+
2. Release branch `release/v{version}` exists and PR `release/v{version} -> master` exists.
|
|
93
|
+
3. Release PR checks are green and merged into `master`.
|
|
94
|
+
4. `publish-release` completed successfully with `target_version`.
|
|
95
|
+
5. Release moved from draft to published with the same assets used in npm publish.
|
|
96
|
+
|
|
97
|
+
## Related pages
|
|
98
|
+
- [deploy index](README.md)
|
|
99
|
+
- [installation](installation.md)
|
|
100
|
+
- [build (local dev)](build.md)
|
|
101
|
+
- [auditing](auditing.md)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Navigation
|
|
106
|
+
- [Back to Deploy Index](README.md)
|
|
107
|
+
- [Back to Wiki Index](../README.md)
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Installation guide for Berry Shield using source-truth and release-truth tracks"
|
|
3
|
+
read_when:
|
|
4
|
+
- You are deploying Berry Shield for local or production-like usage
|
|
5
|
+
- You need a source-built deployment path
|
|
6
|
+
- You need to verify plugin activation after installation
|
|
7
|
+
title: "installation"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# `Installation guide`
|
|
11
|
+
|
|
12
|
+
Berry Shield is an OpenClaw plugin.
|
|
13
|
+
This guide defines two installation tracks and when each one should be used.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- Node.js 20 or newer.
|
|
18
|
+
- OpenClaw runtime available in environment.
|
|
19
|
+
- Git available in environment.
|
|
20
|
+
|
|
21
|
+
## SDK compatibility contract
|
|
22
|
+
|
|
23
|
+
Berry Shield validates OpenClaw SDK compatibility through:
|
|
24
|
+
- `package.json` peer range (`peerDependencies.openclaw`)
|
|
25
|
+
- internal compat constants (`src/constants.ts`, `COMPAT_POLICY`)
|
|
26
|
+
- compatibility test contract (`__tests__/compat-policy.test.ts`)
|
|
27
|
+
|
|
28
|
+
Practical rule:
|
|
29
|
+
- Installing a local SDK version outside the declared peer range can fail compatibility tests.
|
|
30
|
+
- Keep local `node_modules/openclaw` aligned with the declared peer range.
|
|
31
|
+
|
|
32
|
+
## Official host reference
|
|
33
|
+
|
|
34
|
+
For official OpenClaw plugin installation behavior, see:
|
|
35
|
+
- https://docs.openclaw.ai/tools/plugin
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Quick navigation
|
|
39
|
+
|
|
40
|
+
> Choose one install track, then complete Section 3.
|
|
41
|
+
|
|
42
|
+
1. Source-truth installation: [Section 1](#section-1-source-truth-installation) (hard way)
|
|
43
|
+
2. Release-truth installation: [Section 2](#section-2-release-truth-installation) (easy way)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Section 1: Source-truth installation
|
|
48
|
+
|
|
49
|
+
Use this flow when you want to install `Berry Shield` directly from the repository source code.
|
|
50
|
+
|
|
51
|
+
### Step 1: Clone repository from GitHub
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/F4bioo/berry-shield.git
|
|
55
|
+
```
|
|
56
|
+
Expected: repository files are copied to a local `berry-shield` folder.
|
|
57
|
+
|
|
58
|
+
### Step 1.1: Check permissions on the cloned repository
|
|
59
|
+
|
|
60
|
+
Before installing the plugin, check the permissions of the cloned repository. OpenClaw can block plugin installation if the plugin directory is `world-writable`.
|
|
61
|
+
|
|
62
|
+
Linux/macOS:
|
|
63
|
+
```bash
|
|
64
|
+
ls -ld ./berry-shield
|
|
65
|
+
```
|
|
66
|
+
Expected (Linux/macOS):
|
|
67
|
+
- secure example: `drwxr-xr-x` (`755`) or stricter
|
|
68
|
+
- insecure example: any mode where `others` has write (`...w...`), such as `777`
|
|
69
|
+
- goal: `others` must NOT have write permission.
|
|
70
|
+
|
|
71
|
+
Optional fix (only if permissions are too broad):
|
|
72
|
+
```bash
|
|
73
|
+
chmod -R u=rwX,go=rX ./berry-shield
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Expected (Linux/macOS after applying correct permissions):
|
|
77
|
+
- command is silent (no output) when successful
|
|
78
|
+
|
|
79
|
+
Windows (PowerShell):
|
|
80
|
+
```powershell
|
|
81
|
+
Get-Acl .\berry-shield | Format-List
|
|
82
|
+
```
|
|
83
|
+
Expected (Windows):
|
|
84
|
+
- ACL does not grant broad write access to untrusted principals (for example, `Everyone` or generic `Users` with write/modify).
|
|
85
|
+
- write/modify should remain restricted to the owner/admin context.
|
|
86
|
+
|
|
87
|
+
Optional fix (only if permissions are too broad):
|
|
88
|
+
```powershell
|
|
89
|
+
icacls .\berry-shield /inheritance:e /grant:r "${env:USERNAME}:(OI)(CI)F" "*S-1-5-32-545:(OI)(CI)RX" /t
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Expected (Windows after applying correct permissions):
|
|
93
|
+
- `processed file: .\berry-shield`
|
|
94
|
+
- `Successfully processed 1 files; Failed processing 0 files`
|
|
95
|
+
|
|
96
|
+
### Step 2: Enter repository root
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd berry-shield
|
|
100
|
+
```
|
|
101
|
+
Expected: terminal is at the Berry Shield project root.
|
|
102
|
+
|
|
103
|
+
### Step 3: Install dependencies
|
|
104
|
+
|
|
105
|
+
**Note:** If dependencies are already installed and current, skip to Step 4.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install
|
|
109
|
+
```
|
|
110
|
+
Expected: dependencies are installed without lockfile or platform errors.
|
|
111
|
+
|
|
112
|
+
### Step 4: Build plugin artifact
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm run build
|
|
116
|
+
```
|
|
117
|
+
Expected: `dist/index.js` is generated successfully.
|
|
118
|
+
|
|
119
|
+
### Step 5: Install plugin from local source path
|
|
120
|
+
|
|
121
|
+
Run from the root of the local `berry-shield` project folder.
|
|
122
|
+
```bash
|
|
123
|
+
openclaw plugins install .
|
|
124
|
+
```
|
|
125
|
+
Expected:
|
|
126
|
+
```terminaloutput
|
|
127
|
+
Installed plugin: berry-shield
|
|
128
|
+
Restart the gateway to load plugins.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Step 6: Restart Gateway runtime
|
|
132
|
+
|
|
133
|
+
Restart the OpenClaw Gateway process used by your environment.
|
|
134
|
+
Expected: plugin registry reloads and Berry CLI becomes available.
|
|
135
|
+
|
|
136
|
+
**Next:** [complete Section 3](#section-3-common-post-install-actions-applies-to-both-tracks).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Section 2: Release-truth installation
|
|
141
|
+
|
|
142
|
+
Use this flow when you want to install Berry Shield from the published package in the registry.
|
|
143
|
+
|
|
144
|
+
### Step 1: Install from registry
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
openclaw plugins install @f4bioo/berry-shield
|
|
148
|
+
```
|
|
149
|
+
Expected:
|
|
150
|
+
```terminaloutput
|
|
151
|
+
Installed plugin: berry-shield
|
|
152
|
+
Restart the gateway to load plugins.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Step 2: Restart Gateway runtime
|
|
156
|
+
|
|
157
|
+
Restart the OpenClaw Gateway process used by your environment.
|
|
158
|
+
Expected: plugin registry reloads and Berry CLI becomes available.
|
|
159
|
+
|
|
160
|
+
**Next:** [complete Section 3](#section-3-common-post-install-actions-applies-to-both-tracks).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Section 3: Common post-install actions (applies to both tracks)
|
|
165
|
+
|
|
166
|
+
### Step 1: Initialize plugin defaults
|
|
167
|
+
|
|
168
|
+
Run this command in the same environment where OpenClaw resolves Berry CLI commands and plugin config paths.
|
|
169
|
+
```bash
|
|
170
|
+
openclaw bshield init
|
|
171
|
+
```
|
|
172
|
+
Expected: Berry config is created/updated and plugin enabled state is prepared.
|
|
173
|
+
|
|
174
|
+
```terminaloutput
|
|
175
|
+
18:29:23 [plugins] 🍓 Initializing Berry Shield configuration...
|
|
176
|
+
|
|
177
|
+
◇ Berry Shield Initialization ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
178
|
+
|
|
179
|
+
✓ Configuration already exists.
|
|
180
|
+
|
|
181
|
+
🍓 Berry Shield 2026.2.15 - Tip: Root layer injects runtime safety policy before agent execution starts.
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
> If you see this output, Berry Shield is already installed and initialized. You can skip the remaining installation steps and continue with the Wiki
|
|
185
|
+
> index [Learn more](../README.md).
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### Step 2: Verify runtime status
|
|
190
|
+
|
|
191
|
+
Run this command immediately after initialization to confirm active runtime settings.
|
|
192
|
+
```bash
|
|
193
|
+
openclaw bshield status
|
|
194
|
+
```
|
|
195
|
+
Expected:
|
|
196
|
+
```terminaloutput
|
|
197
|
+
◇ Berry Shield ─────────────────────────────────────────────────────────────
|
|
198
|
+
|
|
199
|
+
Status ENABLED
|
|
200
|
+
Mode ENFORCE
|
|
201
|
+
Rules Built-in (143) - Custom (0)
|
|
202
|
+
|
|
203
|
+
◇ Policy
|
|
204
|
+
Profile BALANCED
|
|
205
|
+
Escalation 3
|
|
206
|
+
Stale (min) 30
|
|
207
|
+
Heartbeat 0
|
|
208
|
+
Global Escalation OFF
|
|
209
|
+
|
|
210
|
+
◇ Vine
|
|
211
|
+
Mode BALANCED
|
|
212
|
+
Signals to Escalate 1
|
|
213
|
+
Guard Turns 3
|
|
214
|
+
Retention (entries) 10000
|
|
215
|
+
Retention (ttl sec) 86400
|
|
216
|
+
Allowlist 0 tool(s)
|
|
217
|
+
|
|
218
|
+
◇ Security Layers
|
|
219
|
+
Root (Prompt Guard) ACTIVE
|
|
220
|
+
Pulp (Output Scanner) ACTIVE
|
|
221
|
+
Thorn (Tool Blocker) ACTIVE
|
|
222
|
+
Leaf (Input Audit) ACTIVE
|
|
223
|
+
Stem (Security Gate) ACTIVE
|
|
224
|
+
Vine (External Guard) ACTIVE
|
|
225
|
+
|
|
226
|
+
🍓 Berry Shield 2026.2.15 - Tip: Use 'openclaw bshield add' to create custom rules.
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Validation checklist
|
|
230
|
+
|
|
231
|
+
1. Confirm plugin status is enabled.
|
|
232
|
+
2. Confirm desired mode (`enforce` or `audit`) is set.
|
|
233
|
+
3. Run one safe gate test and one deny-path test.
|
|
234
|
+
4. Confirm report command can read events.
|
|
235
|
+
|
|
236
|
+
### CLI customization shortcut
|
|
237
|
+
|
|
238
|
+
Use this command to discover mode, layer, policy, and rules commands.
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
openclaw bshield --help
|
|
242
|
+
```
|
|
243
|
+
Usage Example: run this before changing defaults to review available command paths.
|
|
244
|
+
|
|
245
|
+
Expected:
|
|
246
|
+
```terminaloutput
|
|
247
|
+
Usage: openclaw bshield [options] [command]
|
|
248
|
+
|
|
249
|
+
Berry Shield - Custom security rules management
|
|
250
|
+
|
|
251
|
+
Options:
|
|
252
|
+
-h, --help display help for command
|
|
253
|
+
|
|
254
|
+
Commands:
|
|
255
|
+
add Add a new security rule (interactive wizard if no args)
|
|
256
|
+
help display help for command
|
|
257
|
+
init Initialize Berry Shield configuration
|
|
258
|
+
mode Set operation mode (audit | enforce)
|
|
259
|
+
policy Manage policy settings (wizard, get, set)
|
|
260
|
+
profile Set policy profile (strict | balanced | minimal)
|
|
261
|
+
report Show global audit report from persisted events
|
|
262
|
+
reset Reset defaults (builtins or full scope)
|
|
263
|
+
rules Manage baseline and custom rules
|
|
264
|
+
status Show current status and configuration
|
|
265
|
+
test Test if input matches any security pattern
|
|
266
|
+
toggle Toggle a security layer on/off
|
|
267
|
+
vine Manage Berry.Vine settings and tool allowlist
|
|
268
|
+
|
|
269
|
+
For more info, visit: https://github.com/F4bioo/berry-shield
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
🍓 Berry Shield 2026.2.15 - Tip: Redaction replaces sensitive data with markers to ensure privacy.
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
See more:
|
|
276
|
+
- [Berry Shield CLI reference](../operation/cli/README.md)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### Uninstall Berry Shield
|
|
281
|
+
|
|
282
|
+
Step 1 removes Berry Shield from OpenClaw runtime config and install records.
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
openclaw plugins uninstall berry-shield
|
|
286
|
+
```
|
|
287
|
+
Expected: OpenClaw confirms `Removed: config entry, install record` and asks for gateway restart.
|
|
288
|
+
|
|
289
|
+
Step 2 is a double-check for leftover local files.
|
|
290
|
+
- If no Berry Shield folder is found, uninstall is complete.
|
|
291
|
+
- If the folder still exists, run the delete command for your OS.
|
|
292
|
+
|
|
293
|
+
Linux/macOS - verify leftovers:
|
|
294
|
+
```bash
|
|
295
|
+
ls -la ~/.openclaw/extensions/berry-shield
|
|
296
|
+
```
|
|
297
|
+
Expected:
|
|
298
|
+
- `No such file or directory`: uninstall already complete.
|
|
299
|
+
- folder listing shown: proceed to delete.
|
|
300
|
+
|
|
301
|
+
Linux/macOS - delete leftovers:
|
|
302
|
+
```bash
|
|
303
|
+
rm -rf ~/.openclaw/extensions/berry-shield
|
|
304
|
+
```
|
|
305
|
+
Expected: command finishes silently and the folder no longer exists.
|
|
306
|
+
|
|
307
|
+
Windows (PowerShell) - verify leftovers:
|
|
308
|
+
```powershell
|
|
309
|
+
Get-ChildItem -Force "$env:USERPROFILE\\.openclaw\\extensions\\berry-shield"
|
|
310
|
+
```
|
|
311
|
+
Expected:
|
|
312
|
+
- `Cannot find path`: uninstall already complete.
|
|
313
|
+
- folder listing shown: proceed to delete.
|
|
314
|
+
|
|
315
|
+
Windows (PowerShell) - delete leftovers:
|
|
316
|
+
```powershell
|
|
317
|
+
Remove-Item -Recurse -Force "$env:USERPROFILE\\.openclaw\\extensions\\berry-shield"
|
|
318
|
+
```
|
|
319
|
+
Expected: command completes without error and the folder is removed.
|
|
320
|
+
|
|
321
|
+
Windows (CMD) - verify leftovers:
|
|
322
|
+
```cmd
|
|
323
|
+
dir "%USERPROFILE%\\.openclaw\\extensions\\berry-shield"
|
|
324
|
+
```
|
|
325
|
+
Expected:
|
|
326
|
+
- `File Not Found`: uninstall already complete.
|
|
327
|
+
- directory listing shown: proceed to delete.
|
|
328
|
+
|
|
329
|
+
Windows (CMD) - delete leftovers:
|
|
330
|
+
```cmd
|
|
331
|
+
rmdir /s /q "%USERPROFILE%\\.openclaw\\extensions\\berry-shield"
|
|
332
|
+
```
|
|
333
|
+
Expected: command returns to prompt and the folder is removed.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Related pages
|
|
338
|
+
- [deploy index](README.md)
|
|
339
|
+
- [build](build.md)
|
|
340
|
+
- [CLI init](../operation/cli/init.md)
|
|
341
|
+
- [CLI status](../operation/cli/status.md)
|
|
342
|
+
- [CLI report](../operation/cli/report.md)
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Navigation
|
|
347
|
+
- [Back to Deploy Index](README.md)
|
|
348
|
+
- [Back to Wiki Index](../README.md)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Engine index for Berry scanning, matching, and performance behavior"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need a technical map of content-processing internals
|
|
5
|
+
- You are debugging detection or redaction behavior
|
|
6
|
+
- You are evaluating runtime cost and safety tradeoffs
|
|
7
|
+
title: "Engine Reference"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# `Engine reference`
|
|
11
|
+
|
|
12
|
+
This page is the entry point for Berry engine internals.
|
|
13
|
+
It covers how matching, redaction, and performance characteristics fit together.
|
|
14
|
+
|
|
15
|
+
## Engine pages
|
|
16
|
+
|
|
17
|
+
- [redaction](redaction.md): transformation behavior for string/object payloads
|
|
18
|
+
- [match engine](match-engine.md): safe CLI regex matching behavior
|
|
19
|
+
- [performance](performance.md): runtime cost model and optimization tradeoffs
|
|
20
|
+
|
|
21
|
+
## Engine interaction (single view)
|
|
22
|
+
|
|
23
|
+
```mermaid
|
|
24
|
+
flowchart TD
|
|
25
|
+
IN[Input or output payload] --> M1[Match evaluation]
|
|
26
|
+
M1 --> D{Transform required?}
|
|
27
|
+
D -->|No| FAST[Fast return path]
|
|
28
|
+
D -->|Yes| RED[Redaction traversal path]
|
|
29
|
+
RED --> OUT[Sanitized payload]
|
|
30
|
+
FAST --> OUT
|
|
31
|
+
CLI[CLI rule tests] --> SAFE[Safe match engine with timeout]
|
|
32
|
+
SAFE --> M1
|
|
33
|
+
PERF[Performance controls] --> M1
|
|
34
|
+
PERF --> RED
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Responsibility boundaries
|
|
38
|
+
|
|
39
|
+
- Redaction page explains how content is transformed.
|
|
40
|
+
- Match engine page explains safe CLI regex execution.
|
|
41
|
+
- Performance page explains cost drivers, optimization levers, and tradeoffs.
|
|
42
|
+
|
|
43
|
+
## Related pages
|
|
44
|
+
- [wiki index](../README.md)
|
|
45
|
+
- [layers index](../layers/README.md)
|
|
46
|
+
- [decision patterns](../decision/patterns.md)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Navigation
|
|
51
|
+
- [Back to Wiki Index](../README.md)
|
|
52
|
+
- [Back to Repository README](../../../README.md)
|
|
53
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Engine reference for safe regex matching used by Berry CLI rule validation paths"
|
|
3
|
+
read_when:
|
|
4
|
+
- You are debugging CLI pattern test behavior
|
|
5
|
+
- You are validating regex safety in rule preview flows
|
|
6
|
+
- You need to understand timeout behavior in pattern matching
|
|
7
|
+
title: "match engine"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# `Match engine`
|
|
11
|
+
|
|
12
|
+
Berry match engine is the safe regex matching utility used by CLI validation paths.
|
|
13
|
+
Its goal is to reduce catastrophic-regex risk during interactive or deterministic pattern checks.
|
|
14
|
+
|
|
15
|
+
## Engine responsibilities
|
|
16
|
+
|
|
17
|
+
- Compile and evaluate regex patterns for CLI matching operations.
|
|
18
|
+
- Apply bounded execution timeout for regex test runs.
|
|
19
|
+
- Support case-insensitive prefix normalization.
|
|
20
|
+
- Fail safely on invalid patterns.
|
|
21
|
+
|
|
22
|
+
## Runtime flow
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
flowchart TD
|
|
26
|
+
A[Input text + raw pattern] --> N[Normalize pattern and flags]
|
|
27
|
+
N --> V[Run regex test in VM context]
|
|
28
|
+
V --> T{Execution outcome}
|
|
29
|
+
T -->|match/no match| OK[Return boolean result]
|
|
30
|
+
T -->|timeout| ERR[Throw timeout safety error]
|
|
31
|
+
T -->|invalid regex| SAFE[Return false]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Processing details
|
|
35
|
+
|
|
36
|
+
### Pattern normalization
|
|
37
|
+
|
|
38
|
+
- default flags are case-insensitive global matching
|
|
39
|
+
- inline prefix `(?i)` is normalized into case-insensitive behavior
|
|
40
|
+
|
|
41
|
+
### Safe execution boundary
|
|
42
|
+
|
|
43
|
+
- matching runs in a VM execution context
|
|
44
|
+
- timeout is bounded (default 100ms, configurable)
|
|
45
|
+
- timeout triggers explicit safety error describing potential ReDoS condition
|
|
46
|
+
|
|
47
|
+
### Failure behavior
|
|
48
|
+
|
|
49
|
+
- invalid regex syntax returns false
|
|
50
|
+
- timeout raises explicit error to surface risk
|
|
51
|
+
|
|
52
|
+
## Where this engine is used
|
|
53
|
+
|
|
54
|
+
- CLI test command pattern checks
|
|
55
|
+
- CLI wizard preview checks for rule creation paths
|
|
56
|
+
|
|
57
|
+
This utility is a CLI-side matcher.
|
|
58
|
+
Runtime layer interception/redaction uses separate utilities optimized for layer execution paths.
|
|
59
|
+
|
|
60
|
+
## Operational value
|
|
61
|
+
|
|
62
|
+
This engine provides:
|
|
63
|
+
- safer CLI pattern experimentation
|
|
64
|
+
- predictable behavior for bad regex input
|
|
65
|
+
- early signal for potentially catastrophic patterns
|
|
66
|
+
|
|
67
|
+
## Limits and caveats
|
|
68
|
+
|
|
69
|
+
- Timeout-based control reduces risk but does not replace regex quality review.
|
|
70
|
+
- Behavior is scoped to CLI matching paths, not all runtime matching paths.
|
|
71
|
+
- Very large inputs still increase work, even with timeout bounds.
|
|
72
|
+
|
|
73
|
+
## Validation checklist
|
|
74
|
+
|
|
75
|
+
1. Confirm normal pattern returns expected boolean.
|
|
76
|
+
2. Confirm invalid regex returns false without process crash.
|
|
77
|
+
3. Confirm catastrophic pattern triggers timeout safety error.
|
|
78
|
+
4. Confirm wizard/test commands produce consistent matching decisions.
|
|
79
|
+
|
|
80
|
+
## Related pages
|
|
81
|
+
- [engine index](README.md)
|
|
82
|
+
- [redaction](redaction.md)
|
|
83
|
+
- [performance](performance.md)
|
|
84
|
+
- [CLI test command](../operation/cli/test.md)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Navigation
|
|
89
|
+
- [Back to Engine Index](README.md)
|
|
90
|
+
- [Back to Wiki Index](../README.md)
|
|
91
|
+
|