chainwall 2.1.0 → 2.2.2
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/LICENSE +44 -1
- package/README.md +213 -105
- package/dist/auditor/miner-detector.d.ts +16 -0
- package/dist/auditor/miner-detector.d.ts.map +1 -1
- package/dist/auditor/miner-detector.js +54 -10
- package/dist/auditor/miner-detector.js.map +1 -1
- package/dist/auditor/remediation.d.ts +9 -0
- package/dist/auditor/remediation.d.ts.map +1 -1
- package/dist/auditor/remediation.js +292 -1
- package/dist/auditor/remediation.js.map +1 -1
- package/dist/cli.js +29 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/monitor.d.ts +13 -0
- package/dist/commands/monitor.d.ts.map +1 -0
- package/dist/commands/monitor.js +102 -0
- package/dist/commands/monitor.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -0
- package/dist/config.js.map +1 -1
- package/dist/mcp-server/index.d.ts.map +1 -1
- package/dist/mcp-server/index.js +4 -0
- package/dist/mcp-server/index.js.map +1 -1
- package/dist/mcp-server/schemas.d.ts +2 -0
- package/dist/mcp-server/schemas.d.ts.map +1 -1
- package/dist/mcp-server/schemas.js +2 -0
- package/dist/mcp-server/schemas.js.map +1 -1
- package/dist/mcp-server/tools/capture-baseline.d.ts +3 -0
- package/dist/mcp-server/tools/capture-baseline.d.ts.map +1 -0
- package/dist/mcp-server/tools/capture-baseline.js +42 -0
- package/dist/mcp-server/tools/capture-baseline.js.map +1 -0
- package/dist/mcp-server/tools/monitor-snapshot.d.ts +3 -0
- package/dist/mcp-server/tools/monitor-snapshot.d.ts.map +1 -0
- package/dist/mcp-server/tools/monitor-snapshot.js +53 -0
- package/dist/mcp-server/tools/monitor-snapshot.js.map +1 -0
- package/dist/monitor/baseline.d.ts +6 -0
- package/dist/monitor/baseline.d.ts.map +1 -0
- package/dist/monitor/baseline.js +64 -0
- package/dist/monitor/baseline.js.map +1 -0
- package/dist/monitor/browser-scanner.d.ts +4 -0
- package/dist/monitor/browser-scanner.d.ts.map +1 -0
- package/dist/monitor/browser-scanner.js +141 -0
- package/dist/monitor/browser-scanner.js.map +1 -0
- package/dist/monitor/clipboard-scanner.d.ts +3 -0
- package/dist/monitor/clipboard-scanner.d.ts.map +1 -0
- package/dist/monitor/clipboard-scanner.js +49 -0
- package/dist/monitor/clipboard-scanner.js.map +1 -0
- package/dist/monitor/correlation.d.ts +9 -0
- package/dist/monitor/correlation.d.ts.map +1 -0
- package/dist/monitor/correlation.js +117 -0
- package/dist/monitor/correlation.js.map +1 -0
- package/dist/monitor/index.d.ts +13 -0
- package/dist/monitor/index.d.ts.map +1 -0
- package/dist/monitor/index.js +11 -0
- package/dist/monitor/index.js.map +1 -0
- package/dist/monitor/known-good.d.ts +24 -0
- package/dist/monitor/known-good.d.ts.map +1 -0
- package/dist/monitor/known-good.js +82 -0
- package/dist/monitor/known-good.js.map +1 -0
- package/dist/monitor/network-scanner.d.ts +4 -0
- package/dist/monitor/network-scanner.d.ts.map +1 -0
- package/dist/monitor/network-scanner.js +123 -0
- package/dist/monitor/network-scanner.js.map +1 -0
- package/dist/monitor/persistence-scanner.d.ts +4 -0
- package/dist/monitor/persistence-scanner.d.ts.map +1 -0
- package/dist/monitor/persistence-scanner.js +156 -0
- package/dist/monitor/persistence-scanner.js.map +1 -0
- package/dist/monitor/process-scanner.d.ts +6 -0
- package/dist/monitor/process-scanner.d.ts.map +1 -0
- package/dist/monitor/process-scanner.js +101 -0
- package/dist/monitor/process-scanner.js.map +1 -0
- package/dist/monitor/shadow-ai-scanner.d.ts +3 -0
- package/dist/monitor/shadow-ai-scanner.d.ts.map +1 -0
- package/dist/monitor/shadow-ai-scanner.js +70 -0
- package/dist/monitor/shadow-ai-scanner.js.map +1 -0
- package/dist/monitor/types.d.ts +79 -0
- package/dist/monitor/types.d.ts.map +1 -0
- package/dist/monitor/types.js +12 -0
- package/dist/monitor/types.js.map +1 -0
- package/dist/reporter/monitor-report.d.ts +3 -0
- package/dist/reporter/monitor-report.d.ts.map +1 -0
- package/dist/reporter/monitor-report.js +89 -0
- package/dist/reporter/monitor-report.js.map +1 -0
- package/dist/reporter/risk-scorer.d.ts +2 -0
- package/dist/reporter/risk-scorer.d.ts.map +1 -1
- package/dist/reporter/risk-scorer.js +12 -0
- package/dist/reporter/risk-scorer.js.map +1 -1
- package/dist/reporter/shared.d.ts.map +1 -1
- package/dist/reporter/shared.js +5 -3
- package/dist/reporter/shared.js.map +1 -1
- package/dist/rules/exfiltration-rules.d.ts +3 -0
- package/dist/rules/exfiltration-rules.d.ts.map +1 -0
- package/dist/rules/exfiltration-rules.js +181 -0
- package/dist/rules/exfiltration-rules.js.map +1 -0
- package/dist/rules/index.d.ts +2 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +3 -1
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/types.d.ts +9 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/scanner/filesystem-scanner.d.ts.map +1 -1
- package/dist/scanner/filesystem-scanner.js +27 -10
- package/dist/scanner/filesystem-scanner.js.map +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +10 -2
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/Footer.d.ts +2 -3
- package/dist/tui/components/Footer.d.ts.map +1 -1
- package/dist/tui/components/Footer.js +11 -5
- package/dist/tui/components/Footer.js.map +1 -1
- package/dist/tui/components/WelcomeScreen.d.ts.map +1 -1
- package/dist/tui/components/WelcomeScreen.js +1 -1
- package/dist/tui/components/WelcomeScreen.js.map +1 -1
- package/dist/tui/educational.d.ts +6 -0
- package/dist/tui/educational.d.ts.map +1 -1
- package/dist/tui/educational.js +37 -0
- package/dist/tui/educational.js.map +1 -1
- package/dist/tui/hooks/useLogs.d.ts +1 -1
- package/dist/tui/hooks/useLogs.d.ts.map +1 -1
- package/dist/tui/hooks/useMonitor.d.ts +28 -0
- package/dist/tui/hooks/useMonitor.d.ts.map +1 -0
- package/dist/tui/hooks/useMonitor.js +127 -0
- package/dist/tui/hooks/useMonitor.js.map +1 -0
- package/dist/tui/screens/AuditPanel.d.ts.map +1 -1
- package/dist/tui/screens/AuditPanel.js +109 -9
- package/dist/tui/screens/AuditPanel.js.map +1 -1
- package/dist/tui/screens/MonitorPanel.d.ts +2 -0
- package/dist/tui/screens/MonitorPanel.d.ts.map +1 -0
- package/dist/tui/screens/MonitorPanel.js +370 -0
- package/dist/tui/screens/MonitorPanel.js.map +1 -0
- package/dist/tui/screens/OverviewPanel.d.ts.map +1 -1
- package/dist/tui/screens/OverviewPanel.js +9 -3
- package/dist/tui/screens/OverviewPanel.js.map +1 -1
- package/dist/tui/screens/ScanPanel.d.ts.map +1 -1
- package/dist/tui/screens/ScanPanel.js +5 -5
- package/dist/tui/screens/ScanPanel.js.map +1 -1
- package/dist/tui/screens/ScanResultsPanel.d.ts.map +1 -1
- package/dist/tui/screens/ScanResultsPanel.js +104 -32
- package/dist/tui/screens/ScanResultsPanel.js.map +1 -1
- package/dist/tui/state.d.ts +7 -3
- package/dist/tui/state.d.ts.map +1 -1
- package/dist/tui/state.js +1 -0
- package/dist/tui/state.js.map +1 -1
- package/dist/tui/utils/open-file.d.ts +4 -0
- package/dist/tui/utils/open-file.d.ts.map +1 -0
- package/dist/tui/utils/open-file.js +29 -0
- package/dist/tui/utils/open-file.js.map +1 -0
- package/install.sh +23 -12
- package/package.json +1 -1
- package/patterns/exfiltration.yaml +160 -0
- package/uninstall.sh +14 -10
package/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025-2026 ChainWall Contributors
|
|
4
|
+
Original author: girlintokyo (https://github.com/consulalialpric)
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,3 +20,45 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
20
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
22
|
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
ADDITIONAL NOTICES
|
|
27
|
+
|
|
28
|
+
Security Tool Disclaimer
|
|
29
|
+
|
|
30
|
+
ChainWall is a defensive security tool designed to detect exposed secrets,
|
|
31
|
+
audit AI tool access, and block threats. It is intended for use by developers
|
|
32
|
+
and security professionals to protect their own systems and codebases.
|
|
33
|
+
|
|
34
|
+
This software does not guarantee complete protection against all threats.
|
|
35
|
+
No security tool can provide absolute assurance. Users are responsible for
|
|
36
|
+
evaluating the suitability of this software for their specific security
|
|
37
|
+
requirements and for implementing additional safeguards as needed.
|
|
38
|
+
|
|
39
|
+
The detection patterns, rules, and heuristics included in this software are
|
|
40
|
+
provided for defensive purposes only. The authors disclaim any responsibility
|
|
41
|
+
for misuse of this software or its components.
|
|
42
|
+
|
|
43
|
+
Third-Party Components
|
|
44
|
+
|
|
45
|
+
This software includes or may interact with third-party components, each
|
|
46
|
+
governed by their own respective licenses. Notable dependencies include:
|
|
47
|
+
|
|
48
|
+
- Ink (MIT) — Terminal UI framework
|
|
49
|
+
- React (MIT) — Component library
|
|
50
|
+
- Vitest (MIT) — Test framework
|
|
51
|
+
- @modelcontextprotocol/sdk (MIT) — MCP protocol
|
|
52
|
+
|
|
53
|
+
Trademark Notice
|
|
54
|
+
|
|
55
|
+
"ChainWall" and the ChainWall logo are trademarks of the ChainWall project.
|
|
56
|
+
Use of these trademarks must comply with standard fair use guidelines. You
|
|
57
|
+
may use the name to refer to the software but may not imply endorsement or
|
|
58
|
+
affiliation without written permission.
|
|
59
|
+
|
|
60
|
+
Contribution
|
|
61
|
+
|
|
62
|
+
By submitting a pull request or contributing code to this project, you agree
|
|
63
|
+
to license your contribution under the same MIT License terms described above,
|
|
64
|
+
without any additional terms or conditions.
|
package/README.md
CHANGED
|
@@ -8,21 +8,35 @@
|
|
|
8
8
|
[](https://www.npmjs.com/package/chainwall)
|
|
9
9
|
[](https://www.npmjs.com/package/chainwall)
|
|
10
10
|
[](LICENSE)
|
|
11
|
-
[](#reference)
|
|
12
12
|
[](https://github.com/consulalialpric/chainwall)
|
|
13
13
|
|
|
14
|
-
**Antivirus for AI
|
|
14
|
+
**Antivirus for AI tools.**
|
|
15
15
|
|
|
16
|
-
Your AI tools have access to every secret on your machine. ChainWall scans your filesystem, maps which tools can reach your credentials, and blocks threats before they happen.
|
|
16
|
+
Your AI tools have access to every secret on your machine. ChainWall scans your filesystem, maps which tools can reach your credentials, and blocks threats before they happen. Keep your device safe.
|
|
17
17
|
|
|
18
|
-
`
|
|
18
|
+
`197 detection patterns` · `18 AI tools audited` · `976 tests` · `<50ms hooks`
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Get Started
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g chainwall
|
|
28
|
+
chainwall
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That's it. Two commands. The interactive dashboard opens and walks you through everything — scan for secrets, audit your AI tools, monitor runtime behavior, and configure protection. No flags to memorize, no config files to write.
|
|
32
|
+
|
|
22
33
|
<p align="center">
|
|
23
34
|
<img src=".github/images/dashboard.png" width="680" alt="ChainWall Dashboard">
|
|
24
35
|
</p>
|
|
25
36
|
|
|
37
|
+
> [!TIP]
|
|
38
|
+
> The dashboard is the best way to use ChainWall. Navigate with `1`-`6`, run scans and audits from inside, toggle protection with `p`, remediate findings with `r`, and press `?` for all keybindings. Everything the CLI can do, the dashboard does better.
|
|
39
|
+
|
|
26
40
|
<div align="center">
|
|
27
41
|
|
|
28
42
|
[Twitter](https://x.com/Antivirus) · [GitHub](https://github.com/consulalialpric/chainwall) · [@girlintokyo](https://x.com/girlintokyo)
|
|
@@ -33,43 +47,93 @@ Your AI tools have access to every secret on your machine. ChainWall scans your
|
|
|
33
47
|
|
|
34
48
|
## Table of Contents
|
|
35
49
|
|
|
36
|
-
- [Installation](#installation)
|
|
37
50
|
- [The Problem](#the-problem)
|
|
38
51
|
- [See It in Action](#see-it-in-action)
|
|
39
52
|
- [What It Does](#what-it-does)
|
|
53
|
+
- [CLI Commands](#cli-commands)
|
|
40
54
|
- [Detection Patterns](#detection-patterns)
|
|
41
55
|
- [Supported AI Tools](#supported-ai-tools)
|
|
56
|
+
- [MCP Server](#mcp-server)
|
|
42
57
|
- [Architecture](#architecture)
|
|
43
58
|
- [Reference](#reference)
|
|
44
59
|
- [License](#license)
|
|
45
60
|
|
|
46
61
|
---
|
|
47
62
|
|
|
48
|
-
##
|
|
63
|
+
## The Problem
|
|
64
|
+
|
|
65
|
+
> [!WARNING]
|
|
66
|
+
> **Your AI tools can read every secret on your machine right now.**
|
|
67
|
+
|
|
68
|
+
AI tools have broad filesystem access — coding agents, chat assistants, automation workflows, MCP servers — they can all reach your AWS credentials, SSH keys, `.env` files, crypto wallets, and browser cookies. Most users have no idea how exposed they are.
|
|
49
69
|
|
|
50
|
-
|
|
70
|
+
The threat isn't hypothetical. A single prompt injection buried in a dependency README. A hallucinated shell command that pipes your keys to a remote server. A compromised MCP server that exfiltrates environment variables on every call. The agent doesn't need to be malicious — it just needs to be tricked.
|
|
51
71
|
|
|
52
|
-
|
|
72
|
+
There's no firewall between your AI tools and your secrets. No permission model. No audit trail. You're running autonomous software with the keys to your entire digital life, and hoping for the best.
|
|
53
73
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
ChainWall closes the gap. Scan what's exposed, see which tools can reach it, and block threats before they execute — in under a minute.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## See It in Action
|
|
79
|
+
|
|
80
|
+
<p align="center">
|
|
81
|
+
<img src=".github/images/demo.gif" width="680" alt="ChainWall TUI Demo">
|
|
82
|
+
</p>
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## What It Does
|
|
87
|
+
|
|
88
|
+
### Scan
|
|
89
|
+
|
|
90
|
+
ChainWall walks your filesystem and matches every file against 197 compiled regex patterns — credentials, private keys, crypto seeds, PII, dangerous commands, supply chain attacks, and cryptojacking. Entropy validation filters out false positives so you only see real secrets. System-level scans target the specific locations where credentials actually live: `~/.aws`, `~/.ssh`, `~/.gnupg`, browser profiles, and more.
|
|
91
|
+
|
|
92
|
+
<p align="center">
|
|
93
|
+
<img src=".github/images/scan.png" width="640" alt="ChainWall scan results">
|
|
94
|
+
</p>
|
|
95
|
+
|
|
96
|
+
### Audit
|
|
97
|
+
|
|
98
|
+
The auditor detects every AI tool on your machine — 18 tools across three access levels — then cross-references each tool's filesystem reach against your discovered secrets. The result is an exposure map: which tools can read which secrets, ranked by risk. It also inspects MCP server configurations for poisoning attacks (description injection, typosquatting, rug-pull detection), VS Code extensions, CLI tools, environment variables, running cryptocurrency miners, and skill/instruction file threats.
|
|
99
|
+
|
|
100
|
+
Sections like MCP Servers, VS Code Extensions, and Environment Variables show "None found." when your system is clean — that's the goal. If something is lurking, ChainWall will surface it.
|
|
101
|
+
|
|
102
|
+
<p align="center">
|
|
103
|
+
<img src=".github/images/audit.png" width="640" alt="ChainWall audit results">
|
|
104
|
+
</p>
|
|
105
|
+
|
|
106
|
+
### Monitor
|
|
107
|
+
|
|
108
|
+
Runtime behavioral analysis scans running processes, network connections, browser extensions, shadow AI tools, clipboard contents, and persistence mechanisms (crontab, launch agents, shell profiles). Findings are correlated using signal-based scoring with PID cross-referencing and optional baseline diffing to detect new activity since your last snapshot.
|
|
57
109
|
|
|
58
|
-
###
|
|
110
|
+
### Protect
|
|
111
|
+
|
|
112
|
+
Real-time bash hooks intercept dangerous operations before they execute. Pre-commit hooks block secrets from entering your git history. Pre-push hooks catch force-pushes and branch deletions. PreToolUse and PostToolUse hooks run inline with Claude Code to block file reads and shell commands in real-time — under 50ms, every time.
|
|
59
113
|
|
|
60
|
-
|
|
114
|
+
> [!IMPORTANT]
|
|
115
|
+
> The two layers are fully independent. Bash hooks work without Node.js installed. The TypeScript CLI works without hooks being configured. Use either or both.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## CLI Commands
|
|
120
|
+
|
|
121
|
+
The dashboard is the recommended way to use ChainWall, but every feature is also available as a standalone command:
|
|
61
122
|
|
|
62
123
|
```bash
|
|
124
|
+
chainwall # launch the interactive dashboard (recommended)
|
|
63
125
|
chainwall scan # find secrets, keys, and PII on your machine
|
|
64
126
|
chainwall audit # map which AI tools can reach those secrets
|
|
127
|
+
chainwall monitor # runtime behavioral analysis (processes, network, persistence)
|
|
65
128
|
chainwall init # install real-time protection hooks (one-time setup)
|
|
66
|
-
chainwall # launch interactive dashboard
|
|
67
129
|
```
|
|
68
130
|
|
|
69
131
|
> [!NOTE]
|
|
70
|
-
> `chainwall
|
|
132
|
+
> `chainwall init` only needs to run once per project to deploy hooks. After that, just launch `chainwall` for the full dashboard.
|
|
71
133
|
|
|
72
|
-
|
|
134
|
+
<details>
|
|
135
|
+
<summary><b>Platform guide</b></summary>
|
|
136
|
+
<br>
|
|
73
137
|
|
|
74
138
|
<table>
|
|
75
139
|
<tr>
|
|
@@ -113,6 +177,8 @@ chainwall # launch interactive dashboard
|
|
|
113
177
|
</tr>
|
|
114
178
|
</table>
|
|
115
179
|
|
|
180
|
+
</details>
|
|
181
|
+
|
|
116
182
|
<details>
|
|
117
183
|
<summary><b>Install from source</b></summary>
|
|
118
184
|
<br>
|
|
@@ -139,62 +205,9 @@ Pure bash + jq, executes in under 50ms, zero network calls.
|
|
|
139
205
|
|
|
140
206
|
---
|
|
141
207
|
|
|
142
|
-
## The Problem
|
|
143
|
-
|
|
144
|
-
> [!WARNING]
|
|
145
|
-
> **Your AI tools can read every secret on your machine right now.**
|
|
146
|
-
|
|
147
|
-
AI tools have broad filesystem access — coding agents, chat assistants, automation workflows, MCP servers — they can all reach your AWS credentials, SSH keys, `.env` files, crypto wallets, and browser cookies. Most users have no idea how exposed they are.
|
|
148
|
-
|
|
149
|
-
The threat isn't hypothetical. A single prompt injection buried in a dependency README. A hallucinated shell command that pipes your keys to a remote server. A compromised MCP server that exfiltrates environment variables on every call. The agent doesn't need to be malicious — it just needs to be tricked.
|
|
150
|
-
|
|
151
|
-
There's no firewall between your AI tools and your secrets. No permission model. No audit trail. You're running autonomous software with the keys to your entire digital life, and hoping for the best.
|
|
152
|
-
|
|
153
|
-
ChainWall closes the gap. Scan what's exposed, see which tools can reach it, and block threats before they execute — in under a minute.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## See It in Action
|
|
158
|
-
|
|
159
|
-
<p align="center">
|
|
160
|
-
<img src=".github/images/demo.gif" width="680" alt="ChainWall TUI Demo">
|
|
161
|
-
</p>
|
|
162
|
-
|
|
163
|
-
> [!TIP]
|
|
164
|
-
> Launch the interactive dashboard with `chainwall` (no arguments). Navigate panels with `1`-`5`, toggle protection with `p`, press `?` for help.
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## What It Does
|
|
169
|
-
|
|
170
|
-
### Scan
|
|
171
|
-
|
|
172
|
-
ChainWall walks your filesystem and matches every file against 178 compiled regex patterns — credentials, private keys, crypto seeds, PII, dangerous commands, supply chain attacks, and cryptojacking. Entropy validation filters out false positives so you only see real secrets. System-level scans target the specific locations where credentials actually live: `~/.aws`, `~/.ssh`, `~/.gnupg`, browser profiles, and more.
|
|
173
|
-
|
|
174
|
-
<p align="center">
|
|
175
|
-
<img src=".github/images/scan.png" width="640" alt="ChainWall scan results">
|
|
176
|
-
</p>
|
|
177
|
-
|
|
178
|
-
### Audit
|
|
179
|
-
|
|
180
|
-
The auditor detects every AI tool on your machine — 18 tools across three access levels — then cross-references each tool's filesystem reach against your discovered secrets. The result is an exposure map: which tools can read which secrets, ranked by risk. It also inspects MCP server configurations for poisoning attacks (description injection, typosquatting, rug-pull detection), VS Code extensions, CLI tools, environment variables, running cryptocurrency miners, and skill/instruction file threats.
|
|
181
|
-
|
|
182
|
-
<p align="center">
|
|
183
|
-
<img src=".github/images/audit.png" width="640" alt="ChainWall audit results">
|
|
184
|
-
</p>
|
|
185
|
-
|
|
186
|
-
### Protect
|
|
187
|
-
|
|
188
|
-
Real-time bash hooks intercept dangerous operations before they execute. Pre-commit hooks block secrets from entering your git history. Pre-push hooks catch force-pushes and branch deletions. PreToolUse and PostToolUse hooks run inline with Claude Code to block file reads and shell commands in real-time — under 50ms, every time.
|
|
189
|
-
|
|
190
|
-
> [!IMPORTANT]
|
|
191
|
-
> The two layers are fully independent. Bash hooks work without Node.js installed. The TypeScript CLI works without hooks being configured. Use either or both.
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
208
|
## Detection Patterns
|
|
196
209
|
|
|
197
|
-
|
|
210
|
+
197 patterns across 12 categories, with entropy validation to reduce false positives.
|
|
198
211
|
|
|
199
212
|
| Category | Patterns |
|
|
200
213
|
|:---------|:--------:|
|
|
@@ -206,11 +219,12 @@ Real-time bash hooks intercept dangerous operations before they execute. Pre-com
|
|
|
206
219
|
| **Supply Chain** | 16 |
|
|
207
220
|
| **Prompt Injection** | 18 |
|
|
208
221
|
| **Cryptojacking** | 22 |
|
|
222
|
+
| **Exfiltration** | 19 |
|
|
209
223
|
| **Skill File Threats** | 25 |
|
|
210
224
|
| **MCP Poisoning** | 6 modules |
|
|
211
225
|
| **Permissions** | 11 |
|
|
212
226
|
|
|
213
|
-
>
|
|
227
|
+
> 197 compiled rules + 25 skill-file rules + 10 contextual injection patterns + 3 shell history patterns loaded separately.
|
|
214
228
|
|
|
215
229
|
<details>
|
|
216
230
|
<summary><b>Credentials (55)</b></summary>
|
|
@@ -373,15 +387,123 @@ Instruction files are deployed to 11 tools via `chainwall init`.
|
|
|
373
387
|
|
|
374
388
|
---
|
|
375
389
|
|
|
390
|
+
## MCP Server
|
|
391
|
+
|
|
392
|
+
ChainWall includes an MCP server that AI agents can call directly for real-time security checks — scan files, validate commands, and query protection status without leaving the agent loop.
|
|
393
|
+
|
|
394
|
+
### Tools
|
|
395
|
+
|
|
396
|
+
| Tool | Description |
|
|
397
|
+
|:-----|:-----------|
|
|
398
|
+
| `scan_file` | Scan a file for secrets (restricted to cwd) |
|
|
399
|
+
| `scan_content` | Scan arbitrary text for secrets |
|
|
400
|
+
| `check_command` | Check if a shell command is dangerous |
|
|
401
|
+
| `audit_status` | Get current protection status |
|
|
402
|
+
| `monitor_snapshot` | Runtime behavioral scan (processes, network, persistence) |
|
|
403
|
+
| `capture_baseline` | Capture system baseline for future diffing |
|
|
404
|
+
|
|
405
|
+
### Setup
|
|
406
|
+
|
|
407
|
+
#### Automatic
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
chainwall init
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
This registers the MCP server in Claude Desktop and Cursor automatically.
|
|
414
|
+
|
|
415
|
+
#### Manual
|
|
416
|
+
|
|
417
|
+
Add the `chainwall` server to your MCP client config:
|
|
418
|
+
|
|
419
|
+
<table>
|
|
420
|
+
<tr>
|
|
421
|
+
<td width="60">
|
|
422
|
+
|
|
423
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/apple/apple-original.svg" width="36" alt="macOS">
|
|
424
|
+
|
|
425
|
+
</td>
|
|
426
|
+
<td>
|
|
427
|
+
|
|
428
|
+
**Claude Desktop** — `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
429
|
+
|
|
430
|
+
</td>
|
|
431
|
+
</tr>
|
|
432
|
+
<tr>
|
|
433
|
+
<td>
|
|
434
|
+
|
|
435
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/linux/linux-original.svg" width="36" alt="Linux">
|
|
436
|
+
|
|
437
|
+
</td>
|
|
438
|
+
<td>
|
|
439
|
+
|
|
440
|
+
**Claude Desktop** — `~/.config/Claude/claude_desktop_config.json`
|
|
441
|
+
|
|
442
|
+
</td>
|
|
443
|
+
</tr>
|
|
444
|
+
</table>
|
|
445
|
+
|
|
446
|
+
```jsonc
|
|
447
|
+
{
|
|
448
|
+
"mcpServers": {
|
|
449
|
+
"chainwall": {
|
|
450
|
+
"command": "chainwall-mcp"
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
<table>
|
|
457
|
+
<tr>
|
|
458
|
+
<td width="60">
|
|
459
|
+
|
|
460
|
+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/vscode/vscode-original.svg" width="36" alt="Cursor">
|
|
461
|
+
|
|
462
|
+
</td>
|
|
463
|
+
<td>
|
|
464
|
+
|
|
465
|
+
**Cursor** — `~/.cursor/mcp.json`
|
|
466
|
+
|
|
467
|
+
</td>
|
|
468
|
+
</tr>
|
|
469
|
+
</table>
|
|
470
|
+
|
|
471
|
+
```jsonc
|
|
472
|
+
{
|
|
473
|
+
"mcpServers": {
|
|
474
|
+
"chainwall": {
|
|
475
|
+
"command": "chainwall-mcp"
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
For **Windsurf** or other MCP clients, use the same JSON — the only requirement is that `chainwall-mcp` is on your PATH (installed via `npm install -g chainwall`).
|
|
482
|
+
|
|
483
|
+
### Direct usage
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
chainwall mcp
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
Starts the MCP server on stdio for testing or debugging. Useful for verifying tool responses before wiring it into your AI client.
|
|
490
|
+
|
|
491
|
+
> [!TIP]
|
|
492
|
+
> The MCP **server** (above) lets agents call ChainWall for security checks. The MCP **detector** (part of `chainwall audit`) finds MCP servers already on your system and analyzes them for poisoning attacks — description injection, typosquatting, excessive permissions, and rug-pull detection. They're separate features.
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
376
496
|
## Architecture
|
|
377
497
|
|
|
378
498
|
```mermaid
|
|
379
499
|
graph TD
|
|
380
500
|
CW["<b>CHAINWALL</b>"] --> BH["<b>Bash Hooks</b><br><i>real-time, <50ms</i><br>PreToolUse · PostToolUse<br>pre-commit · pre-push"]
|
|
381
|
-
CW --> CLI["<b>TypeScript CLI</b><br><i>scan / audit / TUI</i><br>
|
|
382
|
-
CW -->
|
|
501
|
+
CW --> CLI["<b>TypeScript CLI</b><br><i>scan / audit / TUI</i><br>197 patterns · 18 tools<br>exposure map · SARIF"]
|
|
502
|
+
CW --> MON["<b>Runtime Monitor</b><br><i>behavioral analysis</i><br>process · network · browser<br>shadow AI · clipboard · persistence"]
|
|
503
|
+
CW --> MCP["<b>MCP Server</b><br><i>agent-callable</i><br>scan_file · scan_content<br>check_command · audit_status<br>monitor_snapshot · capture_baseline"]
|
|
383
504
|
BH --> XR["<b>Cross-Reference</b><br><b>Exposure Map</b><br><i>secrets × tool access<br>= what's actually at risk</i>"]
|
|
384
505
|
CLI --> XR
|
|
506
|
+
MON --> XR
|
|
385
507
|
MCP --> XR
|
|
386
508
|
```
|
|
387
509
|
|
|
@@ -391,17 +513,18 @@ graph TD
|
|
|
391
513
|
|
|
392
514
|
```
|
|
393
515
|
hooks/ Bash hooks (PreToolUse/PostToolUse, git pre-commit/pre-push)
|
|
394
|
-
patterns/ YAML pattern databases (
|
|
516
|
+
patterns/ YAML pattern databases (8 files)
|
|
395
517
|
rules/ Instruction files for 11 AI tools
|
|
396
518
|
src/
|
|
397
|
-
commands/ scan, audit, init, watch, allow handlers
|
|
398
|
-
rules/
|
|
519
|
+
commands/ scan, audit, init, watch, monitor, allow handlers
|
|
520
|
+
rules/ 197 patterns as pre-compiled RegExp
|
|
399
521
|
scanner/ Async filesystem walker + rule engine
|
|
400
522
|
auditor/ 18-tool detector + MCP/CLI/VS Code scanner + MCP poison detector + miner detector
|
|
401
523
|
reporter/ Terminal, JSON, SARIF, audit reports
|
|
524
|
+
monitor/ 6 runtime scanners + correlation + baseline
|
|
402
525
|
tui/ Interactive TUI (Ink + React)
|
|
403
|
-
mcp-server/
|
|
404
|
-
test/ Vitest tests (
|
|
526
|
+
mcp-server/ 6-tool MCP server (stdio transport)
|
|
527
|
+
test/ Vitest tests (35 files)
|
|
405
528
|
tests/ Bash test suite (11 suites)
|
|
406
529
|
install.sh Universal installer
|
|
407
530
|
```
|
|
@@ -418,11 +541,12 @@ install.sh Universal installer
|
|
|
418
541
|
|
|
419
542
|
| Command | Description |
|
|
420
543
|
|:--------|:-----------|
|
|
421
|
-
| `chainwall` | Launch interactive
|
|
544
|
+
| `chainwall` | Launch interactive dashboard |
|
|
422
545
|
| `chainwall scan [dir]` | Scan for secrets, keys, and PII |
|
|
423
546
|
| `chainwall scan --system` | System credential locations only |
|
|
424
547
|
| `chainwall audit [dir]` | Map AI tool access + cross-reference exposure |
|
|
425
548
|
| `chainwall watch [dir]` | Real-time file monitoring |
|
|
549
|
+
| `chainwall monitor [dir]` | Runtime behavioral analysis |
|
|
426
550
|
| `chainwall init [dir]` | Install hooks for detected AI tools |
|
|
427
551
|
| `chainwall enable` / `disable` | Toggle real-time protection |
|
|
428
552
|
| `chainwall status` | Show protection status |
|
|
@@ -446,6 +570,8 @@ install.sh Universal installer
|
|
|
446
570
|
| `--grouped` | scan | Group findings by category |
|
|
447
571
|
| `--remediate` | audit | Interactive remediation prompts |
|
|
448
572
|
| `--deep` | audit | Full recursive home directory walk |
|
|
573
|
+
| `--baseline` | monitor | Compare against saved baseline |
|
|
574
|
+
| `--json` | monitor | Output as JSON |
|
|
449
575
|
|
|
450
576
|
</details>
|
|
451
577
|
|
|
@@ -486,33 +612,14 @@ Launch with `chainwall` (no arguments) for a full-screen keyboard-driven dashboa
|
|
|
486
612
|
|
|
487
613
|
| Panel | What it shows |
|
|
488
614
|
|:------|:-------------|
|
|
489
|
-
| **Overview** | Protection status,
|
|
490
|
-
| **Scan** | Mode selection, grouped results, severity/category filtering, search |
|
|
491
|
-
| **Audit** | 9-section accordion (
|
|
615
|
+
| **Overview** | Protection status, detected tools, risk score, system summary |
|
|
616
|
+
| **Scan** | Mode selection with duration estimates, grouped results, severity/category filtering, search, allowlisting |
|
|
617
|
+
| **Audit** | 9-section accordion (tools, exposure map, MCP, CLIs, VS Code, env, MCP poisoning, cryptojacking), remediation actions |
|
|
618
|
+
| **Monitor** | Runtime behavioral analysis — 6-scanner accordion with detail views, remediation, severity filtering |
|
|
492
619
|
| **Settings** | Allowlist/blocklist/skipDirs, toggle protection, global/project scope |
|
|
493
620
|
| **Logs** | Audit trail with severity filtering and real-time reload |
|
|
494
621
|
|
|
495
|
-
Keyboard: `1`-`
|
|
496
|
-
|
|
497
|
-
</details>
|
|
498
|
-
|
|
499
|
-
<details>
|
|
500
|
-
<summary><b>MCP Server</b></summary>
|
|
501
|
-
<br>
|
|
502
|
-
|
|
503
|
-
ChainWall includes an MCP server that AI agents can call directly for security checks.
|
|
504
|
-
|
|
505
|
-
| Tool | Description |
|
|
506
|
-
|:-----|:-----------|
|
|
507
|
-
| `scan_file` | Scan a file for secrets (restricted to cwd) |
|
|
508
|
-
| `scan_content` | Scan arbitrary text for secrets |
|
|
509
|
-
| `check_command` | Check if a shell command is dangerous |
|
|
510
|
-
| `audit_status` | Get current protection status |
|
|
511
|
-
|
|
512
|
-
Start with `chainwall mcp` or configure in Claude Desktop / Cursor settings via `chainwall init`.
|
|
513
|
-
|
|
514
|
-
> [!TIP]
|
|
515
|
-
> The MCP **server** (above) lets agents call ChainWall for security checks. The MCP **detector** (part of `chainwall audit`) finds MCP servers already on your system and analyzes them for risky capabilities like filesystem access, exec, and network calls. They're separate features.
|
|
622
|
+
Keyboard: `1`-`6` switch panels · `p` toggle protection · `?` help · `q` quit
|
|
516
623
|
|
|
517
624
|
</details>
|
|
518
625
|
|
|
@@ -529,6 +636,7 @@ Start with `chainwall mcp` or configure in Claude Desktop / Cursor settings via
|
|
|
529
636
|
| MCP poisoning detection | :white_check_mark: | :x: | :x: | :x: |
|
|
530
637
|
| Skill file threat scanning | :white_check_mark: | :x: | :x: | :x: |
|
|
531
638
|
| Cryptojacking detection | :white_check_mark: | :x: | :x: | :x: |
|
|
639
|
+
| Runtime behavioral monitoring | :white_check_mark: | :x: | :x: | :x: |
|
|
532
640
|
| Instruction file deployment | 11 tools | :x: | :x: | :x: |
|
|
533
641
|
| Entropy validation | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: |
|
|
534
642
|
| PII detection | :white_check_mark: | :x: | :x: | :x: |
|
|
@@ -548,10 +656,10 @@ Start with `chainwall mcp` or configure in Claude Desktop / Cursor settings via
|
|
|
548
656
|
|
|
549
657
|
```bash
|
|
550
658
|
./tests/run-all.sh # 223 bash hook tests (11 suites)
|
|
551
|
-
npm test #
|
|
659
|
+
npm test # 753 vitest tests (35 test files)
|
|
552
660
|
```
|
|
553
661
|
|
|
554
|
-
**
|
|
662
|
+
**976 tests total**, all passing.
|
|
555
663
|
|
|
556
664
|
</details>
|
|
557
665
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProcessInfo } from '../monitor/types.js';
|
|
1
2
|
export interface RunningMiner {
|
|
2
3
|
pid: number;
|
|
3
4
|
name: string;
|
|
@@ -12,6 +13,21 @@ export interface MinerDetectionResult {
|
|
|
12
13
|
runningMiners: RunningMiner[];
|
|
13
14
|
suspiciousCrontabs: SuspiciousCrontab[];
|
|
14
15
|
}
|
|
16
|
+
export declare const KNOWN_MINER_NAMES: string[];
|
|
17
|
+
export declare const MINER_PATTERN: RegExp;
|
|
18
|
+
export declare const CURL_BASH_PATTERN: RegExp;
|
|
19
|
+
export declare const STRATUM_PATTERN: RegExp;
|
|
20
|
+
export declare const POOL_PATTERN: RegExp;
|
|
21
|
+
/**
|
|
22
|
+
* Parse `ps -eo pid,ppid,user,%cpu,%mem,lstart,command` output into structured ProcessInfo[].
|
|
23
|
+
* Shared by miner-detector and monitor/process-scanner.
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseProcessList(output: string): ProcessInfo[];
|
|
26
|
+
/**
|
|
27
|
+
* Parse crontab -l output into non-comment, non-empty lines.
|
|
28
|
+
* Shared by miner-detector and monitor/persistence-scanner.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseCrontabOutput(output: string): string[];
|
|
15
31
|
/**
|
|
16
32
|
* Detect running cryptocurrency mining processes and suspicious crontab entries.
|
|
17
33
|
* Uses execFileSync (no shell injection risk) for both ps and crontab.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miner-detector.d.ts","sourceRoot":"","sources":["../../src/auditor/miner-detector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"miner-detector.d.ts","sourceRoot":"","sources":["../../src/auditor/miner-detector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,eAAO,MAAM,iBAAiB,UAI7B,CAAC;AAEF,eAAO,MAAM,aAAa,QAEzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAmC,CAAC;AAClE,eAAO,MAAM,eAAe,QAA+B,CAAC;AAC5D,eAAO,MAAM,YAAY,QAAkD,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAoC9D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAI3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,oBAAoB,CAInD"}
|
|
@@ -1,13 +1,60 @@
|
|
|
1
1
|
import { execFileSync } from 'node:child_process';
|
|
2
|
-
const KNOWN_MINER_NAMES = [
|
|
2
|
+
export const KNOWN_MINER_NAMES = [
|
|
3
3
|
'xmrig', 'ethminer', 'cgminer', 'bfgminer', 'phoenixminer',
|
|
4
4
|
'cpuminer', 'minerd', 'claymore', 't-rex', 'lolminer',
|
|
5
5
|
'nbminer', 'gminer', 'ccminer', 'kryptex', 'nicehash',
|
|
6
6
|
];
|
|
7
|
-
const MINER_PATTERN = new RegExp(`\\b(?:${KNOWN_MINER_NAMES.join('|')})\\b`, 'i');
|
|
8
|
-
const CURL_BASH_PATTERN = /curl\s+.*\|\s*(?:bash|sh|zsh)/i;
|
|
9
|
-
const STRATUM_PATTERN = /stratum\+(?:tcp|ssl):\/\//i;
|
|
10
|
-
const POOL_PATTERN = /(?:pool|mining|miner)\S*\.(?:com|org|io|net)/i;
|
|
7
|
+
export const MINER_PATTERN = new RegExp(`\\b(?:${KNOWN_MINER_NAMES.join('|')})\\b`, 'i');
|
|
8
|
+
export const CURL_BASH_PATTERN = /curl\s+.*\|\s*(?:bash|sh|zsh)/i;
|
|
9
|
+
export const STRATUM_PATTERN = /stratum\+(?:tcp|ssl):\/\//i;
|
|
10
|
+
export const POOL_PATTERN = /(?:pool|mining|miner)\S*\.(?:com|org|io|net)/i;
|
|
11
|
+
/**
|
|
12
|
+
* Parse `ps -eo pid,ppid,user,%cpu,%mem,lstart,command` output into structured ProcessInfo[].
|
|
13
|
+
* Shared by miner-detector and monitor/process-scanner.
|
|
14
|
+
*/
|
|
15
|
+
export function parseProcessList(output) {
|
|
16
|
+
const results = [];
|
|
17
|
+
const lines = output.split('\n');
|
|
18
|
+
for (let i = 1; i < lines.length; i++) {
|
|
19
|
+
const line = lines[i].trim();
|
|
20
|
+
if (!line)
|
|
21
|
+
continue;
|
|
22
|
+
// ps -eo pid,ppid,user,%cpu,%mem,lstart,command
|
|
23
|
+
// lstart is multi-word: "Mon Feb 10 14:30:00 2025" (5 tokens)
|
|
24
|
+
const parts = line.split(/\s+/);
|
|
25
|
+
if (parts.length < 11)
|
|
26
|
+
continue;
|
|
27
|
+
const pid = parseInt(parts[0], 10);
|
|
28
|
+
const ppid = parseInt(parts[1], 10);
|
|
29
|
+
const user = parts[2];
|
|
30
|
+
const cpu = parseFloat(parts[3]);
|
|
31
|
+
const mem = parseFloat(parts[4]);
|
|
32
|
+
// lstart occupies fields 5-9 (5 tokens: day-of-week month day time year)
|
|
33
|
+
const startTime = parts.slice(5, 10).join(' ');
|
|
34
|
+
const command = parts.slice(10).join(' ');
|
|
35
|
+
const name = parts[10].split('/').pop() ?? parts[10];
|
|
36
|
+
results.push({
|
|
37
|
+
pid: isNaN(pid) ? 0 : pid,
|
|
38
|
+
ppid: isNaN(ppid) ? 0 : ppid,
|
|
39
|
+
user,
|
|
40
|
+
cpu: isNaN(cpu) ? 0 : cpu,
|
|
41
|
+
mem: isNaN(mem) ? 0 : mem,
|
|
42
|
+
startTime,
|
|
43
|
+
command,
|
|
44
|
+
name,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return results;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parse crontab -l output into non-comment, non-empty lines.
|
|
51
|
+
* Shared by miner-detector and monitor/persistence-scanner.
|
|
52
|
+
*/
|
|
53
|
+
export function parseCrontabOutput(output) {
|
|
54
|
+
return output.split('\n')
|
|
55
|
+
.map((l) => l.trim())
|
|
56
|
+
.filter((l) => l && !l.startsWith('#'));
|
|
57
|
+
}
|
|
11
58
|
/**
|
|
12
59
|
* Detect running cryptocurrency mining processes and suspicious crontab entries.
|
|
13
60
|
* Uses execFileSync (no shell injection risk) for both ps and crontab.
|
|
@@ -67,11 +114,8 @@ function detectSuspiciousCrontabs() {
|
|
|
67
114
|
encoding: 'utf-8',
|
|
68
115
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
69
116
|
});
|
|
70
|
-
const
|
|
71
|
-
for (const
|
|
72
|
-
const trimmed = line.trim();
|
|
73
|
-
if (!trimmed || trimmed.startsWith('#'))
|
|
74
|
-
continue;
|
|
117
|
+
const crontabLines = parseCrontabOutput(output);
|
|
118
|
+
for (const trimmed of crontabLines) {
|
|
75
119
|
if (MINER_PATTERN.test(trimmed)) {
|
|
76
120
|
suspicious.push({
|
|
77
121
|
line: trimmed.length > 120 ? trimmed.slice(0, 120) + '...' : trimmed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"miner-detector.js","sourceRoot":"","sources":["../../src/auditor/miner-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"miner-detector.js","sourceRoot":"","sources":["../../src/auditor/miner-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAoBlD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc;IAC1D,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU;IACrD,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU;CACtD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,MAAM,CACrC,SAAS,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAChD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,+CAA+C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