break-anything 0.0.0-stage → 0.1.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/DISCLAIMER.md +44 -0
- package/LICENSE +21 -0
- package/README.md +251 -2
- package/bin/brk.js +168 -0
- package/docs/assets/break-flow.svg +54 -0
- package/docs/hero-gif.md +53 -0
- package/docs/installation.md +73 -0
- package/docs/launch.md +82 -0
- package/docs/mcp-tools.md +62 -0
- package/docs/readme/README_zh.md +209 -0
- package/package.json +48 -4
- package/src/epss.js +28 -0
- package/src/http.js +44 -0
- package/src/image.js +114 -0
- package/src/lockfiles.js +118 -0
- package/src/mcp.js +101 -0
- package/src/osv.js +92 -0
- package/src/reachability.js +66 -0
- package/src/report.js +124 -0
- package/src/scan.js +93 -0
- package/src/secrets.js +160 -0
package/DISCLAIMER.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Responsible use
|
|
2
|
+
|
|
3
|
+
Break Anything is a **defensive security tool**. It helps you find, prove, and fix
|
|
4
|
+
vulnerabilities in software **you own or are explicitly authorized to test**.
|
|
5
|
+
|
|
6
|
+
## Authorized scope only
|
|
7
|
+
|
|
8
|
+
Use Break Anything only against:
|
|
9
|
+
|
|
10
|
+
- code, dependencies, images, and infrastructure that you own;
|
|
11
|
+
- systems you have **written, contractual authorization** to test (e.g. a pentest engagement
|
|
12
|
+
with a signed scope);
|
|
13
|
+
- deliberately vulnerable labs and open-source projects intended for security practice.
|
|
14
|
+
|
|
15
|
+
Do **not** point Break Anything — especially its dynamic (running-app and API) capabilities — at
|
|
16
|
+
any system you do not own or are not authorized to test. Unauthorized testing of computer systems
|
|
17
|
+
is illegal in most jurisdictions and is not supported by this project.
|
|
18
|
+
|
|
19
|
+
## Safety defaults
|
|
20
|
+
|
|
21
|
+
- **Dynamic capabilities are off by default.** Running-app scanning, API testing, and any
|
|
22
|
+
capability that sends traffic to a target require both an operator policy and an explicit
|
|
23
|
+
per-run authorization flag.
|
|
24
|
+
- **Static analysis reads your files; it does not run them.**
|
|
25
|
+
- **Proof-of-concept output targets your own build.** Break Anything is designed to demonstrate a
|
|
26
|
+
weakness against your target so you can fix it — not to produce reusable weapons against third
|
|
27
|
+
parties.
|
|
28
|
+
- **Analysis is local.** Break Anything does not ship your code to a hosted analysis service. The
|
|
29
|
+
coding agent and model provider you use have their own data policies.
|
|
30
|
+
|
|
31
|
+
## Not weaponization
|
|
32
|
+
|
|
33
|
+
Break Anything orchestrates well-known security tooling to help defenders. It is not intended for
|
|
34
|
+
developing malware, building attack infrastructure, targeting systems at scale, or evading the
|
|
35
|
+
defenses of systems you do not control. Contributions that turn it in those directions will be
|
|
36
|
+
declined.
|
|
37
|
+
|
|
38
|
+
## Your responsibility
|
|
39
|
+
|
|
40
|
+
You are responsible for using Break Anything in compliance with all applicable laws and
|
|
41
|
+
regulations, and with the license terms of every third-party tool it orchestrates. If you are
|
|
42
|
+
unsure whether you are authorized to test a given target, assume you are not.
|
|
43
|
+
|
|
44
|
+
Report security issues in Break Anything itself through the process in [SECURITY.md](SECURITY.md).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Break Anything contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,252 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [简体中文](docs/readme/README_zh.md)
|
|
4
|
+
|
|
5
|
+
# Break Anything
|
|
6
|
+
|
|
7
|
+
### One MCP for finding vulnerabilities across code, dependencies, apps, and infrastructure.
|
|
8
|
+
|
|
9
|
+
**Break it before they do. Point your agent at software you own, find the weakness, prove it, fix it.**
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/break-anything)
|
|
12
|
+
[](docs/mcp-tools.md)
|
|
13
|
+
[](DISCLAIMER.md)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
|
|
16
|
+
**[Quick start](#quick-start) · [How it works](#how-break-anything-works) · [What you can test](#what-you-can-test) · [Showcases](#showcases) · [FAQ](#faq) · [Companion: Patch Anything](#companion-patch-anything)**
|
|
17
|
+
|
|
18
|
+
<code>npx break-anything setup</code>
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
> [!IMPORTANT]
|
|
23
|
+
> Break Anything finds weaknesses in software **you own or are explicitly authorized to test**.
|
|
24
|
+
> It is a defensive, white-box security tool: every finding comes with evidence and a
|
|
25
|
+
> remediation path, and every proof-of-concept runs against your own target.
|
|
26
|
+
> It is not an attack framework and must not be pointed at third-party systems.
|
|
27
|
+
|
|
28
|
+
> [!WARNING]
|
|
29
|
+
> Get Break Anything only from the official sources listed in this README and in the
|
|
30
|
+
> `break-anything` npm package. A similar repository name or a copied README does not
|
|
31
|
+
> make a download official.
|
|
32
|
+
|
|
33
|
+
<div align="center">
|
|
34
|
+
|
|
35
|
+
<!-- Record with: asciinema rec hero.cast -c "bash demos/hero-demo.sh" && agg hero.cast docs/assets/hero.gif -->
|
|
36
|
+
<img src="docs/assets/hero.gif" alt="Break Anything finding reachable CVEs and a secret buried in git history" width="900" />
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
See a vulnerability land in the news and wonder whether *your* project is exposed? Ask your agent
|
|
43
|
+
to check it with Break Anything. It inspects your code, dependencies, running app, and
|
|
44
|
+
infrastructure without you learning ten different scanners, explains **where** you are
|
|
45
|
+
vulnerable, proves it with a reproducible finding, and hands a fix plan to your agent — or to
|
|
46
|
+
[Patch Anything](#companion-patch-anything).
|
|
47
|
+
|
|
48
|
+
Break Anything connects your coding agent to mature security tooling (Semgrep, CodeQL, OSV,
|
|
49
|
+
Trivy, Grype, Nuclei, ZAP, gitleaks, and more) through one consistent interface. You can also
|
|
50
|
+
run the same capabilities from your terminal. Analysis runs locally, and every result carries
|
|
51
|
+
the evidence, the exploitability signal, and the limitations behind it.
|
|
52
|
+
|
|
53
|
+
Most scanners stop at "here is a CVE list, bump the version." Break Anything goes further: it
|
|
54
|
+
reasons about whether a finding is **actually reachable in your usage**, builds a
|
|
55
|
+
proof-of-concept against **your own** target, and — when upstream has no fix — proposes a patch,
|
|
56
|
+
a shim, or a mitigation so an abandoned dependency does not become your breach.
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
### Set up your agent
|
|
61
|
+
|
|
62
|
+
With Node.js and npm installed, run:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx break-anything setup
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Choose your agents, review the proposed changes, and approve them. Setup registers Break
|
|
69
|
+
Anything's MCP server and installs matching workflow instructions, with backups of existing
|
|
70
|
+
configuration. Restart your agent afterward.
|
|
71
|
+
|
|
72
|
+
Setup supports Claude Code, Codex, Cursor, Gemini CLI, Windsurf, and any client that can run a
|
|
73
|
+
local MCP server. See [installation](docs/installation.md) for manual registration.
|
|
74
|
+
|
|
75
|
+
### Ask your agent
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Use Break Anything to check my project for vulnerabilities. Prioritise anything
|
|
79
|
+
that is actually reachable in my code, prove it against my local build, and give
|
|
80
|
+
me a fix plan.
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Replace the request with your target — a repository, a lockfile, a running localhost app, a
|
|
84
|
+
container image, or a Terraform directory.
|
|
85
|
+
|
|
86
|
+
### Use the terminal
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Dependencies: known CVEs ranked by reachability + EPSS, with fix versions
|
|
90
|
+
npx -y break-anything deps ./
|
|
91
|
+
|
|
92
|
+
# Secrets: leaked keys in the working tree and (with --history) git history
|
|
93
|
+
npx -y break-anything secrets ./ --history
|
|
94
|
+
|
|
95
|
+
# Container image: OS + app CVEs via Trivy
|
|
96
|
+
npx -y break-anything image my-service:latest
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> Shipped today: `deps`, `secrets`, `image`, and the matching MCP tools. The rest of the
|
|
100
|
+
> [tool catalog](docs/mcp-tools.md) is the roadmap, landing incrementally.
|
|
101
|
+
|
|
102
|
+
To install the `brk` command for regular use:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm install --global break-anything
|
|
106
|
+
brk --help
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> The CLI command is `brk` (not `break`, which is a shell keyword).
|
|
110
|
+
|
|
111
|
+
### Update
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
brk update
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## How Break Anything works
|
|
118
|
+
|
|
119
|
+
Your agent calls Break Anything through MCP to inspect a target you control. Break Anything
|
|
120
|
+
returns each finding with its evidence, an exploitability signal, and a suggested remediation.
|
|
121
|
+
The agent uses that to prioritise, reproduce, and fix. CLI commands use the same workflows.
|
|
122
|
+
|
|
123
|
+

|
|
124
|
+
|
|
125
|
+
The investigation model:
|
|
126
|
+
|
|
127
|
+
| Stage | What happens |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| **Find** | Enumerate weaknesses across dependencies, source, running app, and infrastructure. |
|
|
130
|
+
| **Prove** | Confirm the finding is reachable in your usage and build a proof-of-concept against *your* target. |
|
|
131
|
+
| **Fix** | Produce a patch, pin, shim, or mitigation — directly, or by handing off to Patch Anything. |
|
|
132
|
+
|
|
133
|
+
Break Anything shows how it reached each conclusion. It separates "confirmed exploitable",
|
|
134
|
+
"reachable but unproven", and "present but not reachable" instead of drowning you in noise.
|
|
135
|
+
|
|
136
|
+
## What you can test
|
|
137
|
+
|
|
138
|
+
| Target | What Break Anything returns | Requirements |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| Dependency manifests | Known CVEs across `package-lock`, `requirements.txt`, `go.mod`, `composer.lock`, `pom.xml`, `Cargo.toml`; EPSS exploit probability; CISA KEV status; fix versions; call-path reachability | OSV / GHSA (built-in); reachability uses local source |
|
|
141
|
+
| Source code | Injection, broken access control, insecure deserialization, path traversal, SSRF, hardcoded secrets — with data-flow evidence | Semgrep / CodeQL rulepacks |
|
|
142
|
+
| Secrets in repo + git history | Exposed API keys, tokens, private keys, and where they leaked | gitleaks / trufflehog style scan |
|
|
143
|
+
| Running web app (your host) | OWASP Top 10 dynamic findings against an authorized localhost or staging target | A Chrome-family browser; OWASP ZAP |
|
|
144
|
+
| HTTP APIs (your host) | Broken access control, IDOR, auth bypass, mass assignment — with a reproducible request | Authorized base URL + credentials |
|
|
145
|
+
| Container images | OS and application-layer CVEs, misconfigurations, exposed secrets in layers | Trivy / Grype |
|
|
146
|
+
| Dockerfile / IaC | Misconfigurations in Dockerfile, Terraform, Kubernetes, CloudFormation | Trivy / checkov rulepacks |
|
|
147
|
+
| Web frontend bundles | Vulnerable JS libraries and secrets shipped to the browser | Node.js + npm |
|
|
148
|
+
| Compiled artifacts | Known-vulnerable bundled dependencies and memory-safety smells | Static inspection |
|
|
149
|
+
| Smart contracts (optional) | Reentrancy, integer overflow, access-control gaps in Solidity | Slither |
|
|
150
|
+
|
|
151
|
+
Every dynamic capability is **disabled by default** and requires both an operator policy and an
|
|
152
|
+
explicit per-run authorization flag. Static inspection reads your files without running them.
|
|
153
|
+
|
|
154
|
+
## Showcases
|
|
155
|
+
|
|
156
|
+
Ten worked demos — **all on targets you own, open-source projects, or deliberately vulnerable
|
|
157
|
+
labs**. See [`demos/`](demos/) for the full scripts.
|
|
158
|
+
|
|
159
|
+
1. **OWASP Juice Shop** — point at the authorized lab, find an IDOR, prove it with a request, explain the fix.
|
|
160
|
+
2. **The dependency you forgot** — an old `lodash`/`minimist` in your lockfile: find it, confirm the vulnerable function is actually called, get the fix version.
|
|
161
|
+
3. **PHP supply chain after php2shell** — a PHP project pinned to a vulnerable `composer` dependency: Break Anything maps your whole dependency chain so the *next* php2shell does not catch you blind.
|
|
162
|
+
4. **Log4Shell lab** — a Java service with a vulnerable `log4j`: confirm reachability through your logging path, not just presence.
|
|
163
|
+
5. **Leaked key** — a test repo with an AWS key committed three months ago: find it in history, show the blast radius.
|
|
164
|
+
6. **Vulnerable base image** — a `Dockerfile` on an outdated base: list OS + app CVEs and the minimal bump.
|
|
165
|
+
7. **Public bucket** — a Terraform file that makes an S3 bucket world-readable: catch it before `apply`.
|
|
166
|
+
8. **Your own Express API** — an IDOR on `/orders/:id`: prove it against localhost with two accounts.
|
|
167
|
+
9. **Reentrancy** — a Solidity contract in a lab: trace the external call before the state update.
|
|
168
|
+
10. **Find → Fix handoff** — hand any finding above to [Patch Anything](#companion-patch-anything) and watch the fix PR get drafted.
|
|
169
|
+
|
|
170
|
+
If you break something interesting (that you are allowed to break), open an issue or PR with the
|
|
171
|
+
target, your question, and what you found.
|
|
172
|
+
|
|
173
|
+
## Companion: Patch Anything
|
|
174
|
+
|
|
175
|
+
Break Anything and [Patch Anything](https://github.com/PatchAnything/patch-anything) are built to
|
|
176
|
+
work as a pair:
|
|
177
|
+
|
|
178
|
+
> **Break Anything** finds it and proves it → **Patch Anything** fixes it.
|
|
179
|
+
|
|
180
|
+
When Break Anything surfaces a finding, your agent can hand it straight to Patch Anything, which
|
|
181
|
+
generates a patch, a dependency bump, a compatibility shim, or — when upstream is dead — a
|
|
182
|
+
maintained fork or local mitigation. One is offense-flavoured discovery; the other is defensive
|
|
183
|
+
repair. Use either alone, or run the loop end to end.
|
|
184
|
+
|
|
185
|
+
## FAQ
|
|
186
|
+
|
|
187
|
+
<details>
|
|
188
|
+
<summary><strong>Is this an attack tool? Will it get my repo taken down?</strong></summary>
|
|
189
|
+
|
|
190
|
+
No. Break Anything is a defensive, white-box tool for software you own or are authorized to
|
|
191
|
+
test. Every proof-of-concept runs against your own target; it ships no weaponized exploits for
|
|
192
|
+
third-party systems. See [DISCLAIMER.md](DISCLAIMER.md). GitHub's policy explicitly supports
|
|
193
|
+
dual-use security research.
|
|
194
|
+
|
|
195
|
+
</details>
|
|
196
|
+
|
|
197
|
+
<details>
|
|
198
|
+
<summary><strong>How is this different from `npm audit` / Trivy / Snyk?</strong></summary>
|
|
199
|
+
|
|
200
|
+
Those report presence. Break Anything adds **reachability** (is the vulnerable code actually
|
|
201
|
+
called in your project), **proof** (a PoC against your own build), and **self-remediation** when
|
|
202
|
+
upstream has no fix. It also unifies dependency, source, runtime, and infrastructure findings
|
|
203
|
+
behind one agent interface.
|
|
204
|
+
|
|
205
|
+
</details>
|
|
206
|
+
|
|
207
|
+
<details>
|
|
208
|
+
<summary><strong>Which agents can use it?</strong></summary>
|
|
209
|
+
|
|
210
|
+
Any agent that supports local MCP servers. Setup configures the common ones automatically;
|
|
211
|
+
others can use manual MCP registration.
|
|
212
|
+
|
|
213
|
+
</details>
|
|
214
|
+
|
|
215
|
+
<details>
|
|
216
|
+
<summary><strong>Does it upload my code?</strong></summary>
|
|
217
|
+
|
|
218
|
+
Analysis runs locally. Your agent receives the tool results, and its model provider has its own
|
|
219
|
+
data policy — review that separately.
|
|
220
|
+
|
|
221
|
+
</details>
|
|
222
|
+
|
|
223
|
+
<details>
|
|
224
|
+
<summary><strong>Can it test a site I do not own?</strong></summary>
|
|
225
|
+
|
|
226
|
+
No. Dynamic capabilities require an explicit authorization flag and are intended for your own or
|
|
227
|
+
contractually authorized targets. Testing systems without authorization is illegal and
|
|
228
|
+
unsupported.
|
|
229
|
+
|
|
230
|
+
</details>
|
|
231
|
+
|
|
232
|
+
## Documentation
|
|
233
|
+
|
|
234
|
+
- [Installation and setup](docs/installation.md)
|
|
235
|
+
- [MCP tool catalog](docs/mcp-tools.md)
|
|
236
|
+
- [Security model](SECURITY.md)
|
|
237
|
+
- [Responsible use](DISCLAIMER.md)
|
|
238
|
+
|
|
239
|
+
## Disclaimer
|
|
240
|
+
|
|
241
|
+
Break Anything is for lawful security research, education, and testing of software you own or are
|
|
242
|
+
authorized to examine. See [DISCLAIMER.md](DISCLAIMER.md) for responsible-use guidance. You are
|
|
243
|
+
responsible for using this software in compliance with all applicable laws and the terms of any
|
|
244
|
+
third-party tool it orchestrates.
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
[MIT](LICENSE)
|
|
249
|
+
|
|
250
|
+
Break-authored code is licensed under MIT. Third-party tools it orchestrates (Semgrep, CodeQL,
|
|
251
|
+
Trivy, Grype, Nuclei, ZAP, and others) retain their own licenses; you must obtain and use them
|
|
252
|
+
under their applicable terms.
|
package/bin/brk.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { scanDependencies } from "../src/scan.js";
|
|
3
|
+
import { renderHuman } from "../src/report.js";
|
|
4
|
+
|
|
5
|
+
const VERSION = "0.1.0";
|
|
6
|
+
|
|
7
|
+
const HELP = `Break Anything (brk) v${VERSION}
|
|
8
|
+
点你的 Agent 指向你拥有或已授权的软件,找到漏洞、证明它、修好它。
|
|
9
|
+
|
|
10
|
+
用法:
|
|
11
|
+
brk deps [path] 扫描依赖 lockfile 的已知漏洞(默认当前目录)
|
|
12
|
+
brk secrets [path] 扫描泄露的密钥(工作区,--history 加扫 git 历史)
|
|
13
|
+
brk image <ref> 扫描容器镜像的已知漏洞(需 trivy)
|
|
14
|
+
brk mcp 以 MCP server 模式启动(供 Agent 调用)
|
|
15
|
+
brk doctor 检查运行环境与网络连通性
|
|
16
|
+
brk setup 打印把 Break Anything 接入 Agent 的 MCP 配置
|
|
17
|
+
brk --help 显示本帮助
|
|
18
|
+
brk --version 显示版本
|
|
19
|
+
|
|
20
|
+
通用选项:
|
|
21
|
+
--json 输出 JSON(用于脚本 / Agent)
|
|
22
|
+
--no-color 关闭彩色输出
|
|
23
|
+
deps 选项:
|
|
24
|
+
--no-reachability 跳过源码可达性初判
|
|
25
|
+
secrets 选项:
|
|
26
|
+
--history 加扫 git 历史中的密钥
|
|
27
|
+
|
|
28
|
+
范围声明:只对你拥有、或已获得明确授权的目标使用。详见 DISCLAIMER.md。
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
function parseFlags(argv) {
|
|
32
|
+
const flags = {};
|
|
33
|
+
const positional = [];
|
|
34
|
+
for (const a of argv) {
|
|
35
|
+
if (a === "--json") flags.json = true;
|
|
36
|
+
else if (a === "--no-reachability") flags.reachability = false;
|
|
37
|
+
else if (a === "--no-color") flags.color = false;
|
|
38
|
+
else if (a.startsWith("--")) flags[a.slice(2)] = true;
|
|
39
|
+
else positional.push(a);
|
|
40
|
+
}
|
|
41
|
+
return { flags, positional };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function main() {
|
|
45
|
+
const [cmd, ...rest] = process.argv.slice(2);
|
|
46
|
+
|
|
47
|
+
if (!cmd || cmd === "--help" || cmd === "-h" || cmd === "help") {
|
|
48
|
+
process.stdout.write(HELP);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (cmd === "--version" || cmd === "-v") {
|
|
52
|
+
process.stdout.write(VERSION + "\n");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (cmd === "mcp") {
|
|
57
|
+
const { startMcpServer } = await import("../src/mcp.js");
|
|
58
|
+
await startMcpServer();
|
|
59
|
+
return; // 保持进程存活
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (cmd === "deps") {
|
|
63
|
+
const { flags, positional } = parseFlags(rest);
|
|
64
|
+
const target = positional[0] || process.cwd();
|
|
65
|
+
const result = await scanDependencies(target, {
|
|
66
|
+
reachability: flags.reachability !== false,
|
|
67
|
+
});
|
|
68
|
+
if (flags.json) {
|
|
69
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
70
|
+
} else {
|
|
71
|
+
const color = flags.color !== false && process.stdout.isTTY;
|
|
72
|
+
process.stdout.write(renderHuman(result, { color }) + "\n");
|
|
73
|
+
}
|
|
74
|
+
// 有高危且可达的发现时用非零退出码,方便接 CI
|
|
75
|
+
const hasReachableHigh = result.findings?.some(
|
|
76
|
+
(f) => f.reachability === "imported" && (f.severity === "CRITICAL" || f.severity === "HIGH"),
|
|
77
|
+
);
|
|
78
|
+
process.exitCode = hasReachableHigh ? 1 : 0;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (cmd === "secrets") {
|
|
83
|
+
const { flags, positional } = parseFlags(rest);
|
|
84
|
+
const target = positional[0] || process.cwd();
|
|
85
|
+
const { scanSecrets } = await import("../src/secrets.js");
|
|
86
|
+
const { renderSecrets } = await import("../src/report.js");
|
|
87
|
+
const result = await scanSecrets(target, { history: !!flags.history });
|
|
88
|
+
if (flags.json) {
|
|
89
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
90
|
+
} else {
|
|
91
|
+
const color = flags.color !== false && process.stdout.isTTY;
|
|
92
|
+
process.stdout.write(renderSecrets(result, { color }) + "\n");
|
|
93
|
+
}
|
|
94
|
+
process.exitCode = result.findings.length ? 1 : 0;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (cmd === "image") {
|
|
99
|
+
const { flags, positional } = parseFlags(rest);
|
|
100
|
+
const ref = positional[0];
|
|
101
|
+
if (!ref) {
|
|
102
|
+
process.stderr.write("用法:brk image <镜像引用>,例如 brk image nginx:1.21\n");
|
|
103
|
+
process.exitCode = 2;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const { scanImage } = await import("../src/image.js");
|
|
107
|
+
const { renderImage } = await import("../src/report.js");
|
|
108
|
+
const result = await scanImage(ref);
|
|
109
|
+
if (flags.json) {
|
|
110
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
111
|
+
} else {
|
|
112
|
+
const color = flags.color !== false && process.stdout.isTTY;
|
|
113
|
+
process.stdout.write(renderImage(result, { color }) + "\n");
|
|
114
|
+
}
|
|
115
|
+
const hasHigh = result.findings?.some((f) => f.severity === "CRITICAL" || f.severity === "HIGH");
|
|
116
|
+
process.exitCode = hasHigh ? 1 : 0;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (cmd === "doctor") {
|
|
121
|
+
await doctor();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (cmd === "setup") {
|
|
126
|
+
printSetup();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
process.stderr.write(`未知命令:${cmd}\n\n${HELP}`);
|
|
131
|
+
process.exitCode = 2;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function doctor() {
|
|
135
|
+
const out = [];
|
|
136
|
+
const [maj] = process.versions.node.split(".").map(Number);
|
|
137
|
+
out.push(`Node.js ${process.versions.node} ${maj >= 18 ? "✓" : "✗ 需要 >= 18.17"}`);
|
|
138
|
+
try {
|
|
139
|
+
const { fetchJson } = await import("../src/http.js");
|
|
140
|
+
await fetchJson("https://api.osv.dev/v1/query", {
|
|
141
|
+
method: "POST",
|
|
142
|
+
body: { version: "4.17.4", package: { name: "lodash", ecosystem: "npm" } },
|
|
143
|
+
timeoutMs: 8000,
|
|
144
|
+
});
|
|
145
|
+
out.push("OSV API 可达 ✓");
|
|
146
|
+
} catch (e) {
|
|
147
|
+
out.push(`OSV API 不可达 ✗ (${e instanceof Error ? e.message : e})`);
|
|
148
|
+
}
|
|
149
|
+
process.stdout.write(out.join("\n") + "\n");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function printSetup() {
|
|
153
|
+
const config = {
|
|
154
|
+
mcpServers: {
|
|
155
|
+
"break-anything": { command: "npx", args: ["-y", "break-anything", "mcp"] },
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
process.stdout.write(
|
|
159
|
+
"把下面的配置加入你的 MCP 客户端(Claude Code / Cursor / Codex 等):\n\n" +
|
|
160
|
+
JSON.stringify(config, null, 2) +
|
|
161
|
+
"\n\n然后重启 Agent,对它说:用 Break Anything 扫描我的项目依赖。\n",
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
main().catch((err) => {
|
|
166
|
+
process.stderr.write(`错误:${err instanceof Error ? err.stack || err.message : String(err)}\n`);
|
|
167
|
+
process.exitCode = 1;
|
|
168
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1180 360" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif">
|
|
2
|
+
<defs>
|
|
3
|
+
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth">
|
|
4
|
+
<path d="M0,0 L8,3 L0,6 Z" fill="#8b93a7"/>
|
|
5
|
+
</marker>
|
|
6
|
+
<style>
|
|
7
|
+
.box{rx:12;ry:12;stroke-width:1.5;}
|
|
8
|
+
.t{fill:#0f1222;font-size:15px;font-weight:600;}
|
|
9
|
+
.s{fill:#5b6478;font-size:12px;}
|
|
10
|
+
.lbl{fill:#8b93a7;font-size:11px;}
|
|
11
|
+
</style>
|
|
12
|
+
</defs>
|
|
13
|
+
|
|
14
|
+
<rect x="24" y="140" width="180" height="80" class="box" fill="#eef1fb" stroke="#5c4ee5"/>
|
|
15
|
+
<text x="114" y="172" text-anchor="middle" class="t">Coding agent</text>
|
|
16
|
+
<text x="114" y="194" text-anchor="middle" class="s">or your terminal</text>
|
|
17
|
+
|
|
18
|
+
<line x1="204" y1="180" x2="300" y2="180" stroke="#8b93a7" stroke-width="1.5" marker-end="url(#arrow)"/>
|
|
19
|
+
|
|
20
|
+
<rect x="304" y="130" width="200" height="100" class="box" fill="#f4f6fd" stroke="#5c4ee5"/>
|
|
21
|
+
<text x="404" y="166" text-anchor="middle" class="t">Break Anything</text>
|
|
22
|
+
<text x="404" y="188" text-anchor="middle" class="s">CLI + MCP</text>
|
|
23
|
+
<text x="404" y="208" text-anchor="middle" class="s">capability router</text>
|
|
24
|
+
|
|
25
|
+
<line x1="504" y1="180" x2="600" y2="180" stroke="#8b93a7" stroke-width="1.5" marker-end="url(#arrow)"/>
|
|
26
|
+
|
|
27
|
+
<rect x="604" y="40" width="200" height="56" class="box" fill="#fff" stroke="#c7ccda"/>
|
|
28
|
+
<text x="704" y="66" text-anchor="middle" class="t">Dependencies</text>
|
|
29
|
+
<text x="704" y="84" text-anchor="middle" class="lbl">OSV · GHSA · EPSS · KEV</text>
|
|
30
|
+
|
|
31
|
+
<rect x="604" y="110" width="200" height="56" class="box" fill="#fff" stroke="#c7ccda"/>
|
|
32
|
+
<text x="704" y="136" text-anchor="middle" class="t">Source (SAST)</text>
|
|
33
|
+
<text x="704" y="154" text-anchor="middle" class="lbl">Semgrep · CodeQL · gitleaks</text>
|
|
34
|
+
|
|
35
|
+
<rect x="604" y="180" width="200" height="56" class="box" fill="#fff" stroke="#c7ccda"/>
|
|
36
|
+
<text x="704" y="206" text-anchor="middle" class="t">Running app (DAST)</text>
|
|
37
|
+
<text x="704" y="224" text-anchor="middle" class="lbl">ZAP · Nuclei · API tests</text>
|
|
38
|
+
|
|
39
|
+
<rect x="604" y="250" width="200" height="56" class="box" fill="#fff" stroke="#c7ccda"/>
|
|
40
|
+
<text x="704" y="276" text-anchor="middle" class="t">Images · IaC</text>
|
|
41
|
+
<text x="704" y="294" text-anchor="middle" class="lbl">Trivy · Grype · checkov</text>
|
|
42
|
+
|
|
43
|
+
<line x1="804" y1="68" x2="900" y2="150" stroke="#8b93a7" stroke-width="1.5" marker-end="url(#arrow)"/>
|
|
44
|
+
<line x1="804" y1="138" x2="900" y2="168" stroke="#8b93a7" stroke-width="1.5" marker-end="url(#arrow)"/>
|
|
45
|
+
<line x1="804" y1="208" x2="900" y2="190" stroke="#8b93a7" stroke-width="1.5" marker-end="url(#arrow)"/>
|
|
46
|
+
<line x1="804" y1="278" x2="900" y2="210" stroke="#8b93a7" stroke-width="1.5" marker-end="url(#arrow)"/>
|
|
47
|
+
|
|
48
|
+
<rect x="904" y="130" width="250" height="100" class="box" fill="#eafaf0" stroke="#1f9d57"/>
|
|
49
|
+
<text x="1029" y="162" text-anchor="middle" class="t">Findings + evidence</text>
|
|
50
|
+
<text x="1029" y="184" text-anchor="middle" class="s">reachability · PoC on your target</text>
|
|
51
|
+
<text x="1029" y="206" text-anchor="middle" class="s">→ fix plan / Patch Anything</text>
|
|
52
|
+
|
|
53
|
+
<text x="590" y="332" text-anchor="middle" class="lbl">Authorized targets only — software you own or are explicitly permitted to test</text>
|
|
54
|
+
</svg>
|
package/docs/hero-gif.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Hero GIF — recording recipe
|
|
2
|
+
|
|
3
|
+
The single most important launch asset. 25–35 seconds, no narration, the README's first image.
|
|
4
|
+
|
|
5
|
+
## What it shows
|
|
6
|
+
|
|
7
|
+
The runnable script [`demos/hero-demo.sh`](../demos/hero-demo.sh) produces three beats, all on
|
|
8
|
+
targets you own:
|
|
9
|
+
|
|
10
|
+
1. **The forgotten dependency** — `cat` a `package.json` pinned to an old `lodash`.
|
|
11
|
+
2. **The scan** — `brk deps` returns real CVEs ranked so the *reachable* criticals rise to the
|
|
12
|
+
top. Not a 400-line wall; the few that matter.
|
|
13
|
+
3. **The buried secret** — `brk secrets --history` finds an AWS key that was deleted from the
|
|
14
|
+
code but is still sitting in git history, pinned to the commit.
|
|
15
|
+
|
|
16
|
+
Ending card: `Find → Prove → Fix. npx break-anything`.
|
|
17
|
+
|
|
18
|
+
## Record it
|
|
19
|
+
|
|
20
|
+
Install the tools once:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
brew install asciinema agg # macOS; agg turns the cast into a GIF
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Record and convert:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cd /path/to/break-anything
|
|
30
|
+
asciinema rec hero.cast -c "bash demos/hero-demo.sh"
|
|
31
|
+
agg --font-size 22 --theme monokai hero.cast docs/assets/hero.gif
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then reference it at the top of the README:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
<img src="docs/assets/hero.gif" alt="Break Anything finding reachable CVEs and a secret buried in git history" width="900" />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Tips for a GIF that spreads
|
|
41
|
+
|
|
42
|
+
- Keep the terminal ~90 columns, large font. People watch these on phones.
|
|
43
|
+
- Trim to under 35s. The `deps` result and the "deleted but still in history" reveal are the two
|
|
44
|
+
moments that make people stop scrolling — land them fast.
|
|
45
|
+
- Do not show a cursor hunting around. The script paces itself; just let it run.
|
|
46
|
+
- Record on a clean prompt, dark theme, no personal paths visible (the script uses a temp dir).
|
|
47
|
+
- Post the GIF in the README, the Show HN, and the X thread. Same asset everywhere.
|
|
48
|
+
|
|
49
|
+
## Honesty guardrails (keep the credibility that makes it spread)
|
|
50
|
+
|
|
51
|
+
- Every target in the GIF is a sample project or a throwaway repo you own. Never a third party.
|
|
52
|
+
- The CVEs and EPSS numbers are real (live OSV / FIRST.org lookups), so the demo holds up when
|
|
53
|
+
someone reruns it. Do not fake the output.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Installation and setup
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- Node.js 22.19+ and npm
|
|
6
|
+
- macOS, Linux, or Windows (WSL recommended on Windows for dynamic tools)
|
|
7
|
+
- Optional analysis engines depending on the target (see below)
|
|
8
|
+
|
|
9
|
+
## Set up your agent
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx break-anything setup
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Setup detects installed agents, prints every proposed change, backs up existing configuration,
|
|
16
|
+
and asks before applying anything. Supported agents:
|
|
17
|
+
|
|
18
|
+
- Claude Code
|
|
19
|
+
- Claude Desktop
|
|
20
|
+
- Codex
|
|
21
|
+
- Cursor
|
|
22
|
+
- Gemini CLI
|
|
23
|
+
- Windsurf
|
|
24
|
+
|
|
25
|
+
Any other client that can run a local MCP server can use the
|
|
26
|
+
[manual registration](mcp-tools.md#manual-mcp-registration).
|
|
27
|
+
|
|
28
|
+
## Install the CLI
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --global break-anything
|
|
32
|
+
brk --help
|
|
33
|
+
brk doctor
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`brk doctor` is read-only. It reports which optional engines are present and which capabilities
|
|
37
|
+
are therefore available.
|
|
38
|
+
|
|
39
|
+
## Optional analysis engines
|
|
40
|
+
|
|
41
|
+
Break Anything orchestrates tools you already trust. It does not bundle or re-license them.
|
|
42
|
+
|
|
43
|
+
| Capability | Engine | Install |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| Dependency CVEs | OSV database | built-in (queries OSV.dev) |
|
|
46
|
+
| SAST | Semgrep | `pipx install semgrep` |
|
|
47
|
+
| SAST (deep) | CodeQL | CodeQL CLI from GitHub |
|
|
48
|
+
| Secrets | gitleaks | `brew install gitleaks` |
|
|
49
|
+
| Images / IaC | Trivy | `brew install trivy` |
|
|
50
|
+
| Images (second opinion) | Grype | `brew install grype` |
|
|
51
|
+
| Dynamic web | OWASP ZAP | ZAP desktop or `zaproxy` |
|
|
52
|
+
| Templates | Nuclei | `brew install nuclei` |
|
|
53
|
+
| Smart contracts | Slither | `pipx install slither-analyzer` |
|
|
54
|
+
|
|
55
|
+
## Enable dynamic (running-app) capabilities
|
|
56
|
+
|
|
57
|
+
Dynamic tools are off by default. To test your own running app or API:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
export BRK_DYNAMIC_ENABLED=true
|
|
61
|
+
export BRK_AUTHORIZED_TARGETS_JSON='["http://localhost:3000"]'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Dynamic tools refuse any target not in the allowlist. See [DISCLAIMER.md](../DISCLAIMER.md).
|
|
65
|
+
|
|
66
|
+
## Uninstall
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
brk uninstall # remove MCP registrations + managed skill
|
|
70
|
+
brk uninstall --purge # also remove ~/.brk cache and state
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Uninstall preserves your other MCP servers, your installed engines, and your evidence bundles.
|