@cdot65/prisma-airs 0.1.0 → 0.1.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/README.md ADDED
@@ -0,0 +1,187 @@
1
+ # @cdot65/prisma-airs
2
+
3
+ OpenClaw plugin for [Prisma AIRS](https://www.paloaltonetworks.com/prisma/ai-runtime-security) (AI Runtime Security) from Palo Alto Networks.
4
+
5
+ ## Features
6
+
7
+ - **Gateway RPC**: `prisma-airs.scan`, `prisma-airs.status`
8
+ - **Agent Tool**: `prisma_airs_scan`
9
+ - **CLI**: `openclaw prisma-airs`, `openclaw prisma-airs-scan`
10
+ - **Bootstrap Hook**: Security reminder on agent startup
11
+
12
+ **Detection capabilities:**
13
+
14
+ - Prompt injection
15
+ - Data leakage (DLP)
16
+ - Malicious URLs
17
+ - Toxic content
18
+ - Database security
19
+ - Malicious code
20
+
21
+ ## Installation
22
+
23
+ ### Install from npm
24
+
25
+ ```bash
26
+ openclaw plugins install @cdot65/prisma-airs
27
+ ```
28
+
29
+ ### Restart Gateway
30
+
31
+ ```bash
32
+ # systemd (Linux)
33
+ openclaw gateway restart
34
+
35
+ # or manually
36
+ openclaw gateway stop && openclaw gateway start
37
+ ```
38
+
39
+ ### Verify Installation
40
+
41
+ ```bash
42
+ # Check plugin is loaded
43
+ openclaw plugins list | grep prisma
44
+
45
+ # Check status
46
+ openclaw prisma-airs
47
+ ```
48
+
49
+ ## Configuration
50
+
51
+ ### 1. Set API Key
52
+
53
+ Get your API key from [Strata Cloud Manager](https://docs.paloaltonetworks.com/ai-runtime-security).
54
+
55
+ **Option A: Environment variable**
56
+
57
+ ```bash
58
+ export PANW_AI_SEC_API_KEY="your-key"
59
+ ```
60
+
61
+ **Option B: systemd service (Linux)**
62
+
63
+ ```bash
64
+ # Create override file
65
+ mkdir -p ~/.config/systemd/user/openclaw-gateway.service.d
66
+ cat > ~/.config/systemd/user/openclaw-gateway.service.d/env.conf << 'EOF'
67
+ [Service]
68
+ Environment=PANW_AI_SEC_API_KEY=your-key-here
69
+ EOF
70
+
71
+ # Reload and restart
72
+ systemctl --user daemon-reload
73
+ openclaw gateway restart
74
+ ```
75
+
76
+ ### 2. Plugin Config (optional)
77
+
78
+ ```bash
79
+ # Via CLI
80
+ openclaw config set plugins.entries.prisma-airs.config.profile_name "my-profile"
81
+ openclaw config set plugins.entries.prisma-airs.config.app_name "my-app"
82
+ ```
83
+
84
+ Or in `~/.openclaw/openclaw.json`:
85
+
86
+ ```json
87
+ {
88
+ "plugins": {
89
+ "entries": {
90
+ "prisma-airs": {
91
+ "config": {
92
+ "profile_name": "default",
93
+ "app_name": "openclaw",
94
+ "reminder_enabled": true
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Usage
103
+
104
+ ### CLI
105
+
106
+ ```bash
107
+ # Check status
108
+ openclaw prisma-airs
109
+
110
+ # Scan text
111
+ openclaw prisma-airs-scan "message to scan"
112
+ openclaw prisma-airs-scan --json "message"
113
+ ```
114
+
115
+ ### Gateway RPC
116
+
117
+ ```bash
118
+ # Status
119
+ openclaw gateway call prisma-airs.status
120
+
121
+ # Scan
122
+ openclaw gateway call prisma-airs.scan --params '{"prompt":"user input"}'
123
+ ```
124
+
125
+ ### Agent Tool
126
+
127
+ Agents can use `prisma_airs_scan` directly:
128
+
129
+ ```json
130
+ {
131
+ "tool": "prisma_airs_scan",
132
+ "params": {
133
+ "prompt": "content to scan",
134
+ "sessionId": "conversation-123"
135
+ }
136
+ }
137
+ ```
138
+
139
+ ### TypeScript
140
+
141
+ ```typescript
142
+ import { scan } from "@cdot65/prisma-airs";
143
+
144
+ const result = await scan({
145
+ prompt: "user message",
146
+ sessionId: "conv-123",
147
+ });
148
+
149
+ if (result.action === "block") {
150
+ console.log("Blocked:", result.categories);
151
+ }
152
+ ```
153
+
154
+ ## ScanResult
155
+
156
+ ```typescript
157
+ interface ScanResult {
158
+ action: "allow" | "warn" | "block";
159
+ severity: "SAFE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
160
+ categories: string[];
161
+ scanId: string;
162
+ reportId: string;
163
+ profileName: string;
164
+ promptDetected: { injection: boolean; dlp: boolean; urlCats: boolean };
165
+ responseDetected: { dlp: boolean; urlCats: boolean };
166
+ sessionId?: string;
167
+ trId?: string;
168
+ latencyMs: number;
169
+ error?: string;
170
+ }
171
+ ```
172
+
173
+ ## Requirements
174
+
175
+ - Node.js 18+
176
+ - OpenClaw Gateway
177
+ - Prisma AIRS API key ([Strata Cloud Manager](https://docs.paloaltonetworks.com/ai-runtime-security))
178
+
179
+ ## Links
180
+
181
+ - [GitHub](https://github.com/cdot65/prisma-airs-plugin-openclaw)
182
+ - [Prisma AIRS Docs](https://docs.paloaltonetworks.com/ai-runtime-security)
183
+ - [API Reference](https://pan.dev/prisma-airs/)
184
+
185
+ ## License
186
+
187
+ MIT
package/index.ts CHANGED
@@ -11,6 +11,8 @@
11
11
  */
12
12
 
13
13
  import { scan, isConfigured, ScanRequest, ScanResult } from "./src/scanner";
14
+ import { fileURLToPath } from "url";
15
+ import { dirname, join } from "path";
14
16
 
15
17
  // Plugin config interface
16
18
  interface PrismaAirsConfig {
@@ -62,6 +64,7 @@ interface PluginApi {
62
64
  handler: (params: ScanRequest) => Promise<ScanResult>;
63
65
  }) => void;
64
66
  registerCli: (setup: (ctx: { program: unknown }) => void, opts: { commands: string[] }) => void;
67
+ registerPluginHooksFromDir?: (dir: string) => void;
65
68
  }
66
69
 
67
70
  // Get plugin config from OpenClaw config
@@ -90,13 +93,22 @@ export default function register(api: PluginApi): void {
90
93
  `Prisma AIRS plugin loaded (reminder_enabled=${config.reminder_enabled ?? true})`
91
94
  );
92
95
 
96
+ // Register hooks from the hooks directory
97
+ if (api.registerPluginHooksFromDir) {
98
+ const __filename = fileURLToPath(import.meta.url);
99
+ const __dirname = dirname(__filename);
100
+ const hooksDir = join(__dirname, "hooks");
101
+ api.registerPluginHooksFromDir(hooksDir);
102
+ api.logger.info(`Registered hooks from ${hooksDir}`);
103
+ }
104
+
93
105
  // Register RPC method for status check
94
106
  api.registerGatewayMethod("prisma-airs.status", ({ respond }) => {
95
107
  const cfg = getPluginConfig(api);
96
108
  const hasApiKey = isConfigured();
97
109
  respond(true, {
98
110
  plugin: "prisma-airs",
99
- version: "0.1.0",
111
+ version: "0.1.2",
100
112
  config: {
101
113
  profile_name: cfg.profile_name ?? "default",
102
114
  app_name: cfg.app_name ?? "openclaw",
@@ -185,7 +197,7 @@ export default function register(api: PluginApi): void {
185
197
  const hasKey = isConfigured();
186
198
  console.log("Prisma AIRS Plugin Status");
187
199
  console.log("-------------------------");
188
- console.log(`Version: 0.1.0`);
200
+ console.log(`Version: 0.1.2`);
189
201
  console.log(`Profile: ${cfg.profile_name ?? "default"}`);
190
202
  console.log(`App Name: ${cfg.app_name ?? "openclaw"}`);
191
203
  console.log(`Reminder: ${cfg.reminder_enabled ?? true}`);
@@ -236,7 +248,7 @@ export default function register(api: PluginApi): void {
236
248
  // Export plugin metadata for discovery
237
249
  export const id = "prisma-airs";
238
250
  export const name = "Prisma AIRS Security";
239
- export const version = "0.1.0";
251
+ export const version = "0.1.2";
240
252
 
241
253
  // Re-export scanner types and functions
242
254
  export { scan, isConfigured } from "./src/scanner";
@@ -2,7 +2,7 @@
2
2
  "id": "prisma-airs",
3
3
  "name": "Prisma AIRS Security",
4
4
  "description": "AI Runtime Security scanning via Palo Alto Networks - TypeScript implementation with Gateway RPC, agent tool, and bootstrap reminder hook",
5
- "version": "0.1.0",
5
+ "version": "0.1.2",
6
6
  "hooks": ["hooks/prisma-airs-guard"],
7
7
  "configSchema": {
8
8
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdot65/prisma-airs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Prisma AIRS (AI Runtime Security) plugin for OpenClaw - TypeScript implementation with Gateway RPC, agent tool, and bootstrap hook",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -43,6 +43,7 @@
43
43
  ]
44
44
  },
45
45
  "files": [
46
+ "README.md",
46
47
  "index.ts",
47
48
  "src/",
48
49
  "hooks/",