@crowdstrike/aidr 1.0.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/.editorconfig +9 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/workflows/ci.yml +128 -0
- package/.pnpmfile.cjs +17 -0
- package/.releaserc.json +21 -0
- package/LICENSE.txt +21 -0
- package/README.md +3 -0
- package/biome.json +67 -0
- package/dist/chunk.cjs +34 -0
- package/dist/index.cjs +356 -0
- package/dist/index.d.cts +2347 -0
- package/dist/index.d.mts +2347 -0
- package/dist/index.mjs +354 -0
- package/dist/schemas/ai-guard.cjs +1000 -0
- package/dist/schemas/ai-guard.d.cts +1232 -0
- package/dist/schemas/ai-guard.d.mts +1232 -0
- package/dist/schemas/ai-guard.mjs +907 -0
- package/dist/schemas/index.cjs +7 -0
- package/dist/schemas/index.d.cts +64 -0
- package/dist/schemas/index.d.mts +64 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/schemas.cjs +139 -0
- package/dist/schemas.mjs +108 -0
- package/flake.lock +59 -0
- package/flake.nix +26 -0
- package/openapi-ts.config.ts +15 -0
- package/package.json +55 -0
- package/pnpm-workspace.yaml +3 -0
- package/scripts/generate-models +15 -0
- package/scripts/test +10 -0
- package/specs/ai-guard.openapi.json +3721 -0
- package/src/client.ts +441 -0
- package/src/core/error.ts +78 -0
- package/src/index.ts +2 -0
- package/src/internal/builtin-types.ts +18 -0
- package/src/internal/errors.ts +34 -0
- package/src/internal/headers.ts +100 -0
- package/src/internal/parse.ts +30 -0
- package/src/internal/request-options.ts +57 -0
- package/src/internal/types.ts +3 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/values.ts +38 -0
- package/src/schemas/ai-guard.ts +1215 -0
- package/src/schemas/index.ts +114 -0
- package/src/services/ai-guard.ts +27 -0
- package/src/types/ai-guard.ts +2276 -0
- package/src/types/index.ts +161 -0
- package/tests/ai-guard.test.ts +29 -0
- package/tsconfig.json +26 -0
- package/tsdown.config.mts +14 -0
- package/vitest.config.mts +4 -0
|
@@ -0,0 +1,1215 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Response Schema
|
|
5
|
+
*
|
|
6
|
+
* Pangea standard response schema
|
|
7
|
+
*/
|
|
8
|
+
export const PangeaResponseSchema = v.object({
|
|
9
|
+
request_id: v.string(),
|
|
10
|
+
request_time: v.pipe(v.string(), v.isoTimestamp()),
|
|
11
|
+
response_time: v.pipe(v.string(), v.isoTimestamp()),
|
|
12
|
+
status: v.string(),
|
|
13
|
+
summary: v.optional(v.string()),
|
|
14
|
+
result: v.optional(v.record(v.string(), v.unknown())),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const PangeaValidationErrorsSchema = PangeaResponseSchema;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Device status. Allowed values are active, pending, disabled
|
|
21
|
+
*/
|
|
22
|
+
export const AidrDeviceStatusSchema = v.picklist([
|
|
23
|
+
'pending',
|
|
24
|
+
'active',
|
|
25
|
+
'disabled',
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
export const AidrIpv4OrV6Schema = v.union([
|
|
29
|
+
v.pipe(v.string(), v.ip()),
|
|
30
|
+
v.pipe(v.string(), v.ip()),
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
export const AidrDeviceSchema = v.strictObject({
|
|
34
|
+
id: v.pipe(v.string(), v.minLength(1), v.maxLength(32)),
|
|
35
|
+
name: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(255))),
|
|
36
|
+
status: v.optional(AidrDeviceStatusSchema),
|
|
37
|
+
metadata: v.optional(v.record(v.string(), v.unknown())),
|
|
38
|
+
user_id: v.optional(v.string()),
|
|
39
|
+
last_used_ip: v.optional(AidrIpv4OrV6Schema),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const AidrDeviceTokenInfoSchema = v.object({
|
|
43
|
+
token: v.optional(v.string()),
|
|
44
|
+
expires_in: v.optional(v.pipe(v.number(), v.integer())),
|
|
45
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const AidrDeviceResultSchema = v.strictObject({
|
|
49
|
+
id: v.pipe(v.string(), v.minLength(1), v.maxLength(32)),
|
|
50
|
+
name: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(255))),
|
|
51
|
+
status: AidrDeviceStatusSchema,
|
|
52
|
+
metadata: v.optional(v.record(v.string(), v.unknown())),
|
|
53
|
+
user_id: v.optional(v.string()),
|
|
54
|
+
last_used_ip: v.optional(AidrIpv4OrV6Schema),
|
|
55
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
56
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* client generated unique ID.
|
|
61
|
+
*/
|
|
62
|
+
export const AidrDeviceIdSchema = v.pipe(
|
|
63
|
+
v.string(),
|
|
64
|
+
v.minLength(1),
|
|
65
|
+
v.maxLength(32)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* List or filter/search device records.
|
|
70
|
+
*/
|
|
71
|
+
export const AidrDeviceSearchSchema = v.strictObject({
|
|
72
|
+
filter: v.optional(
|
|
73
|
+
v.object({
|
|
74
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
75
|
+
created_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
76
|
+
created_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
77
|
+
created_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
78
|
+
created_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
79
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
80
|
+
updated_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
81
|
+
updated_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
82
|
+
updated_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
83
|
+
updated_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
84
|
+
id: v.optional(v.string()),
|
|
85
|
+
id__contains: v.optional(v.array(v.string())),
|
|
86
|
+
id__in: v.optional(v.array(v.string())),
|
|
87
|
+
name: v.optional(v.string()),
|
|
88
|
+
name__contains: v.optional(v.array(v.string())),
|
|
89
|
+
name__in: v.optional(v.array(v.string())),
|
|
90
|
+
status: v.optional(AidrDeviceStatusSchema),
|
|
91
|
+
status__contains: v.optional(v.array(AidrDeviceStatusSchema)),
|
|
92
|
+
status__in: v.optional(v.array(AidrDeviceStatusSchema)),
|
|
93
|
+
})
|
|
94
|
+
),
|
|
95
|
+
last: v.optional(v.string()),
|
|
96
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
97
|
+
order_by: v.optional(v.picklist(['name', 'created_at', 'updated_at'])),
|
|
98
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const AidrDeviceSearchResultSchema = v.object({
|
|
102
|
+
count: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
103
|
+
last: v.optional(v.string()),
|
|
104
|
+
devices: v.optional(v.array(AidrDeviceResultSchema)),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* MetricEvent data
|
|
109
|
+
*/
|
|
110
|
+
export const AidrMetricOnlyDataSchema = v.strictObject({
|
|
111
|
+
app_id: v.optional(v.string()),
|
|
112
|
+
actor_id: v.optional(v.string()),
|
|
113
|
+
llm_provider: v.optional(v.string()),
|
|
114
|
+
model: v.optional(v.string()),
|
|
115
|
+
model_version: v.optional(v.string()),
|
|
116
|
+
request_token_count: v.optional(v.pipe(v.number(), v.integer())),
|
|
117
|
+
response_token_count: v.optional(v.pipe(v.number(), v.integer())),
|
|
118
|
+
source_ip: v.optional(v.pipe(v.string(), v.ip())),
|
|
119
|
+
source_location: v.optional(v.string()),
|
|
120
|
+
event_type: v.optional(v.string()),
|
|
121
|
+
collector_instance_id: v.optional(v.string()),
|
|
122
|
+
extra_info: v.optional(v.record(v.string(), v.unknown())),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* List or filter/search saved filter records.
|
|
127
|
+
*/
|
|
128
|
+
export const AidrSavedFilterSearchSchema = v.strictObject({
|
|
129
|
+
filter: v.optional(
|
|
130
|
+
v.object({
|
|
131
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
132
|
+
created_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
133
|
+
created_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
134
|
+
created_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
135
|
+
created_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
136
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
137
|
+
updated_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
138
|
+
updated_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
139
|
+
updated_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
140
|
+
updated_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
141
|
+
id: v.optional(v.string()),
|
|
142
|
+
id__contains: v.optional(v.array(v.string())),
|
|
143
|
+
id__in: v.optional(v.array(v.string())),
|
|
144
|
+
name: v.optional(v.string()),
|
|
145
|
+
name__contains: v.optional(v.array(v.string())),
|
|
146
|
+
name__in: v.optional(v.array(v.string())),
|
|
147
|
+
})
|
|
148
|
+
),
|
|
149
|
+
last: v.optional(v.string()),
|
|
150
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
151
|
+
order_by: v.optional(v.picklist(['name', 'created_at', 'updated_at'])),
|
|
152
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const AidrSavedFilterSchema = v.strictObject({
|
|
156
|
+
name: v.string(),
|
|
157
|
+
filter: v.record(v.string(), v.unknown()),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export const AidrSavedFilterResultSchema = v.strictObject({
|
|
161
|
+
name: v.string(),
|
|
162
|
+
filter: v.record(v.string(), v.unknown()),
|
|
163
|
+
created_at: v.pipe(v.string(), v.isoTimestamp()),
|
|
164
|
+
updated_at: v.pipe(v.string(), v.isoTimestamp()),
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export const AidrSavedFilterSearchResultSchema = v.object({
|
|
168
|
+
count: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
169
|
+
last: v.optional(v.string()),
|
|
170
|
+
saved_filters: v.optional(v.array(AidrSavedFilterResultSchema)),
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* List or filter/search field alias records.
|
|
175
|
+
*/
|
|
176
|
+
export const AidrFieldAliasSearchSchema = v.strictObject({
|
|
177
|
+
filter: v.optional(
|
|
178
|
+
v.object({
|
|
179
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
180
|
+
created_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
181
|
+
created_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
182
|
+
created_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
183
|
+
created_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
184
|
+
field_name: v.optional(v.string()),
|
|
185
|
+
field_name__contains: v.optional(v.array(v.string())),
|
|
186
|
+
field_name__in: v.optional(v.array(v.string())),
|
|
187
|
+
field_type: v.optional(v.string()),
|
|
188
|
+
field_type__contains: v.optional(v.array(v.string())),
|
|
189
|
+
field_type__in: v.optional(v.array(v.string())),
|
|
190
|
+
field_alias: v.optional(v.string()),
|
|
191
|
+
field_alias__contains: v.optional(v.array(v.string())),
|
|
192
|
+
field_alias__in: v.optional(v.array(v.string())),
|
|
193
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
194
|
+
updated_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
195
|
+
updated_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
196
|
+
updated_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
197
|
+
updated_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
198
|
+
})
|
|
199
|
+
),
|
|
200
|
+
last: v.optional(v.string()),
|
|
201
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
202
|
+
order_by: v.optional(
|
|
203
|
+
v.picklist([
|
|
204
|
+
'field_name',
|
|
205
|
+
'field_type',
|
|
206
|
+
'created_at',
|
|
207
|
+
'updated_at',
|
|
208
|
+
'published_at',
|
|
209
|
+
'field_alias',
|
|
210
|
+
])
|
|
211
|
+
),
|
|
212
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export const AidrCustomlistSchema = v.object({
|
|
216
|
+
name: v.optional(v.string()),
|
|
217
|
+
type: v.optional(v.picklist(['site'])),
|
|
218
|
+
content: v.optional(v.array(v.unknown())),
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
export const ChatCompletionsGuardSchema = v.strictObject({
|
|
222
|
+
guard_input: v.record(v.string(), v.unknown()),
|
|
223
|
+
app_id: v.optional(v.string()),
|
|
224
|
+
user_id: v.optional(v.string()),
|
|
225
|
+
llm_provider: v.optional(v.string()),
|
|
226
|
+
model: v.optional(v.string()),
|
|
227
|
+
model_version: v.optional(v.string()),
|
|
228
|
+
source_ip: v.optional(v.string()),
|
|
229
|
+
source_location: v.optional(v.string()),
|
|
230
|
+
tenant_id: v.optional(v.string()),
|
|
231
|
+
event_type: v.optional(
|
|
232
|
+
v.picklist(['input', 'output', 'tool_input', 'tool_output', 'tool_listing'])
|
|
233
|
+
),
|
|
234
|
+
collector_instance_id: v.optional(v.string()),
|
|
235
|
+
extra_info: v.optional(
|
|
236
|
+
v.objectWithRest(
|
|
237
|
+
{
|
|
238
|
+
app_name: v.optional(v.string()),
|
|
239
|
+
app_group: v.optional(v.string()),
|
|
240
|
+
app_version: v.optional(v.string()),
|
|
241
|
+
actor_name: v.optional(v.string()),
|
|
242
|
+
actor_group: v.optional(v.string()),
|
|
243
|
+
source_region: v.optional(v.string()),
|
|
244
|
+
sub_tenant: v.optional(v.string()),
|
|
245
|
+
mcp_tools: v.optional(
|
|
246
|
+
v.array(
|
|
247
|
+
v.strictObject({
|
|
248
|
+
server_name: v.pipe(v.string(), v.minLength(1)),
|
|
249
|
+
tools: v.pipe(
|
|
250
|
+
v.array(v.pipe(v.string(), v.minLength(1))),
|
|
251
|
+
v.minLength(1)
|
|
252
|
+
),
|
|
253
|
+
})
|
|
254
|
+
)
|
|
255
|
+
),
|
|
256
|
+
},
|
|
257
|
+
v.unknown()
|
|
258
|
+
)
|
|
259
|
+
),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export const AidrPromptInjectionResultSchema = v.object({
|
|
263
|
+
action: v.optional(v.string()),
|
|
264
|
+
analyzer_responses: v.optional(
|
|
265
|
+
v.array(
|
|
266
|
+
v.object({
|
|
267
|
+
analyzer: v.string(),
|
|
268
|
+
confidence: v.number(),
|
|
269
|
+
})
|
|
270
|
+
)
|
|
271
|
+
),
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
export const AidrRedactEntityResultSchema = v.object({
|
|
275
|
+
entities: v.optional(
|
|
276
|
+
v.array(
|
|
277
|
+
v.object({
|
|
278
|
+
action: v.string(),
|
|
279
|
+
type: v.string(),
|
|
280
|
+
value: v.string(),
|
|
281
|
+
start_pos: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))),
|
|
282
|
+
})
|
|
283
|
+
)
|
|
284
|
+
),
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
export const AidrMaliciousEntityResultSchema = v.object({
|
|
288
|
+
entities: v.optional(
|
|
289
|
+
v.array(
|
|
290
|
+
v.object({
|
|
291
|
+
type: v.string(),
|
|
292
|
+
value: v.string(),
|
|
293
|
+
start_pos: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))),
|
|
294
|
+
raw: v.optional(v.record(v.string(), v.unknown())),
|
|
295
|
+
})
|
|
296
|
+
)
|
|
297
|
+
),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
export const AidrSingleEntityResultSchema = v.object({
|
|
301
|
+
action: v.optional(v.string()),
|
|
302
|
+
entities: v.optional(v.array(v.string())),
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
export const AidrLanguageResultSchema = v.object({
|
|
306
|
+
action: v.optional(v.string()),
|
|
307
|
+
language: v.optional(v.string()),
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
export const AidrTopicResultSchema = v.object({
|
|
311
|
+
action: v.optional(v.string()),
|
|
312
|
+
topics: v.optional(
|
|
313
|
+
v.array(
|
|
314
|
+
v.object({
|
|
315
|
+
topic: v.string(),
|
|
316
|
+
confidence: v.number(),
|
|
317
|
+
})
|
|
318
|
+
)
|
|
319
|
+
),
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
export const AidrCustomlistResultSchema = v.object({
|
|
323
|
+
id: v.optional(v.string()),
|
|
324
|
+
name: v.optional(v.string()),
|
|
325
|
+
type: v.optional(v.picklist(['site'])),
|
|
326
|
+
content: v.optional(v.array(v.record(v.string(), v.unknown()))),
|
|
327
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
328
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* List or filter/search policy records.
|
|
333
|
+
*/
|
|
334
|
+
export const AidrPolicySearchSchema = v.strictObject({
|
|
335
|
+
filter: v.optional(
|
|
336
|
+
v.object({
|
|
337
|
+
key: v.optional(v.string()),
|
|
338
|
+
key__contains: v.optional(v.array(v.string())),
|
|
339
|
+
name__in: v.optional(v.array(v.string())),
|
|
340
|
+
status: v.optional(v.string()),
|
|
341
|
+
})
|
|
342
|
+
),
|
|
343
|
+
last: v.optional(v.string()),
|
|
344
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
345
|
+
order_by: v.optional(v.picklist(['key', 'name', 'created_at', 'updated_at'])),
|
|
346
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
export const AidrPromptItemSchema = v.object({
|
|
350
|
+
id: v.optional(v.string()),
|
|
351
|
+
type: v.optional(v.string()),
|
|
352
|
+
content: v.optional(v.string()),
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
export const AidrPromptItemListResultSchema = v.object({
|
|
356
|
+
policies: v.optional(v.array(AidrPromptItemSchema)),
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
export const AidrFieldAliasSchema = v.strictObject({
|
|
360
|
+
field_name: v.string(),
|
|
361
|
+
field_type: v.string(),
|
|
362
|
+
field_alias: v.string(),
|
|
363
|
+
field_tags: v.optional(v.array(v.string())),
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
export const AidrFieldAliasResultSchema = v.strictObject({
|
|
367
|
+
field_name: v.string(),
|
|
368
|
+
field_type: v.string(),
|
|
369
|
+
field_alias: v.string(),
|
|
370
|
+
field_tags: v.optional(v.array(v.string())),
|
|
371
|
+
created_at: v.pipe(v.string(), v.isoTimestamp()),
|
|
372
|
+
updated_at: v.pipe(v.string(), v.isoTimestamp()),
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
export const AidrFieldAliasSearchResultSchema = v.object({
|
|
376
|
+
count: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
377
|
+
last: v.optional(v.string()),
|
|
378
|
+
items: v.optional(v.array(AidrFieldAliasResultSchema)),
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
export const AidrPolicycollectionResultSchema = v.object({
|
|
382
|
+
key: v.optional(v.string()),
|
|
383
|
+
name: v.optional(v.string()),
|
|
384
|
+
type: v.optional(
|
|
385
|
+
v.picklist(['logging', 'gateway', 'browser', 'application', 'agentic'])
|
|
386
|
+
),
|
|
387
|
+
settings: v.optional(v.record(v.string(), v.unknown())),
|
|
388
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
389
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* List or filter/search policy collection records.
|
|
394
|
+
*/
|
|
395
|
+
export const AidrPolicycollectionSearchSchema = v.strictObject({
|
|
396
|
+
filter: v.optional(
|
|
397
|
+
v.object({
|
|
398
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
399
|
+
created_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
400
|
+
created_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
401
|
+
created_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
402
|
+
created_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
403
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
404
|
+
updated_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
405
|
+
updated_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
406
|
+
updated_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
407
|
+
updated_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
408
|
+
type: v.optional(
|
|
409
|
+
v.picklist(['logging', 'gateway', 'browser', 'application', 'agentic'])
|
|
410
|
+
),
|
|
411
|
+
type__in: v.optional(
|
|
412
|
+
v.array(
|
|
413
|
+
v.picklist([
|
|
414
|
+
'logging',
|
|
415
|
+
'gateway',
|
|
416
|
+
'browser',
|
|
417
|
+
'application',
|
|
418
|
+
'agentic',
|
|
419
|
+
])
|
|
420
|
+
)
|
|
421
|
+
),
|
|
422
|
+
key: v.optional(v.string()),
|
|
423
|
+
key__contains: v.optional(v.array(v.string())),
|
|
424
|
+
key__in: v.optional(v.array(v.string())),
|
|
425
|
+
name: v.optional(v.string()),
|
|
426
|
+
name__contains: v.optional(v.array(v.string())),
|
|
427
|
+
name__in: v.optional(v.array(v.string())),
|
|
428
|
+
})
|
|
429
|
+
),
|
|
430
|
+
last: v.optional(v.string()),
|
|
431
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
432
|
+
order_by: v.optional(
|
|
433
|
+
v.picklist(['key', 'name', 'type', 'created_at', 'updated_at'])
|
|
434
|
+
),
|
|
435
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
export const AidrPolicycollectionSearchResultSchema = v.object({
|
|
439
|
+
collections: v.optional(v.array(AidrPolicycollectionResultSchema)),
|
|
440
|
+
count: v.optional(v.pipe(v.number(), v.integer())),
|
|
441
|
+
last: v.optional(v.string()),
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* List or filter/search list records.
|
|
446
|
+
*/
|
|
447
|
+
export const AidrCustomlistSearchSchema = v.strictObject({
|
|
448
|
+
filter: v.optional(
|
|
449
|
+
v.object({
|
|
450
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
451
|
+
created_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
452
|
+
created_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
453
|
+
created_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
454
|
+
created_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
455
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
456
|
+
updated_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
457
|
+
updated_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
458
|
+
updated_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
459
|
+
updated_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
460
|
+
type: v.optional(v.string()),
|
|
461
|
+
name: v.optional(v.string()),
|
|
462
|
+
name__contains: v.optional(v.array(v.string())),
|
|
463
|
+
name__in: v.optional(v.array(v.string())),
|
|
464
|
+
})
|
|
465
|
+
),
|
|
466
|
+
last: v.optional(v.string()),
|
|
467
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
468
|
+
order_by: v.optional(v.picklist(['id', 'name', 'created_at', 'updated_at'])),
|
|
469
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
export const AidrCustomlistSearchResultSchema = v.object({
|
|
473
|
+
lists: v.optional(v.array(AidrCustomlistResultSchema)),
|
|
474
|
+
count: v.optional(v.pipe(v.number(), v.integer())),
|
|
475
|
+
last: v.optional(v.string()),
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* AIDR Collector Summary list
|
|
480
|
+
*/
|
|
481
|
+
export const AidrSensorInsightsSchema = v.strictObject({
|
|
482
|
+
is_instance_data: v.optional(v.boolean()),
|
|
483
|
+
filters: v.optional(
|
|
484
|
+
v.strictObject({
|
|
485
|
+
collector_id: v.optional(v.string()),
|
|
486
|
+
collector_id__contains: v.optional(v.array(v.string())),
|
|
487
|
+
collector_id__in: v.optional(v.array(v.string())),
|
|
488
|
+
instance_id: v.optional(v.string()),
|
|
489
|
+
instance_id__contains: v.optional(v.array(v.string())),
|
|
490
|
+
instance_id__in: v.optional(v.array(v.string())),
|
|
491
|
+
collector_type: v.optional(v.string()),
|
|
492
|
+
collector_type_contains: v.optional(v.array(v.string())),
|
|
493
|
+
collector_type__in: v.optional(v.array(v.string())),
|
|
494
|
+
})
|
|
495
|
+
),
|
|
496
|
+
order_by: v.optional(v.string()),
|
|
497
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
498
|
+
count: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
499
|
+
last: v.optional(v.string()),
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Duration string (e.g., '100ms', '2h')
|
|
504
|
+
*/
|
|
505
|
+
export const AidrGolangDurationSchema = v.union([v.unknown(), v.unknown()]);
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* List or filter/config records.
|
|
509
|
+
*/
|
|
510
|
+
export const AidrServiceConfigListSchema = v.strictObject({
|
|
511
|
+
filter: v.optional(
|
|
512
|
+
v.strictObject({
|
|
513
|
+
name: v.optional(v.string()),
|
|
514
|
+
name__contains: v.optional(v.array(v.string())),
|
|
515
|
+
name__in: v.optional(v.array(v.string())),
|
|
516
|
+
collector_type: v.optional(v.string()),
|
|
517
|
+
collector_type__contains: v.optional(v.array(v.string())),
|
|
518
|
+
collector_type__in: v.optional(v.array(v.string())),
|
|
519
|
+
id: v.optional(v.string()),
|
|
520
|
+
id__contains: v.optional(v.array(v.string())),
|
|
521
|
+
id__in: v.optional(v.array(v.string())),
|
|
522
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
523
|
+
created_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
524
|
+
created_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
525
|
+
created_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
526
|
+
created_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
527
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
528
|
+
updated_at__gt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
529
|
+
updated_at__gte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
530
|
+
updated_at__lt: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
531
|
+
updated_at__lte: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
532
|
+
})
|
|
533
|
+
),
|
|
534
|
+
last: v.optional(v.string()),
|
|
535
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
536
|
+
order_by: v.optional(v.picklist(['id', 'created_at', 'updated_at'])),
|
|
537
|
+
size: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* A service config ID
|
|
542
|
+
*/
|
|
543
|
+
export const AidrMetricpoolIdSchema = v.pipe(
|
|
544
|
+
v.string(),
|
|
545
|
+
v.regex(/^pro_[a-z2-7]{32}$/)
|
|
546
|
+
);
|
|
547
|
+
|
|
548
|
+
export const AidrLogSchema = v.strictObject({
|
|
549
|
+
event: v.record(v.string(), v.unknown()),
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
export const AidrLogsSchema = v.strictObject({
|
|
553
|
+
events: v.pipe(
|
|
554
|
+
v.array(v.record(v.string(), v.unknown())),
|
|
555
|
+
v.minLength(1),
|
|
556
|
+
v.maxLength(100)
|
|
557
|
+
),
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* An empty object
|
|
562
|
+
*/
|
|
563
|
+
export const AidrEmptySchema = v.strictObject({});
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Collector health endpoint object
|
|
567
|
+
*/
|
|
568
|
+
export const AidrSensorHealthSchema = v.strictObject({
|
|
569
|
+
collector_instance_id: v.string(),
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* A service config ID
|
|
574
|
+
*/
|
|
575
|
+
export const ServiceConfigIdSchema = v.pipe(
|
|
576
|
+
v.string(),
|
|
577
|
+
v.regex(/^pci_[a-z2-7]{32}$/)
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* AIDR Collector Summary Result Data
|
|
582
|
+
*/
|
|
583
|
+
export const AidrSensorInsightsItemSchema = v.strictObject({
|
|
584
|
+
updated_at: v.pipe(v.string(), v.isoTimestamp()),
|
|
585
|
+
created_at: v.pipe(v.string(), v.isoTimestamp()),
|
|
586
|
+
count: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
587
|
+
collector_id: ServiceConfigIdSchema,
|
|
588
|
+
instance_id: v.optional(v.string()),
|
|
589
|
+
collector_type: v.string(),
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* AIDR Collector Summary Result Data
|
|
594
|
+
*/
|
|
595
|
+
export const AidrSensorInsightsResultSchema = v.object({
|
|
596
|
+
count: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
597
|
+
last: v.optional(v.string()),
|
|
598
|
+
items: v.optional(v.array(AidrSensorInsightsItemSchema)),
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* audit data activity configuration
|
|
603
|
+
*/
|
|
604
|
+
export const AidrAuditDataActivitySchema = v.object({
|
|
605
|
+
audit_config_id: v.optional(ServiceConfigIdSchema),
|
|
606
|
+
enabled: v.optional(v.boolean()),
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* A filter ID
|
|
611
|
+
*/
|
|
612
|
+
export const FilterIdSchema = v.pipe(v.string(), v.regex(/^paf_[a-z2-7]{32}$/));
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* A Policy ID
|
|
616
|
+
*/
|
|
617
|
+
export const PolicyIdSchema = v.pipe(v.string(), v.regex(/^pap_[a-z2-7]{32}$/));
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* A time in ISO-8601 format
|
|
621
|
+
*/
|
|
622
|
+
export const AidrTimestampSchema = v.pipe(v.string(), v.isoTimestamp());
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* AIDR Service Config Settings
|
|
626
|
+
*/
|
|
627
|
+
export const AidrServiceConfigSchema = v.objectWithRest(
|
|
628
|
+
{
|
|
629
|
+
id: v.optional(ServiceConfigIdSchema),
|
|
630
|
+
name: v.optional(v.string()),
|
|
631
|
+
version: v.optional(v.string()),
|
|
632
|
+
metric_pool_rid: v.optional(AidrMetricpoolIdSchema),
|
|
633
|
+
updated_at: v.optional(AidrTimestampSchema),
|
|
634
|
+
collector_type: v.optional(v.string()),
|
|
635
|
+
settings: v.optional(v.record(v.string(), v.unknown())),
|
|
636
|
+
warning_threshold: v.optional(AidrGolangDurationSchema),
|
|
637
|
+
in_active_threshold: v.optional(AidrGolangDurationSchema),
|
|
638
|
+
},
|
|
639
|
+
v.unknown()
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
export const AidrServiceConfigResultSchema = AidrServiceConfigSchema;
|
|
643
|
+
|
|
644
|
+
export const AidrDeviceCheckResultSchema = v.strictObject({
|
|
645
|
+
device: v.optional(AidrDeviceResultSchema),
|
|
646
|
+
config: v.optional(AidrServiceConfigResultSchema),
|
|
647
|
+
access_token: v.optional(AidrDeviceTokenInfoSchema),
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Define field name and path mapping to extract from the log
|
|
652
|
+
*/
|
|
653
|
+
export const AidrResourceFieldMappingSchema = v.record(
|
|
654
|
+
v.string(),
|
|
655
|
+
v.strictObject({
|
|
656
|
+
path: v.pipe(
|
|
657
|
+
v.string(),
|
|
658
|
+
v.regex(/^([\w]+|\*)(\.(\*|[\w]+|#(\(\w+(==|!=|=~|>|<)[^)]*\))?|\d+))*$/)
|
|
659
|
+
),
|
|
660
|
+
type: v.picklist(['string', 'int', 'bool']),
|
|
661
|
+
disabled: v.optional(v.boolean()),
|
|
662
|
+
})
|
|
663
|
+
);
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* AIDR metric pool settings
|
|
667
|
+
*/
|
|
668
|
+
export const AidrMetricpoolResourceSchema = v.object({
|
|
669
|
+
id: v.optional(AidrMetricpoolIdSchema),
|
|
670
|
+
updated_at: v.optional(AidrTimestampSchema),
|
|
671
|
+
field_mappings: v.optional(AidrResourceFieldMappingSchema),
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
export const AidrOtelInstrumentationScopeSchema = v.objectWithRest(
|
|
675
|
+
{
|
|
676
|
+
name: v.optional(v.string()),
|
|
677
|
+
version: v.optional(v.string()),
|
|
678
|
+
},
|
|
679
|
+
v.unknown()
|
|
680
|
+
);
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* AIDR Search Request
|
|
684
|
+
*/
|
|
685
|
+
export const AidrMetricSchema = v.strictObject({
|
|
686
|
+
start_time: v.pipe(v.string(), v.isoTimestamp()),
|
|
687
|
+
end_time: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
688
|
+
interval: v.optional(
|
|
689
|
+
v.picklist(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])
|
|
690
|
+
),
|
|
691
|
+
filters: v.optional(v.strictObject({})),
|
|
692
|
+
tag_filters: v.optional(v.strictObject({})),
|
|
693
|
+
detector_filters: v.optional(v.strictObject({})),
|
|
694
|
+
group_by: v.optional(
|
|
695
|
+
v.array(v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/)))
|
|
696
|
+
),
|
|
697
|
+
order_by: v.optional(v.string()),
|
|
698
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
699
|
+
limit: v.optional(v.pipe(v.number(), v.integer())),
|
|
700
|
+
offset: v.optional(v.pipe(v.number(), v.integer())),
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* AIDR Aggregate Search Request
|
|
705
|
+
*/
|
|
706
|
+
export const AidrMetricAggregatesSearchParamsSchema = v.strictObject({
|
|
707
|
+
start_time: v.pipe(v.string(), v.isoTimestamp()),
|
|
708
|
+
end_time: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
709
|
+
interval: v.optional(
|
|
710
|
+
v.picklist(['hourly', 'daily', 'weekly', 'monthly', 'yearly'])
|
|
711
|
+
),
|
|
712
|
+
aggregate_fields: v.optional(
|
|
713
|
+
v.array(v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/)))
|
|
714
|
+
),
|
|
715
|
+
filters: v.optional(v.strictObject({})),
|
|
716
|
+
detector_filters: v.optional(v.strictObject({})),
|
|
717
|
+
tag_filters: v.optional(v.strictObject({})),
|
|
718
|
+
group_by: v.optional(
|
|
719
|
+
v.array(v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/)))
|
|
720
|
+
),
|
|
721
|
+
order_by: v.optional(v.string()),
|
|
722
|
+
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
723
|
+
limit: v.optional(v.pipe(v.number(), v.integer())),
|
|
724
|
+
offset: v.optional(v.pipe(v.number(), v.integer())),
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
export const AidrMetricAggregateItemSchema = v.array(
|
|
728
|
+
v.object({
|
|
729
|
+
bucket_time: v.optional(
|
|
730
|
+
v.union([v.pipe(v.string(), v.isoTimestamp()), v.null()])
|
|
731
|
+
),
|
|
732
|
+
counts: v.record(v.string(), v.pipe(v.number(), v.integer())),
|
|
733
|
+
})
|
|
734
|
+
);
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* AIDR Metric Search Aggregate Result Data
|
|
738
|
+
*/
|
|
739
|
+
export const AidrMetricAggregatesResultSchema = v.object({
|
|
740
|
+
items: v.optional(v.array(AidrMetricAggregateItemSchema)),
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
export const AidrMetricResultDetectorItemSchema = v.optional(
|
|
744
|
+
v.record(v.string(), v.unknown()),
|
|
745
|
+
{}
|
|
746
|
+
);
|
|
747
|
+
|
|
748
|
+
export const AidrMetricItemSchema = v.array(
|
|
749
|
+
v.object({
|
|
750
|
+
bucket_time: v.optional(
|
|
751
|
+
v.union([v.pipe(v.string(), v.isoTimestamp()), v.null()])
|
|
752
|
+
),
|
|
753
|
+
tags: v.optional(v.record(v.string(), v.string())),
|
|
754
|
+
count: v.pipe(v.number(), v.integer()),
|
|
755
|
+
detectors_count: v.pipe(v.number(), v.integer()),
|
|
756
|
+
is_blocked: v.boolean(),
|
|
757
|
+
request_token_count: v.pipe(v.number(), v.integer()),
|
|
758
|
+
response_token_count: v.pipe(v.number(), v.integer()),
|
|
759
|
+
detectors: AidrMetricResultDetectorItemSchema,
|
|
760
|
+
})
|
|
761
|
+
);
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* AIDR Metric Search Result Data
|
|
765
|
+
*/
|
|
766
|
+
export const AidrMetricResultSchema = v.object({
|
|
767
|
+
items: v.optional(v.array(AidrMetricItemSchema)),
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* A time in ISO-8601 format
|
|
772
|
+
*/
|
|
773
|
+
export const AuthnTimestampSchema = v.pipe(v.string(), v.isoTimestamp());
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* A time in ISO-8601 format or null
|
|
777
|
+
*/
|
|
778
|
+
export const AirdTimestampNullableSchema = v.union([
|
|
779
|
+
AuthnTimestampSchema,
|
|
780
|
+
v.null(),
|
|
781
|
+
]);
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Details about the evaluation of a single rule, including whether it matched, the action to take, the rule name, and optional debugging information.
|
|
785
|
+
*/
|
|
786
|
+
export const AccessRuleResultSchema = v.strictObject({
|
|
787
|
+
matched: v.boolean(),
|
|
788
|
+
action: v.string(),
|
|
789
|
+
name: v.string(),
|
|
790
|
+
logic: v.optional(v.record(v.string(), v.unknown())),
|
|
791
|
+
attributes: v.optional(v.record(v.string(), v.unknown())),
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Result of the recipe evaluating configured rules
|
|
796
|
+
*/
|
|
797
|
+
export const AidrAccessRulesResponseSchema = v.record(v.string(), v.unknown());
|
|
798
|
+
|
|
799
|
+
export const RuleRedactionConfigSchema = v.intersect([
|
|
800
|
+
v.union([
|
|
801
|
+
v.object({
|
|
802
|
+
redaction_type: v.optional(v.picklist(['mask', 'detect_only'])),
|
|
803
|
+
}),
|
|
804
|
+
v.object({
|
|
805
|
+
redaction_type: v.optional(v.literal('replacement')),
|
|
806
|
+
}),
|
|
807
|
+
v.object({
|
|
808
|
+
redaction_type: v.optional(v.literal('partial_masking')),
|
|
809
|
+
}),
|
|
810
|
+
v.object({
|
|
811
|
+
redaction_type: v.optional(v.literal('hash')),
|
|
812
|
+
}),
|
|
813
|
+
v.object({
|
|
814
|
+
redaction_type: v.optional(v.literal('fpe')),
|
|
815
|
+
}),
|
|
816
|
+
]),
|
|
817
|
+
v.strictObject({
|
|
818
|
+
redaction_type: v.picklist([
|
|
819
|
+
'mask',
|
|
820
|
+
'partial_masking',
|
|
821
|
+
'replacement',
|
|
822
|
+
'hash',
|
|
823
|
+
'detect_only',
|
|
824
|
+
'fpe',
|
|
825
|
+
]),
|
|
826
|
+
redaction_value: v.optional(v.string()),
|
|
827
|
+
partial_masking: v.optional(
|
|
828
|
+
v.object({
|
|
829
|
+
masking_type: v.optional(v.picklist(['unmask', 'mask'])),
|
|
830
|
+
unmasked_from_left: v.optional(
|
|
831
|
+
v.pipe(v.number(), v.integer(), v.minValue(0))
|
|
832
|
+
),
|
|
833
|
+
unmasked_from_right: v.optional(
|
|
834
|
+
v.pipe(v.number(), v.integer(), v.minValue(0))
|
|
835
|
+
),
|
|
836
|
+
masked_from_left: v.optional(
|
|
837
|
+
v.pipe(v.number(), v.integer(), v.minValue(0))
|
|
838
|
+
),
|
|
839
|
+
masked_from_right: v.optional(
|
|
840
|
+
v.pipe(v.number(), v.integer(), v.minValue(0))
|
|
841
|
+
),
|
|
842
|
+
chars_to_ignore: v.optional(v.array(v.pipe(v.string(), v.length(1)))),
|
|
843
|
+
masking_char: v.optional(v.pipe(v.string(), v.length(1)), '*'),
|
|
844
|
+
})
|
|
845
|
+
),
|
|
846
|
+
hash: v.optional(
|
|
847
|
+
v.union([
|
|
848
|
+
v.object({
|
|
849
|
+
hash_type: v.picklist(['md5', 'sha256']),
|
|
850
|
+
}),
|
|
851
|
+
v.null(),
|
|
852
|
+
])
|
|
853
|
+
),
|
|
854
|
+
fpe_alphabet: v.optional(
|
|
855
|
+
v.union([
|
|
856
|
+
v.literal('numeric'),
|
|
857
|
+
v.literal('alphalower'),
|
|
858
|
+
v.literal('alphaupper'),
|
|
859
|
+
v.literal('alpha'),
|
|
860
|
+
v.literal('alphanumericlower'),
|
|
861
|
+
v.literal('alphanumericupper'),
|
|
862
|
+
v.literal('alphanumeric'),
|
|
863
|
+
v.null(),
|
|
864
|
+
])
|
|
865
|
+
),
|
|
866
|
+
}),
|
|
867
|
+
]);
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Configuration for individual detectors used in an AI Guard recipe. Each entry specifies the detector to use, its enabled state, detector-specific settings, and the [action](https://pangea.cloud/docs/ai-guard/recipes#actions) to apply when detections occur.
|
|
871
|
+
*/
|
|
872
|
+
export const DetectorSettingsSchema = v.array(
|
|
873
|
+
v.strictObject({
|
|
874
|
+
detector_name: v.string(),
|
|
875
|
+
state: v.picklist(['disabled', 'enabled']),
|
|
876
|
+
settings: v.object({
|
|
877
|
+
rules: v.optional(
|
|
878
|
+
v.array(
|
|
879
|
+
v.strictObject({
|
|
880
|
+
redact_rule_id: v.string(),
|
|
881
|
+
redaction: RuleRedactionConfigSchema,
|
|
882
|
+
block: v.optional(v.boolean()),
|
|
883
|
+
disabled: v.optional(v.boolean()),
|
|
884
|
+
reputation_check: v.optional(v.boolean()),
|
|
885
|
+
transform_if_malicious: v.optional(v.boolean()),
|
|
886
|
+
})
|
|
887
|
+
)
|
|
888
|
+
),
|
|
889
|
+
}),
|
|
890
|
+
})
|
|
891
|
+
);
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* Configuration for an individual access rule used in an AI Guard recipe. Each rule defines its matching logic and the action to apply when the logic evaluates to true.
|
|
895
|
+
*/
|
|
896
|
+
export const AccessRuleSettingsSchema = v.strictObject({
|
|
897
|
+
rule_key: v.pipe(v.string(), v.regex(/^([a-zA-Z0-9_][a-zA-Z0-9/|_]*)$/)),
|
|
898
|
+
name: v.string(),
|
|
899
|
+
state: v.picklist(['block', 'report']),
|
|
900
|
+
logic: v.record(v.string(), v.unknown()),
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
export const AidrPolicySchema = v.strictObject({
|
|
904
|
+
key: v.string(),
|
|
905
|
+
name: v.string(),
|
|
906
|
+
description: v.optional(v.string()),
|
|
907
|
+
schema_version: v.picklist(['v1.1']),
|
|
908
|
+
detector_settings: v.optional(DetectorSettingsSchema),
|
|
909
|
+
access_rules: v.optional(v.array(AccessRuleSettingsSchema)),
|
|
910
|
+
connector_settings: v.optional(
|
|
911
|
+
v.object({
|
|
912
|
+
redact: v.optional(
|
|
913
|
+
v.object({
|
|
914
|
+
fpe_tweak_vault_secret_id: v.optional(v.string()),
|
|
915
|
+
})
|
|
916
|
+
),
|
|
917
|
+
})
|
|
918
|
+
),
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
export const AidrPolicyResultSchema = v.strictObject({
|
|
922
|
+
id: PolicyIdSchema,
|
|
923
|
+
key: v.string(),
|
|
924
|
+
name: v.string(),
|
|
925
|
+
description: v.optional(v.string()),
|
|
926
|
+
schema_version: v.picklist(['v1.1']),
|
|
927
|
+
revision: v.number(),
|
|
928
|
+
detector_settings: v.optional(DetectorSettingsSchema),
|
|
929
|
+
access_rules: v.optional(v.array(AccessRuleSettingsSchema)),
|
|
930
|
+
connector_settings: v.optional(
|
|
931
|
+
v.object({
|
|
932
|
+
redact: v.optional(
|
|
933
|
+
v.object({
|
|
934
|
+
fpe_tweak_vault_secret_id: v.optional(v.string()),
|
|
935
|
+
})
|
|
936
|
+
),
|
|
937
|
+
})
|
|
938
|
+
),
|
|
939
|
+
created_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
940
|
+
updated_at: v.optional(v.pipe(v.string(), v.isoTimestamp())),
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
export const AidrPolicySearchResultSchema = v.object({
|
|
944
|
+
count: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
945
|
+
last: v.optional(v.string()),
|
|
946
|
+
policies: v.optional(v.array(AidrPolicyResultSchema)),
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Defines an AI Guard recipe - a named configuration of detectors and redaction settings used to analyze and protect data flows in AI-powered applications.
|
|
951
|
+
*
|
|
952
|
+
* Recipes specify which detectors are active, how they behave, and may include reusable settings such as FPE tweaks.
|
|
953
|
+
*
|
|
954
|
+
* For details, see the [AI Guard Recipes](https://pangea.cloud/docs/ai-guard/recipes) documentation.
|
|
955
|
+
*/
|
|
956
|
+
export const RecipeConfigSchema = v.strictObject({
|
|
957
|
+
name: v.string(),
|
|
958
|
+
description: v.string(),
|
|
959
|
+
version: v.optional(v.string(), 'v1'),
|
|
960
|
+
detectors: v.optional(DetectorSettingsSchema),
|
|
961
|
+
access_rules: v.optional(v.array(AccessRuleSettingsSchema)),
|
|
962
|
+
connector_settings: v.optional(
|
|
963
|
+
v.object({
|
|
964
|
+
redact: v.optional(
|
|
965
|
+
v.object({
|
|
966
|
+
fpe_tweak_vault_secret_id: v.optional(v.string()),
|
|
967
|
+
})
|
|
968
|
+
),
|
|
969
|
+
})
|
|
970
|
+
),
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
export const AidrPolicyDefaultsSchema = v.object({
|
|
974
|
+
default_policies: v.record(v.string(), v.unknown()),
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
export const LanguageResultSchema = v.object({
|
|
978
|
+
action: v.optional(v.string()),
|
|
979
|
+
language: v.optional(v.string()),
|
|
980
|
+
});
|
|
981
|
+
|
|
982
|
+
export const RedactEntityResultSchema = v.object({
|
|
983
|
+
entities: v.optional(
|
|
984
|
+
v.array(
|
|
985
|
+
v.object({
|
|
986
|
+
action: v.string(),
|
|
987
|
+
type: v.string(),
|
|
988
|
+
value: v.string(),
|
|
989
|
+
redacted: v.boolean(),
|
|
990
|
+
start_pos: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))),
|
|
991
|
+
})
|
|
992
|
+
)
|
|
993
|
+
),
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
export const MaliciousEntityActionSchema = v.picklist([
|
|
997
|
+
'report',
|
|
998
|
+
'defang',
|
|
999
|
+
'disabled',
|
|
1000
|
+
'block',
|
|
1001
|
+
]);
|
|
1002
|
+
|
|
1003
|
+
export const PiiEntityActionSchema = v.picklist([
|
|
1004
|
+
'disabled',
|
|
1005
|
+
'report',
|
|
1006
|
+
'block',
|
|
1007
|
+
'mask',
|
|
1008
|
+
'partial_masking',
|
|
1009
|
+
'replacement',
|
|
1010
|
+
'hash',
|
|
1011
|
+
'fpe',
|
|
1012
|
+
]);
|
|
1013
|
+
|
|
1014
|
+
export const AidrOtelResourceLogsSchema: v.GenericSchema = v.objectWithRest(
|
|
1015
|
+
{
|
|
1016
|
+
resource: v.optional(v.lazy(() => AidrOtelResourceSchema)),
|
|
1017
|
+
scopeLogs: v.array(v.lazy(() => AidrOtelScopeLogsSchema)),
|
|
1018
|
+
},
|
|
1019
|
+
v.unknown()
|
|
1020
|
+
);
|
|
1021
|
+
|
|
1022
|
+
export const AidrOtelResourceSchema: v.GenericSchema = v.objectWithRest(
|
|
1023
|
+
{
|
|
1024
|
+
attributes: v.optional(v.array(v.lazy(() => AidrOtelKeyValueSchema))),
|
|
1025
|
+
},
|
|
1026
|
+
v.unknown()
|
|
1027
|
+
);
|
|
1028
|
+
|
|
1029
|
+
export const AidrOtelScopeLogsSchema: v.GenericSchema = v.objectWithRest(
|
|
1030
|
+
{
|
|
1031
|
+
scope: v.optional(AidrOtelInstrumentationScopeSchema),
|
|
1032
|
+
logRecords: v.array(v.lazy(() => AidrOtelLogRecordSchema)),
|
|
1033
|
+
},
|
|
1034
|
+
v.unknown()
|
|
1035
|
+
);
|
|
1036
|
+
|
|
1037
|
+
export const AidrOtelLogRecordSchema: v.GenericSchema = v.objectWithRest(
|
|
1038
|
+
{
|
|
1039
|
+
timeUnixNano: v.optional(v.pipe(v.string(), v.regex(/^[0-9]+$/))),
|
|
1040
|
+
observedTimeUnixNano: v.optional(v.pipe(v.string(), v.regex(/^[0-9]+$/))),
|
|
1041
|
+
severityNumber: v.optional(v.pipe(v.number(), v.integer())),
|
|
1042
|
+
severityText: v.optional(v.string()),
|
|
1043
|
+
name: v.optional(v.string()),
|
|
1044
|
+
body: v.lazy(() => AidrOtelAnyValueSchema),
|
|
1045
|
+
attributes: v.optional(v.array(v.lazy(() => AidrOtelKeyValueSchema))),
|
|
1046
|
+
flags: v.optional(v.pipe(v.number(), v.integer())),
|
|
1047
|
+
traceId: v.optional(v.string()),
|
|
1048
|
+
spanId: v.optional(v.string()),
|
|
1049
|
+
traceFlags: v.optional(v.string()),
|
|
1050
|
+
},
|
|
1051
|
+
v.unknown()
|
|
1052
|
+
);
|
|
1053
|
+
|
|
1054
|
+
export const AidrOtelKeyValueSchema: v.GenericSchema = v.objectWithRest(
|
|
1055
|
+
{
|
|
1056
|
+
key: v.string(),
|
|
1057
|
+
value: v.lazy(() => AidrOtelAnyValueSchema),
|
|
1058
|
+
},
|
|
1059
|
+
v.unknown()
|
|
1060
|
+
);
|
|
1061
|
+
|
|
1062
|
+
export const AidrOtelAnyValueSchema: v.GenericSchema = v.union([
|
|
1063
|
+
v.object({
|
|
1064
|
+
stringValue: v.string(),
|
|
1065
|
+
}),
|
|
1066
|
+
v.object({
|
|
1067
|
+
boolValue: v.union([
|
|
1068
|
+
v.boolean(),
|
|
1069
|
+
v.literal('true'),
|
|
1070
|
+
v.literal('false'),
|
|
1071
|
+
v.literal('True'),
|
|
1072
|
+
v.literal('False'),
|
|
1073
|
+
]),
|
|
1074
|
+
}),
|
|
1075
|
+
v.object({
|
|
1076
|
+
intValue: v.union([
|
|
1077
|
+
v.pipe(v.number(), v.integer()),
|
|
1078
|
+
v.pipe(v.string(), v.regex(/^-?\d+$/)),
|
|
1079
|
+
]),
|
|
1080
|
+
}),
|
|
1081
|
+
v.object({
|
|
1082
|
+
doubleValue: v.union([
|
|
1083
|
+
v.number(),
|
|
1084
|
+
v.pipe(v.string(), v.regex(/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/)),
|
|
1085
|
+
]),
|
|
1086
|
+
}),
|
|
1087
|
+
v.object({
|
|
1088
|
+
arrayValue: v.lazy(() => AidrOtelArrayValueSchema),
|
|
1089
|
+
}),
|
|
1090
|
+
v.object({
|
|
1091
|
+
kvlistValue: v.lazy(() => AidrOtelKeyValueListSchema),
|
|
1092
|
+
}),
|
|
1093
|
+
v.object({
|
|
1094
|
+
bytesValue: v.string(),
|
|
1095
|
+
}),
|
|
1096
|
+
]);
|
|
1097
|
+
|
|
1098
|
+
export const AidrOtelArrayValueSchema = v.objectWithRest(
|
|
1099
|
+
{
|
|
1100
|
+
values: v.array(AidrOtelAnyValueSchema),
|
|
1101
|
+
},
|
|
1102
|
+
v.unknown()
|
|
1103
|
+
);
|
|
1104
|
+
|
|
1105
|
+
export const AidrOtelKeyValueListSchema = v.objectWithRest(
|
|
1106
|
+
{
|
|
1107
|
+
values: v.array(AidrOtelKeyValueSchema),
|
|
1108
|
+
},
|
|
1109
|
+
v.unknown()
|
|
1110
|
+
);
|
|
1111
|
+
|
|
1112
|
+
export const AidrPostV1GuardChatCompletionsRequestSchema = v.object({
|
|
1113
|
+
body: v.optional(ChatCompletionsGuardSchema),
|
|
1114
|
+
path: v.optional(v.never()),
|
|
1115
|
+
query: v.optional(v.never()),
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* No description provided
|
|
1120
|
+
*/
|
|
1121
|
+
export const AidrPostV1GuardChatCompletionsResponseSchema = v.intersect([
|
|
1122
|
+
PangeaResponseSchema,
|
|
1123
|
+
v.object({
|
|
1124
|
+
result: v.optional(
|
|
1125
|
+
v.object({
|
|
1126
|
+
guard_output: v.optional(v.record(v.string(), v.unknown())),
|
|
1127
|
+
blocked: v.optional(v.boolean()),
|
|
1128
|
+
transformed: v.optional(v.boolean()),
|
|
1129
|
+
policy: v.optional(v.string()),
|
|
1130
|
+
detectors: v.object({
|
|
1131
|
+
malicious_prompt: v.optional(
|
|
1132
|
+
v.object({
|
|
1133
|
+
detected: v.optional(v.boolean()),
|
|
1134
|
+
data: v.optional(AidrPromptInjectionResultSchema),
|
|
1135
|
+
})
|
|
1136
|
+
),
|
|
1137
|
+
confidential_and_pii_entity: v.optional(
|
|
1138
|
+
v.object({
|
|
1139
|
+
detected: v.optional(v.boolean()),
|
|
1140
|
+
data: v.optional(AidrRedactEntityResultSchema),
|
|
1141
|
+
})
|
|
1142
|
+
),
|
|
1143
|
+
malicious_entity: v.optional(
|
|
1144
|
+
v.object({
|
|
1145
|
+
detected: v.optional(v.boolean()),
|
|
1146
|
+
data: v.optional(AidrMaliciousEntityResultSchema),
|
|
1147
|
+
})
|
|
1148
|
+
),
|
|
1149
|
+
custom_entity: v.optional(
|
|
1150
|
+
v.object({
|
|
1151
|
+
detected: v.optional(v.boolean()),
|
|
1152
|
+
data: v.optional(AidrRedactEntityResultSchema),
|
|
1153
|
+
})
|
|
1154
|
+
),
|
|
1155
|
+
secret_and_key_entity: v.optional(
|
|
1156
|
+
v.object({
|
|
1157
|
+
detected: v.optional(v.boolean()),
|
|
1158
|
+
data: v.optional(AidrRedactEntityResultSchema),
|
|
1159
|
+
})
|
|
1160
|
+
),
|
|
1161
|
+
competitors: v.optional(
|
|
1162
|
+
v.object({
|
|
1163
|
+
detected: v.optional(v.boolean()),
|
|
1164
|
+
data: v.optional(AidrSingleEntityResultSchema),
|
|
1165
|
+
})
|
|
1166
|
+
),
|
|
1167
|
+
language: v.optional(
|
|
1168
|
+
v.object({
|
|
1169
|
+
detected: v.optional(v.boolean()),
|
|
1170
|
+
data: v.optional(AidrLanguageResultSchema),
|
|
1171
|
+
})
|
|
1172
|
+
),
|
|
1173
|
+
topic: v.optional(
|
|
1174
|
+
v.object({
|
|
1175
|
+
detected: v.optional(v.boolean()),
|
|
1176
|
+
data: v.optional(AidrTopicResultSchema),
|
|
1177
|
+
})
|
|
1178
|
+
),
|
|
1179
|
+
code: v.optional(
|
|
1180
|
+
v.object({
|
|
1181
|
+
detected: v.optional(v.boolean()),
|
|
1182
|
+
data: v.optional(AidrLanguageResultSchema),
|
|
1183
|
+
})
|
|
1184
|
+
),
|
|
1185
|
+
}),
|
|
1186
|
+
access_rules: v.optional(AidrAccessRulesResponseSchema),
|
|
1187
|
+
fpe_context: v.optional(v.string()),
|
|
1188
|
+
})
|
|
1189
|
+
),
|
|
1190
|
+
}),
|
|
1191
|
+
]);
|
|
1192
|
+
|
|
1193
|
+
export const GetAsyncRequestRequestSchema = v.object({
|
|
1194
|
+
body: v.optional(v.never()),
|
|
1195
|
+
path: v.object({
|
|
1196
|
+
requestId: v.string(),
|
|
1197
|
+
}),
|
|
1198
|
+
query: v.optional(v.never()),
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
export const GetAsyncRequestResponseSchema = v.union([
|
|
1202
|
+
PangeaResponseSchema,
|
|
1203
|
+
v.intersect([
|
|
1204
|
+
PangeaResponseSchema,
|
|
1205
|
+
v.object({
|
|
1206
|
+
result: v.optional(
|
|
1207
|
+
v.object({
|
|
1208
|
+
ttl_mins: v.optional(v.pipe(v.number(), v.integer())),
|
|
1209
|
+
retry_counter: v.optional(v.pipe(v.number(), v.integer())),
|
|
1210
|
+
location: v.optional(v.string()),
|
|
1211
|
+
})
|
|
1212
|
+
),
|
|
1213
|
+
}),
|
|
1214
|
+
]),
|
|
1215
|
+
]);
|