@cdot65/prisma-airs 0.2.0 → 0.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/openclaw.plugin.json +3 -2
- package/package.json +1 -1
- package/src/scanner.ts +15 -7
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "prisma-airs",
|
|
3
3
|
"name": "Prisma AIRS Security",
|
|
4
4
|
"description": "AI Runtime Security - full AIRS detection suite with audit logging, context injection, outbound blocking, and tool gating",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.2",
|
|
6
6
|
"entrypoint": "index.ts",
|
|
7
7
|
"hooks": [
|
|
8
8
|
"hooks/prisma-airs-guard",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
"requires": {
|
|
113
|
-
"env": ["PANW_AI_SEC_API_KEY"]
|
|
113
|
+
"env": ["PANW_AI_SEC_API_KEY"],
|
|
114
|
+
"envOptional": ["PANW_AI_SEC_PROFILE_NAME"]
|
|
114
115
|
}
|
|
115
116
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdot65/prisma-airs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Prisma AIRS (AI Runtime Security) plugin for OpenClaw - Full security suite with audit logging, context injection, outbound blocking, and tool gating",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
package/src/scanner.ts
CHANGED
|
@@ -97,6 +97,9 @@ interface AIRSResponse {
|
|
|
97
97
|
*/
|
|
98
98
|
export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
99
99
|
const apiKey = process.env.PANW_AI_SEC_API_KEY;
|
|
100
|
+
// Profile name: request param > env var > default
|
|
101
|
+
const profileName = request.profileName ?? process.env.PANW_AI_SEC_PROFILE_NAME ?? "default";
|
|
102
|
+
|
|
100
103
|
if (!apiKey) {
|
|
101
104
|
return {
|
|
102
105
|
action: "warn",
|
|
@@ -104,7 +107,7 @@ export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
|
104
107
|
categories: ["api_error"],
|
|
105
108
|
scanId: "",
|
|
106
109
|
reportId: "",
|
|
107
|
-
profileName
|
|
110
|
+
profileName,
|
|
108
111
|
promptDetected: { injection: false, dlp: false, urlCats: false },
|
|
109
112
|
responseDetected: { dlp: false, urlCats: false },
|
|
110
113
|
latencyMs: 0,
|
|
@@ -122,7 +125,7 @@ export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
|
122
125
|
// Build request body (per OpenAPI spec)
|
|
123
126
|
const body: AIRSRequest = {
|
|
124
127
|
ai_profile: {
|
|
125
|
-
profile_name:
|
|
128
|
+
profile_name: profileName,
|
|
126
129
|
},
|
|
127
130
|
contents: [contentItem],
|
|
128
131
|
};
|
|
@@ -160,7 +163,7 @@ export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
|
160
163
|
categories: ["api_error"],
|
|
161
164
|
scanId: "",
|
|
162
165
|
reportId: "",
|
|
163
|
-
profileName
|
|
166
|
+
profileName,
|
|
164
167
|
promptDetected: { injection: false, dlp: false, urlCats: false },
|
|
165
168
|
responseDetected: { dlp: false, urlCats: false },
|
|
166
169
|
latencyMs,
|
|
@@ -169,7 +172,7 @@ export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
const data: AIRSResponse = await resp.json();
|
|
172
|
-
return parseResponse(data, request, latencyMs);
|
|
175
|
+
return parseResponse(data, profileName, request, latencyMs);
|
|
173
176
|
} catch (err) {
|
|
174
177
|
const latencyMs = Date.now() - startTime;
|
|
175
178
|
return {
|
|
@@ -178,7 +181,7 @@ export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
|
178
181
|
categories: ["api_error"],
|
|
179
182
|
scanId: "",
|
|
180
183
|
reportId: "",
|
|
181
|
-
profileName
|
|
184
|
+
profileName,
|
|
182
185
|
promptDetected: { injection: false, dlp: false, urlCats: false },
|
|
183
186
|
responseDetected: { dlp: false, urlCats: false },
|
|
184
187
|
latencyMs,
|
|
@@ -190,10 +193,15 @@ export async function scan(request: ScanRequest): Promise<ScanResult> {
|
|
|
190
193
|
/**
|
|
191
194
|
* Parse AIRS API response into ScanResult
|
|
192
195
|
*/
|
|
193
|
-
function parseResponse(
|
|
196
|
+
function parseResponse(
|
|
197
|
+
data: AIRSResponse,
|
|
198
|
+
defaultProfileName: string,
|
|
199
|
+
request: ScanRequest,
|
|
200
|
+
latencyMs: number
|
|
201
|
+
): ScanResult {
|
|
194
202
|
const scanId = data.scan_id ?? "";
|
|
195
203
|
const reportId = data.report_id ?? "";
|
|
196
|
-
const profileName = data.profile_name ??
|
|
204
|
+
const profileName = data.profile_name ?? defaultProfileName;
|
|
197
205
|
const category = data.category ?? "benign";
|
|
198
206
|
const actionStr = data.action ?? "allow";
|
|
199
207
|
|