@crowdstrike/aidr 1.0.2 → 1.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/.github/CODEOWNERS +1 -1
- package/.github/workflows/ci.yml +0 -43
- package/.github/workflows/publish.yml +52 -0
- package/README.md +91 -0
- package/dist/index.cjs +9 -0
- package/dist/index.d.cts +121 -99
- package/dist/index.d.mts +121 -99
- package/dist/index.mjs +9 -0
- package/dist/schemas/ai-guard.cjs +35 -68
- package/dist/schemas/ai-guard.d.cts +75 -42
- package/dist/schemas/ai-guard.d.mts +75 -42
- package/dist/schemas/ai-guard.mjs +33 -63
- package/package.json +1 -1
- package/specs/ai-guard.openapi.json +302 -210
- package/src/schemas/ai-guard.ts +121 -142
- package/src/services/ai-guard.ts +12 -0
- package/src/types/ai-guard.ts +125 -118
- package/tests/ai-guard.test.ts +26 -1
package/src/schemas/ai-guard.ts
CHANGED
|
@@ -16,6 +16,8 @@ export const PangeaResponseSchema = v.object({
|
|
|
16
16
|
|
|
17
17
|
export const PangeaValidationErrorsSchema = PangeaResponseSchema;
|
|
18
18
|
|
|
19
|
+
export const PangeaAcceptedResponseSchema = PangeaResponseSchema;
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
22
|
* Device status. Allowed values are active, pending, disabled
|
|
21
23
|
*/
|
|
@@ -228,9 +230,7 @@ export const ChatCompletionsGuardSchema = v.strictObject({
|
|
|
228
230
|
source_ip: v.optional(v.string()),
|
|
229
231
|
source_location: v.optional(v.string()),
|
|
230
232
|
tenant_id: v.optional(v.string()),
|
|
231
|
-
event_type: v.optional(
|
|
232
|
-
v.picklist(['input', 'output', 'tool_input', 'tool_output', 'tool_listing'])
|
|
233
|
-
),
|
|
233
|
+
event_type: v.optional(v.string(), 'input'),
|
|
234
234
|
collector_instance_id: v.optional(v.string()),
|
|
235
235
|
extra_info: v.optional(
|
|
236
236
|
v.objectWithRest(
|
|
@@ -257,6 +257,7 @@ export const ChatCompletionsGuardSchema = v.strictObject({
|
|
|
257
257
|
v.unknown()
|
|
258
258
|
)
|
|
259
259
|
),
|
|
260
|
+
input_fpe_context: v.optional(v.string()),
|
|
260
261
|
});
|
|
261
262
|
|
|
262
263
|
export const AidrPromptInjectionResultSchema = v.object({
|
|
@@ -694,7 +695,9 @@ export const AidrMetricSchema = v.strictObject({
|
|
|
694
695
|
group_by: v.optional(
|
|
695
696
|
v.array(v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/)))
|
|
696
697
|
),
|
|
697
|
-
order_by: v.optional(
|
|
698
|
+
order_by: v.optional(
|
|
699
|
+
v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_.]{0,63}$/))
|
|
700
|
+
),
|
|
698
701
|
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
699
702
|
limit: v.optional(v.pipe(v.number(), v.integer())),
|
|
700
703
|
offset: v.optional(v.pipe(v.number(), v.integer())),
|
|
@@ -718,7 +721,9 @@ export const AidrMetricAggregatesSearchParamsSchema = v.strictObject({
|
|
|
718
721
|
group_by: v.optional(
|
|
719
722
|
v.array(v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/)))
|
|
720
723
|
),
|
|
721
|
-
order_by: v.optional(
|
|
724
|
+
order_by: v.optional(
|
|
725
|
+
v.pipe(v.string(), v.regex(/^[A-Za-z_][A-Za-z0-9_.]{0,63}$/))
|
|
726
|
+
),
|
|
722
727
|
order: v.optional(v.picklist(['asc', 'desc'])),
|
|
723
728
|
limit: v.optional(v.pipe(v.number(), v.integer())),
|
|
724
729
|
offset: v.optional(v.pipe(v.number(), v.integer())),
|
|
@@ -768,17 +773,14 @@ export const AidrMetricResultSchema = v.object({
|
|
|
768
773
|
});
|
|
769
774
|
|
|
770
775
|
/**
|
|
771
|
-
*
|
|
772
|
-
*/
|
|
773
|
-
export const AuthnTimestampSchema = v.pipe(v.string(), v.isoTimestamp());
|
|
774
|
-
|
|
775
|
-
/**
|
|
776
|
-
* A time in ISO-8601 format or null
|
|
776
|
+
* 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.
|
|
777
777
|
*/
|
|
778
|
-
export const
|
|
779
|
-
|
|
780
|
-
v.
|
|
781
|
-
])
|
|
778
|
+
export const AccessRuleSettingsSchema = v.strictObject({
|
|
779
|
+
rule_key: v.pipe(v.string(), v.regex(/^([a-zA-Z0-9_][a-zA-Z0-9/|_]*)$/)),
|
|
780
|
+
name: v.string(),
|
|
781
|
+
state: v.picklist(['block', 'report']),
|
|
782
|
+
logic: v.record(v.string(), v.unknown()),
|
|
783
|
+
});
|
|
782
784
|
|
|
783
785
|
/**
|
|
784
786
|
* Details about the evaluation of a single rule, including whether it matched, the action to take, the rule name, and optional debugging information.
|
|
@@ -890,16 +892,6 @@ export const DetectorSettingsSchema = v.array(
|
|
|
890
892
|
})
|
|
891
893
|
);
|
|
892
894
|
|
|
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
895
|
export const AidrPolicySchema = v.strictObject({
|
|
904
896
|
key: v.string(),
|
|
905
897
|
name: v.string(),
|
|
@@ -974,43 +966,6 @@ export const AidrPolicyDefaultsSchema = v.object({
|
|
|
974
966
|
default_policies: v.record(v.string(), v.unknown()),
|
|
975
967
|
});
|
|
976
968
|
|
|
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
969
|
export const AidrOtelResourceLogsSchema: v.GenericSchema = v.objectWithRest(
|
|
1015
970
|
{
|
|
1016
971
|
resource: v.optional(v.lazy(() => AidrOtelResourceSchema)),
|
|
@@ -1115,79 +1070,104 @@ export const AidrPostV1GuardChatCompletionsRequestSchema = v.object({
|
|
|
1115
1070
|
query: v.optional(v.never()),
|
|
1116
1071
|
});
|
|
1117
1072
|
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
),
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1073
|
+
export const AidrPostV1GuardChatCompletionsResponseSchema = v.union([
|
|
1074
|
+
v.intersect([
|
|
1075
|
+
PangeaResponseSchema,
|
|
1076
|
+
v.object({
|
|
1077
|
+
result: v.optional(
|
|
1078
|
+
v.object({
|
|
1079
|
+
guard_output: v.optional(v.record(v.string(), v.unknown())),
|
|
1080
|
+
blocked: v.optional(v.boolean()),
|
|
1081
|
+
transformed: v.optional(v.boolean()),
|
|
1082
|
+
policy: v.optional(v.string()),
|
|
1083
|
+
detectors: v.object({
|
|
1084
|
+
malicious_prompt: v.optional(
|
|
1085
|
+
v.object({
|
|
1086
|
+
detected: v.optional(v.boolean()),
|
|
1087
|
+
data: v.optional(AidrPromptInjectionResultSchema),
|
|
1088
|
+
})
|
|
1089
|
+
),
|
|
1090
|
+
confidential_and_pii_entity: v.optional(
|
|
1091
|
+
v.object({
|
|
1092
|
+
detected: v.optional(v.boolean()),
|
|
1093
|
+
data: v.optional(AidrRedactEntityResultSchema),
|
|
1094
|
+
})
|
|
1095
|
+
),
|
|
1096
|
+
malicious_entity: v.optional(
|
|
1097
|
+
v.object({
|
|
1098
|
+
detected: v.optional(v.boolean()),
|
|
1099
|
+
data: v.optional(AidrMaliciousEntityResultSchema),
|
|
1100
|
+
})
|
|
1101
|
+
),
|
|
1102
|
+
custom_entity: v.optional(
|
|
1103
|
+
v.object({
|
|
1104
|
+
detected: v.optional(v.boolean()),
|
|
1105
|
+
data: v.optional(AidrRedactEntityResultSchema),
|
|
1106
|
+
})
|
|
1107
|
+
),
|
|
1108
|
+
secret_and_key_entity: v.optional(
|
|
1109
|
+
v.object({
|
|
1110
|
+
detected: v.optional(v.boolean()),
|
|
1111
|
+
data: v.optional(AidrRedactEntityResultSchema),
|
|
1112
|
+
})
|
|
1113
|
+
),
|
|
1114
|
+
competitors: v.optional(
|
|
1115
|
+
v.object({
|
|
1116
|
+
detected: v.optional(v.boolean()),
|
|
1117
|
+
data: v.optional(AidrSingleEntityResultSchema),
|
|
1118
|
+
})
|
|
1119
|
+
),
|
|
1120
|
+
language: v.optional(
|
|
1121
|
+
v.object({
|
|
1122
|
+
detected: v.optional(v.boolean()),
|
|
1123
|
+
data: v.optional(AidrLanguageResultSchema),
|
|
1124
|
+
})
|
|
1125
|
+
),
|
|
1126
|
+
topic: v.optional(
|
|
1127
|
+
v.object({
|
|
1128
|
+
detected: v.optional(v.boolean()),
|
|
1129
|
+
data: v.optional(AidrTopicResultSchema),
|
|
1130
|
+
})
|
|
1131
|
+
),
|
|
1132
|
+
code: v.optional(
|
|
1133
|
+
v.object({
|
|
1134
|
+
detected: v.optional(v.boolean()),
|
|
1135
|
+
data: v.optional(AidrLanguageResultSchema),
|
|
1136
|
+
})
|
|
1137
|
+
),
|
|
1138
|
+
}),
|
|
1139
|
+
access_rules: v.optional(AidrAccessRulesResponseSchema),
|
|
1140
|
+
fpe_context: v.optional(v.string()),
|
|
1141
|
+
})
|
|
1142
|
+
),
|
|
1143
|
+
}),
|
|
1144
|
+
]),
|
|
1145
|
+
v.intersect([PangeaResponseSchema, PangeaAcceptedResponseSchema]),
|
|
1146
|
+
]);
|
|
1147
|
+
|
|
1148
|
+
export const AidrPostV1UnredactRequestSchema = v.object({
|
|
1149
|
+
body: v.optional(
|
|
1150
|
+
v.strictObject({
|
|
1151
|
+
redacted_data: v.unknown(),
|
|
1152
|
+
fpe_context: v.string(),
|
|
1153
|
+
})
|
|
1154
|
+
),
|
|
1155
|
+
path: v.optional(v.never()),
|
|
1156
|
+
query: v.optional(v.never()),
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
export const AidrPostV1UnredactResponseSchema = v.union([
|
|
1160
|
+
v.intersect([
|
|
1161
|
+
PangeaResponseSchema,
|
|
1162
|
+
v.object({
|
|
1163
|
+
result: v.optional(
|
|
1164
|
+
v.object({
|
|
1165
|
+
data: v.unknown(),
|
|
1166
|
+
})
|
|
1167
|
+
),
|
|
1168
|
+
}),
|
|
1169
|
+
]),
|
|
1170
|
+
v.intersect([PangeaResponseSchema, PangeaAcceptedResponseSchema]),
|
|
1191
1171
|
]);
|
|
1192
1172
|
|
|
1193
1173
|
export const GetAsyncRequestRequestSchema = v.object({
|
|
@@ -1203,13 +1183,12 @@ export const GetAsyncRequestResponseSchema = v.union([
|
|
|
1203
1183
|
v.intersect([
|
|
1204
1184
|
PangeaResponseSchema,
|
|
1205
1185
|
v.object({
|
|
1206
|
-
result: v.
|
|
1207
|
-
v.
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
),
|
|
1186
|
+
result: v.object({
|
|
1187
|
+
ttl_mins: v.optional(v.pipe(v.number(), v.integer())),
|
|
1188
|
+
retry_counter: v.optional(v.pipe(v.number(), v.integer())),
|
|
1189
|
+
location: v.optional(v.string()),
|
|
1190
|
+
}),
|
|
1191
|
+
status: v.picklist(['Accepted']),
|
|
1213
1192
|
}),
|
|
1214
1193
|
]),
|
|
1215
1194
|
]);
|
package/src/services/ai-guard.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { RequestOptions } from '../internal/request-options';
|
|
|
3
3
|
import type { MaybeAcceptedResponse } from '../types';
|
|
4
4
|
import type {
|
|
5
5
|
AidrPostV1GuardChatCompletionsResponse,
|
|
6
|
+
AidrPostV1UnredactData,
|
|
7
|
+
AidrPostV1UnredactResponse,
|
|
6
8
|
ChatCompletionsGuard,
|
|
7
9
|
} from '../types/ai-guard';
|
|
8
10
|
|
|
@@ -24,4 +26,14 @@ export class AIGuard extends Client {
|
|
|
24
26
|
...options,
|
|
25
27
|
});
|
|
26
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Decrypt or unredact fpe redactions
|
|
32
|
+
*/
|
|
33
|
+
unredact(
|
|
34
|
+
body: AidrPostV1UnredactData['body'],
|
|
35
|
+
options?: RequestOptions
|
|
36
|
+
): Promise<MaybeAcceptedResponse<AidrPostV1UnredactResponse['result']>> {
|
|
37
|
+
return this.post('/v1/unredact', { body, ...options });
|
|
38
|
+
}
|
|
27
39
|
}
|
package/src/types/ai-guard.ts
CHANGED
|
@@ -49,6 +49,8 @@ export type PangeaResponse = {
|
|
|
49
49
|
|
|
50
50
|
export type PangeaValidationErrors = PangeaResponse;
|
|
51
51
|
|
|
52
|
+
export type PangeaAcceptedResponse = PangeaResponse;
|
|
53
|
+
|
|
52
54
|
/**
|
|
53
55
|
* Device status. Allowed values are active, pending, disabled
|
|
54
56
|
*/
|
|
@@ -619,12 +621,7 @@ export type ChatCompletionsGuard = {
|
|
|
619
621
|
/**
|
|
620
622
|
* (AIDR) Event Type.
|
|
621
623
|
*/
|
|
622
|
-
event_type?:
|
|
623
|
-
| 'input'
|
|
624
|
-
| 'output'
|
|
625
|
-
| 'tool_input'
|
|
626
|
-
| 'tool_output'
|
|
627
|
-
| 'tool_listing';
|
|
624
|
+
event_type?: string;
|
|
628
625
|
/**
|
|
629
626
|
* (AIDR) collector instance id.
|
|
630
627
|
*/
|
|
@@ -685,6 +682,10 @@ export type ChatCompletionsGuard = {
|
|
|
685
682
|
}>
|
|
686
683
|
| undefined;
|
|
687
684
|
};
|
|
685
|
+
/**
|
|
686
|
+
* FPE (Format Preserving Encryption) context from a previous guard request. When provided, the encrypted input will be unredacted before processing.
|
|
687
|
+
*/
|
|
688
|
+
input_fpe_context?: string;
|
|
688
689
|
};
|
|
689
690
|
|
|
690
691
|
export type AidrPromptInjectionResult = {
|
|
@@ -1542,11 +1543,6 @@ export type AidrServiceConfigResult = AidrServiceConfig;
|
|
|
1542
1543
|
*/
|
|
1543
1544
|
export type AidrTimestamp = string;
|
|
1544
1545
|
|
|
1545
|
-
/**
|
|
1546
|
-
* A time in ISO-8601 format or null
|
|
1547
|
-
*/
|
|
1548
|
-
export type AirdTimestampNullable = AuthnTimestamp | null;
|
|
1549
|
-
|
|
1550
1546
|
/**
|
|
1551
1547
|
* Define field name and path mapping to extract from the log
|
|
1552
1548
|
*/
|
|
@@ -1825,9 +1821,28 @@ export type AidrMetricResultDetectorItem = {
|
|
|
1825
1821
|
};
|
|
1826
1822
|
|
|
1827
1823
|
/**
|
|
1828
|
-
*
|
|
1824
|
+
* 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.
|
|
1829
1825
|
*/
|
|
1830
|
-
export type
|
|
1826
|
+
export type AccessRuleSettings = {
|
|
1827
|
+
/**
|
|
1828
|
+
* Unique identifier for this rule. Should be user-readable and consistent across recipe updates.
|
|
1829
|
+
*/
|
|
1830
|
+
rule_key: string;
|
|
1831
|
+
/**
|
|
1832
|
+
* Display label for the rule shown in user interfaces.
|
|
1833
|
+
*/
|
|
1834
|
+
name: string;
|
|
1835
|
+
/**
|
|
1836
|
+
* Action to apply if the rule matches. Use 'block' to stop further processing or 'report' to simply log the match.
|
|
1837
|
+
*/
|
|
1838
|
+
state: 'block' | 'report';
|
|
1839
|
+
/**
|
|
1840
|
+
* JSON Logic condition that determines whether this rule matches.
|
|
1841
|
+
*/
|
|
1842
|
+
logic: {
|
|
1843
|
+
[key: string]: unknown;
|
|
1844
|
+
};
|
|
1845
|
+
};
|
|
1831
1846
|
|
|
1832
1847
|
/**
|
|
1833
1848
|
* Details about the evaluation of a single rule, including whether it matched, the action to take, the rule name, and optional debugging information.
|
|
@@ -1859,50 +1874,6 @@ export type AccessRuleResult = {
|
|
|
1859
1874
|
};
|
|
1860
1875
|
};
|
|
1861
1876
|
|
|
1862
|
-
/**
|
|
1863
|
-
* Defines an AI Guard recipe - a named configuration of detectors and redaction settings used to analyze and protect data flows in AI-powered applications.
|
|
1864
|
-
*
|
|
1865
|
-
* Recipes specify which detectors are active, how they behave, and may include reusable settings such as FPE tweaks.
|
|
1866
|
-
*
|
|
1867
|
-
* For details, see the [AI Guard Recipes](https://pangea.cloud/docs/ai-guard/recipes) documentation.
|
|
1868
|
-
*/
|
|
1869
|
-
export type RecipeConfig = {
|
|
1870
|
-
/**
|
|
1871
|
-
* Human-readable name of the recipe
|
|
1872
|
-
*/
|
|
1873
|
-
name: string;
|
|
1874
|
-
/**
|
|
1875
|
-
* Detailed description of the recipe's purpose or use case
|
|
1876
|
-
*/
|
|
1877
|
-
description: string;
|
|
1878
|
-
/**
|
|
1879
|
-
* Optional version identifier for the recipe. Can be used to track changes.
|
|
1880
|
-
*/
|
|
1881
|
-
version?: string;
|
|
1882
|
-
/**
|
|
1883
|
-
* Settings for [AI Guard Detectors](https://pangea.cloud/docs/ai-guard/recipes#detectors), including which detectors to enable and how they behave
|
|
1884
|
-
*/
|
|
1885
|
-
detectors?: DetectorSettings;
|
|
1886
|
-
/**
|
|
1887
|
-
* Configuration for access rules used in an AI Guard recipe.
|
|
1888
|
-
*/
|
|
1889
|
-
access_rules?: Array<AccessRuleSettings>;
|
|
1890
|
-
/**
|
|
1891
|
-
* Connector-level Redact configuration. These settings allow you to define reusable redaction parameters, such as FPE tweak value.
|
|
1892
|
-
*/
|
|
1893
|
-
connector_settings?: {
|
|
1894
|
-
/**
|
|
1895
|
-
* Settings for Redact integration at the recipe level
|
|
1896
|
-
*/
|
|
1897
|
-
redact?: {
|
|
1898
|
-
/**
|
|
1899
|
-
* ID of a Vault secret containing the tweak value used for Format-Preserving Encryption (FPE). Enables deterministic encryption, ensuring that identical inputs produce consistent encrypted outputs.
|
|
1900
|
-
*/
|
|
1901
|
-
fpe_tweak_vault_secret_id?: string;
|
|
1902
|
-
};
|
|
1903
|
-
};
|
|
1904
|
-
};
|
|
1905
|
-
|
|
1906
1877
|
/**
|
|
1907
1878
|
* 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.
|
|
1908
1879
|
*/
|
|
@@ -1948,6 +1919,50 @@ export type DetectorSettings = Array<{
|
|
|
1948
1919
|
};
|
|
1949
1920
|
}>;
|
|
1950
1921
|
|
|
1922
|
+
/**
|
|
1923
|
+
* Defines an AI Guard recipe - a named configuration of detectors and redaction settings used to analyze and protect data flows in AI-powered applications.
|
|
1924
|
+
*
|
|
1925
|
+
* Recipes specify which detectors are active, how they behave, and may include reusable settings such as FPE tweaks.
|
|
1926
|
+
*
|
|
1927
|
+
* For details, see the [AI Guard Recipes](https://pangea.cloud/docs/ai-guard/recipes) documentation.
|
|
1928
|
+
*/
|
|
1929
|
+
export type RecipeConfig = {
|
|
1930
|
+
/**
|
|
1931
|
+
* Human-readable name of the recipe
|
|
1932
|
+
*/
|
|
1933
|
+
name: string;
|
|
1934
|
+
/**
|
|
1935
|
+
* Detailed description of the recipe's purpose or use case
|
|
1936
|
+
*/
|
|
1937
|
+
description: string;
|
|
1938
|
+
/**
|
|
1939
|
+
* Optional version identifier for the recipe. Can be used to track changes.
|
|
1940
|
+
*/
|
|
1941
|
+
version?: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* Settings for [AI Guard Detectors](https://pangea.cloud/docs/ai-guard/recipes#detectors), including which detectors to enable and how they behave
|
|
1944
|
+
*/
|
|
1945
|
+
detectors?: DetectorSettings;
|
|
1946
|
+
/**
|
|
1947
|
+
* Configuration for access rules used in an AI Guard recipe.
|
|
1948
|
+
*/
|
|
1949
|
+
access_rules?: Array<AccessRuleSettings>;
|
|
1950
|
+
/**
|
|
1951
|
+
* Connector-level Redact configuration. These settings allow you to define reusable redaction parameters, such as FPE tweak value.
|
|
1952
|
+
*/
|
|
1953
|
+
connector_settings?: {
|
|
1954
|
+
/**
|
|
1955
|
+
* Settings for Redact integration at the recipe level
|
|
1956
|
+
*/
|
|
1957
|
+
redact?: {
|
|
1958
|
+
/**
|
|
1959
|
+
* ID of a Vault secret containing the tweak value used for Format-Preserving Encryption (FPE). Enables deterministic encryption, ensuring that identical inputs produce consistent encrypted outputs.
|
|
1960
|
+
*/
|
|
1961
|
+
fpe_tweak_vault_secret_id?: string;
|
|
1962
|
+
};
|
|
1963
|
+
};
|
|
1964
|
+
};
|
|
1965
|
+
|
|
1951
1966
|
export type RuleRedactionConfig = (
|
|
1952
1967
|
| {
|
|
1953
1968
|
redaction_type?: 'mask' | 'detect_only';
|
|
@@ -2035,66 +2050,6 @@ export type RuleRedactionConfig = (
|
|
|
2035
2050
|
| null;
|
|
2036
2051
|
};
|
|
2037
2052
|
|
|
2038
|
-
/**
|
|
2039
|
-
* 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.
|
|
2040
|
-
*/
|
|
2041
|
-
export type AccessRuleSettings = {
|
|
2042
|
-
/**
|
|
2043
|
-
* Unique identifier for this rule. Should be user-readable and consistent across recipe updates.
|
|
2044
|
-
*/
|
|
2045
|
-
rule_key: string;
|
|
2046
|
-
/**
|
|
2047
|
-
* Display label for the rule shown in user interfaces.
|
|
2048
|
-
*/
|
|
2049
|
-
name: string;
|
|
2050
|
-
/**
|
|
2051
|
-
* Action to apply if the rule matches. Use 'block' to stop further processing or 'report' to simply log the match.
|
|
2052
|
-
*/
|
|
2053
|
-
state: 'block' | 'report';
|
|
2054
|
-
/**
|
|
2055
|
-
* JSON Logic condition that determines whether this rule matches.
|
|
2056
|
-
*/
|
|
2057
|
-
logic: {
|
|
2058
|
-
[key: string]: unknown;
|
|
2059
|
-
};
|
|
2060
|
-
};
|
|
2061
|
-
|
|
2062
|
-
export type LanguageResult = {
|
|
2063
|
-
/**
|
|
2064
|
-
* The action taken by this Detector
|
|
2065
|
-
*/
|
|
2066
|
-
action?: string;
|
|
2067
|
-
language?: string;
|
|
2068
|
-
};
|
|
2069
|
-
|
|
2070
|
-
export type RedactEntityResult = {
|
|
2071
|
-
/**
|
|
2072
|
-
* Detected redaction rules.
|
|
2073
|
-
*/
|
|
2074
|
-
entities?: Array<{
|
|
2075
|
-
/**
|
|
2076
|
-
* The action taken on this Entity
|
|
2077
|
-
*/
|
|
2078
|
-
action: string;
|
|
2079
|
-
type: string;
|
|
2080
|
-
value: string;
|
|
2081
|
-
redacted: boolean;
|
|
2082
|
-
start_pos?: number;
|
|
2083
|
-
}>;
|
|
2084
|
-
};
|
|
2085
|
-
|
|
2086
|
-
export type MaliciousEntityAction = 'report' | 'defang' | 'disabled' | 'block';
|
|
2087
|
-
|
|
2088
|
-
export type PiiEntityAction =
|
|
2089
|
-
| 'disabled'
|
|
2090
|
-
| 'report'
|
|
2091
|
-
| 'block'
|
|
2092
|
-
| 'mask'
|
|
2093
|
-
| 'partial_masking'
|
|
2094
|
-
| 'replacement'
|
|
2095
|
-
| 'hash'
|
|
2096
|
-
| 'fpe';
|
|
2097
|
-
|
|
2098
2053
|
export type AidrPostV1GuardChatCompletionsData = {
|
|
2099
2054
|
body?: ChatCompletionsGuard;
|
|
2100
2055
|
path?: never;
|
|
@@ -2238,11 +2193,62 @@ export type AidrPostV1GuardChatCompletionsResponses = {
|
|
|
2238
2193
|
fpe_context?: string;
|
|
2239
2194
|
};
|
|
2240
2195
|
};
|
|
2196
|
+
/**
|
|
2197
|
+
* Asynchronous request in progress
|
|
2198
|
+
*/
|
|
2199
|
+
202: PangeaResponse & PangeaAcceptedResponse;
|
|
2241
2200
|
};
|
|
2242
2201
|
|
|
2243
2202
|
export type AidrPostV1GuardChatCompletionsResponse =
|
|
2244
2203
|
AidrPostV1GuardChatCompletionsResponses[keyof AidrPostV1GuardChatCompletionsResponses];
|
|
2245
2204
|
|
|
2205
|
+
export type AidrPostV1UnredactData = {
|
|
2206
|
+
body?: {
|
|
2207
|
+
/**
|
|
2208
|
+
* Data to unredact
|
|
2209
|
+
*/
|
|
2210
|
+
redacted_data: unknown;
|
|
2211
|
+
/**
|
|
2212
|
+
* FPE context used to decrypt and unredact data
|
|
2213
|
+
*/
|
|
2214
|
+
fpe_context: string;
|
|
2215
|
+
};
|
|
2216
|
+
path?: never;
|
|
2217
|
+
query?: never;
|
|
2218
|
+
url: '/v1/unredact';
|
|
2219
|
+
};
|
|
2220
|
+
|
|
2221
|
+
export type AidrPostV1UnredactErrors = {
|
|
2222
|
+
/**
|
|
2223
|
+
* Validation errors
|
|
2224
|
+
*/
|
|
2225
|
+
400: PangeaResponse & PangeaValidationErrors;
|
|
2226
|
+
};
|
|
2227
|
+
|
|
2228
|
+
export type AidrPostV1UnredactError =
|
|
2229
|
+
AidrPostV1UnredactErrors[keyof AidrPostV1UnredactErrors];
|
|
2230
|
+
|
|
2231
|
+
export type AidrPostV1UnredactResponses = {
|
|
2232
|
+
/**
|
|
2233
|
+
* The unredacted data
|
|
2234
|
+
*/
|
|
2235
|
+
200: PangeaResponse & {
|
|
2236
|
+
result?: {
|
|
2237
|
+
/**
|
|
2238
|
+
* The unredacted data
|
|
2239
|
+
*/
|
|
2240
|
+
data: unknown;
|
|
2241
|
+
};
|
|
2242
|
+
};
|
|
2243
|
+
/**
|
|
2244
|
+
* Asynchronous request in progress
|
|
2245
|
+
*/
|
|
2246
|
+
202: PangeaResponse & PangeaAcceptedResponse;
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
export type AidrPostV1UnredactResponse =
|
|
2250
|
+
AidrPostV1UnredactResponses[keyof AidrPostV1UnredactResponses];
|
|
2251
|
+
|
|
2246
2252
|
export type GetAsyncRequestData = {
|
|
2247
2253
|
body?: never;
|
|
2248
2254
|
path: {
|
|
@@ -2264,11 +2270,12 @@ export type GetAsyncRequestResponses = {
|
|
|
2264
2270
|
* Asynchronous request in progress
|
|
2265
2271
|
*/
|
|
2266
2272
|
202: PangeaResponse & {
|
|
2267
|
-
result
|
|
2273
|
+
result: {
|
|
2268
2274
|
ttl_mins?: number;
|
|
2269
2275
|
retry_counter?: number;
|
|
2270
2276
|
location?: string;
|
|
2271
2277
|
};
|
|
2278
|
+
status: 'Accepted';
|
|
2272
2279
|
};
|
|
2273
2280
|
};
|
|
2274
2281
|
|