@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
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Contributing to Berry Shield 🍓
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! To maintain the quality and security of Berry Shield, please follow these guidelines.
|
|
4
|
+
|
|
5
|
+
## 🤝 Support & Contributions
|
|
6
|
+
This project is actively maintained, but it's built and supported in my free time.
|
|
7
|
+
Issues, feedback, and Pull Requests are always welcome! While I can't promise immediate response times or a formal SLA, I do my best to review and help as soon as possible.
|
|
8
|
+
|
|
9
|
+
## 🛠️ Technical Requirements
|
|
10
|
+
Before submitting a Pull Request, ensure:
|
|
11
|
+
1. **Language:** Code, comments, and documentation must be in **English**.
|
|
12
|
+
2. **Technical Gates:** Your changes must pass all local checks:
|
|
13
|
+
- `npm run typecheck`
|
|
14
|
+
- `npm run test`
|
|
15
|
+
- `npm run build`
|
|
16
|
+
3. **Wiki:** If you added or changed features, update the relevant files in `docs/wiki/`.
|
|
17
|
+
|
|
18
|
+
## 🧬 Branching Model
|
|
19
|
+
Berry Shield uses a **trunk-based** flow:
|
|
20
|
+
1. Create a short-lived branch from `master`.
|
|
21
|
+
2. Open a Pull Request targeting `master`.
|
|
22
|
+
3. Merge after required checks and review pass.
|
|
23
|
+
|
|
24
|
+
## 📝 Commit & PR Standards
|
|
25
|
+
We use the **Conventional Commits** pattern for titles:
|
|
26
|
+
`type(scope): description`
|
|
27
|
+
*Examples: `feat(vine): add new heuristic`, `fix(stem): resolve file path bypass`*
|
|
28
|
+
|
|
29
|
+
Your Pull Request body must follow the provided template and include a **Validation** section explaining how you tested the changes.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
*By contributing to Berry Shield, you agree that your contributions will be licensed under the Apache-2.0 [LICENSE](LICENSE).*
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# 🍓 Berry Shield
|
|
2
|
+
|
|
3
|
+
Security plugin for OpenClaw that reduces data leakage risk and blocks unsafe operations in agent workflows.
|
|
4
|
+
|
|
5
|
+
## 🧐 Why this exists
|
|
6
|
+
|
|
7
|
+
Berry Shield was created from a practical problem: during routine setup checks, the agent could expose sensitive data directly in chat (API keys, tokens,
|
|
8
|
+
SSH material, and other secrets).
|
|
9
|
+
|
|
10
|
+
Typical examples included:
|
|
11
|
+
- reading config files that contained credentials (`openclaw.json`, `.env`, cloud credentials)
|
|
12
|
+
- returning sensitive command/file output without sanitization
|
|
13
|
+
- exposing private paths or secret-bearing content in normal troubleshooting flows
|
|
14
|
+
|
|
15
|
+
Design principles:
|
|
16
|
+
- Agents can read or execute sensitive operations by mistake.
|
|
17
|
+
- Prompt-only guardrails are not enough in real runtimes.
|
|
18
|
+
- Security controls must be visible, configurable, and testable from CLI.
|
|
19
|
+
|
|
20
|
+
The goal of `Berry Shield` is to reduce that risk in day-to-day usage by adding guardrails for access checks, runtime blocking, and output redaction.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ✓ What it is / ✗ What it is not
|
|
25
|
+
|
|
26
|
+
### ✓ What it is
|
|
27
|
+
|
|
28
|
+
- `Berry Shield` is an `OpenClaw` plugin that adds layered guardrails, audit, and redaction for agent workflows.
|
|
29
|
+
- Enforces a pre-flight security gate with `berry_check` before risky operations.
|
|
30
|
+
- Intercepts tool calls and blocks destructive or sensitive access patterns.
|
|
31
|
+
- Scans and redacts sensitive output before persistence and outbound delivery.
|
|
32
|
+
- Supports `enforce` and `audit` modes for rollout and validation.
|
|
33
|
+
- Provides CLI management for status, mode, policy, layers, rules, and report.
|
|
34
|
+
|
|
35
|
+
### ✗ What it is not
|
|
36
|
+
|
|
37
|
+
- Not a sandbox, VM, container isolation, or kernel boundary.
|
|
38
|
+
- Not a replacement for host hardening, least privilege, or secrets management.
|
|
39
|
+
- Not a guarantee against fully compromised hosts or malicious dependencies.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🧭 When to use / When not to use
|
|
44
|
+
|
|
45
|
+
### Use Berry Shield when
|
|
46
|
+
|
|
47
|
+
- Your agent has command/file capabilities and you need to reduce accidental leakage.
|
|
48
|
+
- You operate on chat surfaces where unsafe output can be exposed quickly.
|
|
49
|
+
- You need auditability for security decisions (`allowed`, `blocked`, `redacted`, `would_*`).
|
|
50
|
+
|
|
51
|
+
### Do not use Berry Shield as
|
|
52
|
+
|
|
53
|
+
- The only security boundary in untrusted multi-tenant environments.
|
|
54
|
+
- A compliance silver bullet without operational governance.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## ⚡ 90-second demo
|
|
59
|
+
|
|
60
|
+
Baseline runtime state before the demo (plugin enabled, `enforce` mode, all core layers active):
|
|
61
|
+
|
|
62
|
+
<img src="https://raw.githubusercontent.com/F4bioo/berry-shield/master/docs/assets/demo/berry-shield-status.jpeg" alt="Berry Shield Status" width="720" />
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### 1) Enforce: external-risk action is blocked (Vine)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# in chat/runtime: ingest external content with web_fetch, then preflight an exec write
|
|
70
|
+
bash -lc 'printf DEMO_VINE > /tmp/demo-vine-proof.txt'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Expected: denied in `enforce` after external untrusted ingestion.
|
|
74
|
+
|
|
75
|
+
<img src="https://raw.githubusercontent.com/F4bioo/berry-shield/master/docs/assets/demo/Berry.Vine-ENFORCE.gif" alt="Berry.Vine Enforce" />
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 2) Audit: same flow is allowed but logged as would_block
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# same write-like operation under audit mode
|
|
83
|
+
bash -lc 'printf VINE_AUDIT > /tmp/vine-audit-proof.txt'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Expected: allowed execution plus `would_block` evidence in report/audit logs.
|
|
87
|
+
|
|
88
|
+
<img src="https://raw.githubusercontent.com/F4bioo/berry-shield/master/docs/assets/demo/Berry.Vine-AUDIT.gif" alt="Berry.Vine Audit" />
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### 3) Sensitive file read is blocked (Stem)
|
|
93
|
+
|
|
94
|
+
Expected: denied read when attempting to access protected files.
|
|
95
|
+
|
|
96
|
+
<img src="https://raw.githubusercontent.com/F4bioo/berry-shield/master/docs/assets/demo/berry-shield-Berry.Stem-layer.jpeg" alt="Berry.Stem Block" width="520" />
|
|
97
|
+
|
|
98
|
+
Runtime evidence:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
2026-02-27T15:53:59.195Z [gateway] [berry-shield] Berry.Stem: DENIED read - sensitive file: /home/zyn/.openclaw/openclaw.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### 4) Redaction: sensitive output is sanitized (Pulp)
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
openclaw config get channels.telegram
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Expected: sensitive fields are masked in tool output, e.g. `botToken` becomes `[BOTTOKEN_REDACTED]`.
|
|
113
|
+
|
|
114
|
+
Why this matters: even read-only tools can still return sensitive values during normal operations.
|
|
115
|
+
Operator intent ("do not expose secrets") is useful, but not sufficient by itself; protection must happen in the output path.
|
|
116
|
+
|
|
117
|
+
Implementation basis:
|
|
118
|
+
- Berry.Pulp scans tool outputs at `tool_result_persist` and redacts matched secrets/PII before transcript persistence.
|
|
119
|
+
- Berry.Pulp also scans `message_sending` to redact sensitive data in outgoing assistant messages when supported by runtime hooks.
|
|
120
|
+
- In `audit`, events are logged as `would_redact`; in `enforce`, values are actively redacted.
|
|
121
|
+
|
|
122
|
+
Evidence (real redacted output):
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"enabled": true,
|
|
127
|
+
"dmPolicy": "pairing",
|
|
128
|
+
"botToken": "[BOTTOKEN_REDACTED]",
|
|
129
|
+
"groupPolicy": "allowlist",
|
|
130
|
+
"streaming": "partial"
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
<img src="https://raw.githubusercontent.com/F4bioo/berry-shield/master/docs/assets/demo/berry-shield-Berry.Pulp-layer.jpeg" alt="Berry.Pulp Redaction" width="520" />
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 🛡️ Security Audit & Installation Notice
|
|
139
|
+
|
|
140
|
+
> [!WARNING]
|
|
141
|
+
> **Expected heuristic warnings:**
|
|
142
|
+
> During `openclaw plugins install`, OpenClaw may flag patterns such as `child_process` usage and environment-based runtime resolution.
|
|
143
|
+
> In Berry Shield, these patterns are used for legitimate host integration (OpenClaw CLI/config bridge), not hidden execution paths.
|
|
144
|
+
>
|
|
145
|
+
> This is a heuristic warning, not a malware verdict.
|
|
146
|
+
> For a code-level mapping of each warning, see [Security Audit](SECURITY_AUDIT.md).
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## ⚡ Quickstart
|
|
151
|
+
|
|
152
|
+
Install from npm package:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
openclaw plugins install @f4bioo/berry-shield
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Note:** Berry Shield is plug-and-play after install. No extra setup is required for baseline protection.
|
|
159
|
+
|
|
160
|
+
See more:
|
|
161
|
+
- [Berry Shield Installation guide](docs/wiki/deploy/installation.md)
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
**Note:** If you want to customize mode, layers, or policy, use:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
openclaw bshield --help
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
See more:
|
|
172
|
+
- [Berry Shield CLI reference](docs/wiki/operation/cli/README.md)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 🧠 Mental model (single flow)
|
|
177
|
+
|
|
178
|
+
Berry Shield is designed with multiple layers. The idea is that if an interaction isn't caught by one layer, it might be caught by another.
|
|
179
|
+
|
|
180
|
+
<img src="https://raw.githubusercontent.com/F4bioo/berry-shield/master/docs/assets/demo/mental-model-single-flow.jpeg" alt="Mental Model Single Flow" />
|
|
181
|
+
|
|
182
|
+
## 🧬 Layers in plain language
|
|
183
|
+
|
|
184
|
+
| Layer | Purpose | Practical effect |
|
|
185
|
+
| :--- | :--- | :--- |
|
|
186
|
+
| **Leaf** 🍃 | **Input audit** | Logs sensitive signals in incoming content for observability. |
|
|
187
|
+
| **Root** 🌱 | **Prompt guard** | Injects security policy/reminders into agent context by profile strategy. |
|
|
188
|
+
| **Stem** 🪵 | **Security gate** | `berry_check` tool decides if intended operation is allowed or denied. |
|
|
189
|
+
| **Thorn** 🌵 | **Runtime blocker** | Intercepts tool calls and blocks risky command/file patterns in enforce mode. |
|
|
190
|
+
| **Vine** 🌿 | **External guard** | Marks external-content risk and can block sensitive actions under active risk. |
|
|
191
|
+
| **Pulp** 🍇 | **Output scanner** | Redacts sensitive data in tool results and outgoing messages in enforce mode. |
|
|
192
|
+
|
|
193
|
+
See more:
|
|
194
|
+
- [Berry Shield layers](docs/wiki/layers/README.md)
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## ⚙️ Modes and profiles
|
|
199
|
+
|
|
200
|
+
### Modes (`mode`)
|
|
201
|
+
|
|
202
|
+
| Mode | Behavior |
|
|
203
|
+
| :--- | :--- |
|
|
204
|
+
| `enforce` | **Active Defense**: Blocks/Redacts when patterns match. |
|
|
205
|
+
| `audit` | **Silent Observation**: Logs what *would* have happened (`would_block`, `would_redact`). |
|
|
206
|
+
|
|
207
|
+
### Profiles (`policy.profile`)
|
|
208
|
+
|
|
209
|
+
| Profile | Injection behavior |
|
|
210
|
+
| :--- | :--- |
|
|
211
|
+
| `strict` | **Full policy** injection every turn. |
|
|
212
|
+
| `balanced` | **Adaptive**: Full on first turn, then `short`/`none` depending on risk/staleness. |
|
|
213
|
+
| `minimal` | **Silent**: Minimal injection by default; escalates only on critical triggers. |
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
See more:
|
|
217
|
+
- [Berry Shield modes and profiles](docs/wiki/decision/modes.md)
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 🚧 Technical Limitations & SDK Diary
|
|
222
|
+
|
|
223
|
+
Berry Shield's effectiveness is tied to the underlying OpenClaw SDK capabilities. We maintain a detailed diary that tracks known bugs and blind spots across OpenClaw versions.
|
|
224
|
+
|
|
225
|
+
### Key Points for v2026.2.26:
|
|
226
|
+
* **Hook Reliability**: In our v2026.2.26 checkpoint, `before_tool_call` and `message_sending` were observed as functional, but hook behavior remains runtime/version-dependent.
|
|
227
|
+
* **Soft Guardrails**: Prompt-based defenses (`Berry.Root`) are advisory and can be bypassed by clever user instructions.
|
|
228
|
+
* **Timing Gaps**: Redaction happens during persistence, which might create a transient data exposure.
|
|
229
|
+
|
|
230
|
+
See more:
|
|
231
|
+
- [Security posture and known limits](docs/wiki/decision/posture.md)
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 📚 Docs map
|
|
236
|
+
|
|
237
|
+
- Wiki overview: [docs/wiki/README.md](docs/wiki/README.md)
|
|
238
|
+
- Install and deploy: [docs/wiki/deploy/installation.md](docs/wiki/deploy/installation.md)
|
|
239
|
+
- CLI commands: [docs/wiki/operation/cli/README.md](docs/wiki/operation/cli/README.md)
|
|
240
|
+
- Layer internals: [docs/wiki/layers/README.md](docs/wiki/layers/README.md)
|
|
241
|
+
- Mode/profile decisions: [docs/wiki/decision/modes.md](docs/wiki/decision/modes.md)
|
|
242
|
+
- Pattern strategy: [docs/wiki/decision/patterns.md](docs/wiki/decision/patterns.md)
|
|
243
|
+
- Tutorials: [docs/wiki/tutorials/README.md](docs/wiki/tutorials/README.md)
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## ⚖️ License
|
|
248
|
+
|
|
249
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
250
|
+
|
|
251
|
+
For contributor workflow and internal quality process, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Security-audit note that maps OpenClaw install-time heuristic warnings to Berry Shield source paths"
|
|
3
|
+
read_when:
|
|
4
|
+
- You saw OpenClaw install-time warnings and want a direct code-level explanation
|
|
5
|
+
- You are auditing why host integration patterns are flagged by static heuristics
|
|
6
|
+
title: "Security Audit"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# `Berry Shield Security Audit`
|
|
10
|
+
|
|
11
|
+
This project is open source and community-auditable by design.
|
|
12
|
+
|
|
13
|
+
During `openclaw plugins install`, OpenClaw may show heuristic warnings such as:
|
|
14
|
+
```text
|
|
15
|
+
WARNING: Plugin "berry-shield" contains dangerous code patterns: Shell command execution detected (child_process) (.../berry-shield/dist/index.js:xxxx); Environment variable access combined with network send — possible credential harvesting (.../berry-shield/dist/index.js:xxxx)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
For Berry Shield, these warnings are expected from legitimate host-integration behavior:
|
|
19
|
+
- `src/config/wrapper.ts:1` uses Node `child_process` invocation to call OpenClaw CLI config commands.
|
|
20
|
+
- `src/config/wrapper.ts:58` reads `OPENCLAW_EXECUTABLE` / `OPENCLAW_BIN` to resolve runtime binary path.
|
|
21
|
+
|
|
22
|
+
**Note:** Line numbers reported in `dist/index.js` can point to bundled code regions and are not always a direct 1:1 map to source declarations.
|
|
23
|
+
|
|
24
|
+
No hidden trust model is required:
|
|
25
|
+
- install if you want,
|
|
26
|
+
- audit if you want,
|
|
27
|
+
- verify directly in source.
|
|
28
|
+
|
|
29
|
+
## Positioning
|
|
30
|
+
|
|
31
|
+
- Berry Shield is explicit about security behavior and limits.
|
|
32
|
+
- Install-time warnings are treated as signals to inspect, not as automatic proof of malicious code.
|
|
33
|
+
- Documentation must map warnings to concrete code paths whenever possible.
|
|
34
|
+
|
|
35
|
+
## Why these patterns exist
|
|
36
|
+
|
|
37
|
+
Berry Shield needs host integration to read/write plugin config through OpenClaw itself.
|
|
38
|
+
Without this bridge, CLI and runtime config sync would be unreliable across environments.
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import { execFile } from "node:child_process";
|
|
42
|
+
|
|
43
|
+
function getOpenClawCommand() {
|
|
44
|
+
// Host/runtime override for different environments (dev, CI, custom install)
|
|
45
|
+
return process.env.OPENCLAW_EXECUTABLE || process.env.OPENCLAW_BIN || "openclaw";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function setPluginConfig(path, value) {
|
|
49
|
+
// Berry uses OpenClaw CLI as source of truth for persisted config
|
|
50
|
+
// (instead of writing random files directly).
|
|
51
|
+
const command = getOpenClawCommand();
|
|
52
|
+
await execFile(command, ["config", "set", path, JSON.stringify(value), "--json"]);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Source of truth: [`src/config/wrapper.ts`](src/config/wrapper.ts)
|
|
57
|
+
|
|
58
|
+
If this integration did not exist, Berry Shield would lose deterministic config behavior and cross-environment compatibility.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Verification
|
|
63
|
+
|
|
64
|
+
1. Verify installed plugin identity and runtime wiring:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
openclaw plugins info berry-shield
|
|
68
|
+
```
|
|
69
|
+
Expected output:
|
|
70
|
+
```terminaloutput
|
|
71
|
+
Berry Shield
|
|
72
|
+
id: berry-shield
|
|
73
|
+
Security plugin designed to mitigate flagged commands and redact detected secrets/PII
|
|
74
|
+
|
|
75
|
+
Status: loaded
|
|
76
|
+
Source: ~/.openclaw/extensions/berry-shield/dist/index.js
|
|
77
|
+
Origin: global
|
|
78
|
+
Version: 2026.2.15
|
|
79
|
+
Tools: berry_check
|
|
80
|
+
CLI commands: bshield
|
|
81
|
+
|
|
82
|
+
Install: path
|
|
83
|
+
Source path: ~/berry-shield
|
|
84
|
+
Install path: ~/.openclaw/extensions/berry-shield
|
|
85
|
+
Recorded version: 2026.2.15
|
|
86
|
+
Installed at: 2026-02-22T18:18:52.793Z
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Related pages
|
|
90
|
+
- [Installation Guide](docs/wiki/deploy/installation.md)
|
|
91
|
+
- [Security Posture](docs/wiki/decision/posture.md)
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Navigation
|
|
96
|
+
- [Back to Repository README](README.md)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Main wiki entrypoint with reading paths and full domain map"
|
|
3
|
+
read_when:
|
|
4
|
+
- You need a complete overview of Berry Shield documentation
|
|
5
|
+
- You are onboarding and need a recommended reading path
|
|
6
|
+
- You are looking for where each topic is documented
|
|
7
|
+
title: "Berry Shield Wiki"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# `Berry Shield Wiki`
|
|
11
|
+
|
|
12
|
+
Berry Shield documentation for OpenClaw operators, contributors, and maintainers.
|
|
13
|
+
This wiki follows a Diataxis-style split: tutorials, operations, decisions, internals, and deployment.
|
|
14
|
+
|
|
15
|
+
## Read This First
|
|
16
|
+
|
|
17
|
+
Berry Shield is an application-layer security plugin.
|
|
18
|
+
It can enforce guardrails, block risky operations, and sanitize output paths.
|
|
19
|
+
It is not host isolation or operating-system hardening.
|
|
20
|
+
|
|
21
|
+
Known host/runtime constraints are documented in:
|
|
22
|
+
- [Security Posture](decision/posture.md)
|
|
23
|
+
- [Security Audit (root)](../../SECURITY_AUDIT.md)
|
|
24
|
+
|
|
25
|
+
## Start Here (By Goal)
|
|
26
|
+
|
|
27
|
+
- First-time setup and validation:
|
|
28
|
+
- [Your First Secure Session](tutorials/secure-session.md)
|
|
29
|
+
- Choose behavior strategy before rollout:
|
|
30
|
+
- [Choose Your Profile](tutorials/choose-profile.md)
|
|
31
|
+
- [Tune Policy](tutorials/tune-policy.md)
|
|
32
|
+
- Roll out to real workloads safely:
|
|
33
|
+
- [Audit-to-Enforce Rollout](tutorials/audit-to-enforce-rollout.md)
|
|
34
|
+
- Investigate events and close coverage gaps:
|
|
35
|
+
- [Incident Triage with Report](tutorials/incident-triage-report.md)
|
|
36
|
+
|
|
37
|
+
## Wiki Map
|
|
38
|
+
|
|
39
|
+
### Tutorials (Learning-oriented)
|
|
40
|
+
Guided, step-by-step workflows for operators and new users.
|
|
41
|
+
|
|
42
|
+
- [Tutorial Index](tutorials/README.md)
|
|
43
|
+
- [Your First Secure Session](tutorials/secure-session.md)
|
|
44
|
+
- [Choose Your Profile](tutorials/choose-profile.md)
|
|
45
|
+
- [Tune Policy](tutorials/tune-policy.md)
|
|
46
|
+
- [Build Custom Rules](tutorials/build-custom-rules.md)
|
|
47
|
+
- [Audit-to-Enforce Rollout](tutorials/audit-to-enforce-rollout.md)
|
|
48
|
+
- [Incident Triage with Report](tutorials/incident-triage-report.md)
|
|
49
|
+
|
|
50
|
+
### Operation (How-to)
|
|
51
|
+
How to run Berry Shield through supported interaction surfaces.
|
|
52
|
+
|
|
53
|
+
- [Operation Index](operation/README.md)
|
|
54
|
+
- [CLI Reference](operation/cli/README.md)
|
|
55
|
+
- [Web Reference](operation/web/README.md)
|
|
56
|
+
|
|
57
|
+
### Decision (Explanation)
|
|
58
|
+
Why behavior is designed this way: mode semantics, pattern strategy, and explicit limits.
|
|
59
|
+
|
|
60
|
+
- [Decision Index](decision/README.md)
|
|
61
|
+
- [Modes](decision/modes.md)
|
|
62
|
+
- [Patterns](decision/patterns.md)
|
|
63
|
+
- [Security Posture](decision/posture.md)
|
|
64
|
+
|
|
65
|
+
### Layers (Architecture)
|
|
66
|
+
Cross-layer model and responsibilities for Root, Leaf, Stem, Thorn, and Pulp.
|
|
67
|
+
|
|
68
|
+
- [Layers Index](layers/README.md)
|
|
69
|
+
- [Root](layers/root.md)
|
|
70
|
+
- [Leaf](layers/leaf.md)
|
|
71
|
+
- [Stem](layers/stem.md)
|
|
72
|
+
- [Thorn](layers/thorn.md)
|
|
73
|
+
- [Pulp](layers/pulp.md)
|
|
74
|
+
|
|
75
|
+
### Engine (Internals)
|
|
76
|
+
Detection/transformation internals and runtime cost model.
|
|
77
|
+
|
|
78
|
+
- [Engine Index](engine/README.md)
|
|
79
|
+
- [Redaction](engine/redaction.md)
|
|
80
|
+
- [Match Engine](engine/match-engine.md)
|
|
81
|
+
- [Performance](engine/performance.md)
|
|
82
|
+
|
|
83
|
+
### Deploy (Build and release operations)
|
|
84
|
+
Installation tracks, build gates, and doc quality gates.
|
|
85
|
+
|
|
86
|
+
- [Deploy Index](deploy/README.md)
|
|
87
|
+
- [Installation](deploy/installation.md)
|
|
88
|
+
- [Build](deploy/build.md)
|
|
89
|
+
- [Auditing](deploy/auditing.md)
|
|
90
|
+
|
|
91
|
+
## Suggested Reading Paths
|
|
92
|
+
|
|
93
|
+
- Operator path:
|
|
94
|
+
- `tutorials/secure-session.md` -> `operation/cli/README.md` -> `decision/modes.md`
|
|
95
|
+
- Security-review path:
|
|
96
|
+
- `decision/posture.md` -> `layers/README.md` -> `engine/redaction.md`
|
|
97
|
+
- Contributor path:
|
|
98
|
+
- `layers/README.md` -> `engine/README.md` -> `deploy/build.md`
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
> [!WARNING]
|
|
103
|
+
> This wiki is actively maintained. If runtime behavior changes, update docs in the same change set.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Navigation
|
|
108
|
+
- [Back to Repository README](../../README.md)
|