@agent-wall/core 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/.turbo/turbo-build.log +17 -0
- package/.turbo/turbo-test.log +30 -0
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/index.d.ts +1297 -0
- package/dist/index.js +3067 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
- package/src/audit-logger-security.test.ts +225 -0
- package/src/audit-logger.test.ts +93 -0
- package/src/audit-logger.ts +458 -0
- package/src/chain-detector.test.ts +100 -0
- package/src/chain-detector.ts +269 -0
- package/src/dashboard-server.test.ts +362 -0
- package/src/dashboard-server.ts +454 -0
- package/src/egress-control.test.ts +177 -0
- package/src/egress-control.ts +274 -0
- package/src/index.ts +137 -0
- package/src/injection-detector.test.ts +207 -0
- package/src/injection-detector.ts +397 -0
- package/src/kill-switch.test.ts +119 -0
- package/src/kill-switch.ts +198 -0
- package/src/policy-engine-security.test.ts +227 -0
- package/src/policy-engine.test.ts +453 -0
- package/src/policy-engine.ts +414 -0
- package/src/policy-loader.test.ts +202 -0
- package/src/policy-loader.ts +485 -0
- package/src/proxy.ts +786 -0
- package/src/read-buffer-security.test.ts +59 -0
- package/src/read-buffer.test.ts +135 -0
- package/src/read-buffer.ts +126 -0
- package/src/response-scanner.test.ts +464 -0
- package/src/response-scanner.ts +587 -0
- package/src/types.test.ts +152 -0
- package/src/types.ts +146 -0
- package/tsconfig.json +8 -0
- package/tsup.config.ts +9 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
> @agent-wall/core@0.1.0 build /home/runner/work/agent-wall/agent-wall/packages/core
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.5.1
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/agent-wall/agent-wall/packages/core/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: es2022
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m93.05 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m196.28 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 81ms
|
|
15
|
+
[34mDTS[39m Build start
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4268ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m41.75 KB[39m
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
> @agent-wall/core@0.1.0 test /home/runner/work/agent-wall/agent-wall/packages/core
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[1m[46m RUN [49m[22m [36mv3.2.4 [39m[90m/home/runner/work/agent-wall/agent-wall/packages/core[39m
|
|
7
|
+
|
|
8
|
+
[32m✓[39m src/response-scanner.test.ts [2m([22m[2m40 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/policy-engine.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m 35[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/dashboard-server.test.ts [2m([22m[2m16 tests[22m[2m)[22m[33m 2533[2mms[22m[39m
|
|
11
|
+
[33m[2m✓[22m[39m DashboardServer[2m > [22mshould broadcast to multiple clients [33m 403[2mms[22m[39m
|
|
12
|
+
[33m[2m✓[22m[39m DashboardServer[2m > [22mshould handle client disconnect without errors [33m 604[2mms[22m[39m
|
|
13
|
+
[32m✓[39m src/injection-detector.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
14
|
+
[32m✓[39m src/policy-engine-security.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
15
|
+
[32m✓[39m src/audit-logger-security.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
16
|
+
[32m✓[39m src/policy-loader.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
17
|
+
[32m✓[39m src/egress-control.test.ts [2m([22m[2m17 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
18
|
+
[32m✓[39m src/chain-detector.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
19
|
+
[32m✓[39m src/read-buffer.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
20
|
+
[32m✓[39m src/types.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
21
|
+
[32m✓[39m src/kill-switch.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 457[2mms[22m[39m
|
|
22
|
+
[33m[2m✓[22m[39m KillSwitch[2m > [22mfile-based activation[2m > [22mshould deactivate when kill file is removed [33m 301[2mms[22m[39m
|
|
23
|
+
[32m✓[39m src/audit-logger.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
24
|
+
[32m✓[39m src/read-buffer-security.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
25
|
+
|
|
26
|
+
[2m Test Files [22m [1m[32m14 passed[39m[22m[90m (14)[39m
|
|
27
|
+
[2m Tests [22m [1m[32m216 passed[39m[22m[90m (216)[39m
|
|
28
|
+
[2m Start at [22m 10:27:35
|
|
29
|
+
[2m Duration [22m 6.44s[2m (transform 389ms, setup 0ms, collect 634ms, tests 3.15s, environment 2ms, prepare 1.07s)[22m
|
|
30
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Agent Wall 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
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @agent-wall/core
|
|
2
|
+
|
|
3
|
+
Core proxy engine and security modules for [Agent Wall](https://github.com/agent-wall/agent-wall) — a security firewall for AI agents.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@agent-wall/core)
|
|
6
|
+
[](https://github.com/agent-wall/agent-wall/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
> **Most users should install [`agent-wall`](https://www.npmjs.com/package/agent-wall) (the CLI) instead.** This package is for programmatic usage — embedding Agent Wall into your own tools.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @agent-wall/core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## What's Inside
|
|
17
|
+
|
|
18
|
+
| Module | Description |
|
|
19
|
+
|--------|-------------|
|
|
20
|
+
| `StdioProxy` | Two-way MCP protocol interception proxy |
|
|
21
|
+
| `PolicyEngine` | First-match-wins rule evaluator (glob, rate limiting, strict mode) |
|
|
22
|
+
| `ResponseScanner` | Secret/PII detection with ReDoS protection |
|
|
23
|
+
| `InjectionDetector` | 30+ prompt injection patterns |
|
|
24
|
+
| `EgressControl` | URL/SSRF protection (RFC1918, metadata, IP obfuscation) |
|
|
25
|
+
| `KillSwitch` | Emergency deny-all (file, signal, programmatic) |
|
|
26
|
+
| `ChainDetector` | Multi-step attack pattern detection |
|
|
27
|
+
| `AuditLogger` | HMAC-SHA256 signed JSON lines with rotation |
|
|
28
|
+
| `PolicyLoader` | YAML config with Zod validation and hot-reload |
|
|
29
|
+
| `DashboardServer` | WebSocket + HTTP server for real-time dashboard |
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import {
|
|
35
|
+
StdioProxy,
|
|
36
|
+
PolicyEngine,
|
|
37
|
+
ResponseScanner,
|
|
38
|
+
InjectionDetector,
|
|
39
|
+
EgressControl,
|
|
40
|
+
KillSwitch,
|
|
41
|
+
ChainDetector,
|
|
42
|
+
AuditLogger,
|
|
43
|
+
loadPolicy,
|
|
44
|
+
} from "@agent-wall/core";
|
|
45
|
+
|
|
46
|
+
// Load policy from YAML
|
|
47
|
+
const { config } = loadPolicy("./agent-wall.yaml");
|
|
48
|
+
|
|
49
|
+
// Create security modules
|
|
50
|
+
const policyEngine = new PolicyEngine(config);
|
|
51
|
+
const scanner = new ResponseScanner(config.responseScanning);
|
|
52
|
+
const injectionDetector = new InjectionDetector();
|
|
53
|
+
const egressControl = new EgressControl();
|
|
54
|
+
const killSwitch = new KillSwitch();
|
|
55
|
+
const chainDetector = new ChainDetector();
|
|
56
|
+
|
|
57
|
+
// Create proxy
|
|
58
|
+
const proxy = new StdioProxy({
|
|
59
|
+
command: "npx",
|
|
60
|
+
args: ["@modelcontextprotocol/server-filesystem", "/home/user"],
|
|
61
|
+
policyEngine,
|
|
62
|
+
responseScanner: scanner,
|
|
63
|
+
injectionDetector,
|
|
64
|
+
egressControl,
|
|
65
|
+
killSwitch,
|
|
66
|
+
chainDetector,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
await proxy.start();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Full docs: [agent-wall.github.io/agent-wall](https://agent-wall.github.io/agent-wall/)
|
|
75
|
+
|
|
76
|
+
API reference: [agent-wall.github.io/agent-wall/api/core](https://agent-wall.github.io/agent-wall/api/core)
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
[MIT](https://github.com/agent-wall/agent-wall/blob/main/LICENSE)
|