@highflame/policy 2.2.23 → 2.2.25
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/_schemas/ai_gateway/context.json +144 -10
- package/_schemas/ai_gateway/templates/defaults/malicious_package.cedar +59 -0
- package/_schemas/ai_gateway/templates/templates.json +14 -0
- package/_schemas/guardrails/context.json +222 -86
- package/_schemas/overwatch/context.json +128 -33
- package/dist/ai_gateway-context.gen.d.ts +11 -1
- package/dist/ai_gateway-context.gen.js +20 -0
- package/dist/ai_gateway-defaults.gen.js +83 -0
- package/dist/ai_gateway-detectors.gen.js +24 -0
- package/dist/guardrails-context.gen.d.ts +5 -1
- package/dist/guardrails-context.gen.js +8 -0
- package/dist/guardrails-detectors.gen.js +5 -1
- package/dist/overwatch-context.gen.d.ts +11 -1
- package/dist/overwatch-context.gen.js +20 -0
- package/dist/overwatch-defaults.gen.d.ts +1 -1
- package/dist/overwatch-defaults.gen.js +93 -0
- package/dist/overwatch-detectors.gen.js +24 -0
- package/dist/service-schemas.gen.js +40 -2
- package/package.json +1 -1
|
@@ -353,7 +353,8 @@
|
|
|
353
353
|
"key": "rpm_remaining_pct",
|
|
354
354
|
"type": "number",
|
|
355
355
|
"required": false,
|
|
356
|
-
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
356
|
+
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
357
|
+
"range": "0-100"
|
|
357
358
|
},
|
|
358
359
|
{
|
|
359
360
|
"key": "rpm_exceeded",
|
|
@@ -365,13 +366,76 @@
|
|
|
365
366
|
"key": "tpm_remaining_pct",
|
|
366
367
|
"type": "number",
|
|
367
368
|
"required": false,
|
|
368
|
-
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
369
|
+
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
370
|
+
"range": "0-100"
|
|
369
371
|
},
|
|
370
372
|
{
|
|
371
373
|
"key": "tpm_exceeded",
|
|
372
374
|
"type": "boolean",
|
|
373
375
|
"required": false,
|
|
374
376
|
"description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"key": "package_install_detected",
|
|
380
|
+
"type": "boolean",
|
|
381
|
+
"required": false,
|
|
382
|
+
"description": "Whether the tool-call arguments contain a recognized package install command (pip, npm, cargo, go get, etc.)"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"key": "packages_checked",
|
|
386
|
+
"type": "number",
|
|
387
|
+
"required": false,
|
|
388
|
+
"description": "Number of unique packages checked against osv.dev for this tool call"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"key": "malicious_package_detected",
|
|
392
|
+
"type": "boolean",
|
|
393
|
+
"required": false,
|
|
394
|
+
"description": "Whether any referenced package has a known-malicious (MAL-) OSV advisory. Use to block supply-chain attacks at install time"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"key": "malicious_package_score",
|
|
398
|
+
"type": "number",
|
|
399
|
+
"required": false,
|
|
400
|
+
"description": "100 when a malicious package was detected, 0 otherwise",
|
|
401
|
+
"range": "0-100"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"key": "malicious_packages",
|
|
405
|
+
"type": "array",
|
|
406
|
+
"required": false,
|
|
407
|
+
"description": "Malicious packages as ecosystem/name[@version] strings (e.g. 'PyPI/evil-pkg@1.0.0')"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"key": "package_names",
|
|
411
|
+
"type": "array",
|
|
412
|
+
"required": false,
|
|
413
|
+
"description": "Names of all packages parsed from the install command (without ecosystem prefix). Available even when the osv.dev lookup fails."
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"key": "package_ecosystems",
|
|
417
|
+
"type": "array",
|
|
418
|
+
"required": false,
|
|
419
|
+
"description": "Unique package ecosystems seen in this tool call, e.g. ['PyPI', 'npm']. Useful for policies that restrict which ecosystems are permitted."
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"key": "package_advisory_count",
|
|
423
|
+
"type": "number",
|
|
424
|
+
"required": false,
|
|
425
|
+
"description": "Total non-malicious OSV advisories (GHSA- / CVE-) found across all checked packages. Excludes MAL- entries counted in malicious_package_detected."
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"key": "package_risk_score",
|
|
429
|
+
"type": "number",
|
|
430
|
+
"required": false,
|
|
431
|
+
"description": "Graduated supply-chain risk score (0-100). 100 when any malicious package is found; proportional to advisory count for advisory-only packages; 0 when all packages are clean.",
|
|
432
|
+
"range": "0-100"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"key": "package_check_status",
|
|
436
|
+
"type": "string",
|
|
437
|
+
"required": false,
|
|
438
|
+
"description": "Set to 'degraded' when the osv.dev lookup failed and packages could not be verified (fail-open). Combine with package_install_detected to fail closed."
|
|
375
439
|
}
|
|
376
440
|
]
|
|
377
441
|
},
|
|
@@ -599,7 +663,8 @@
|
|
|
599
663
|
"key": "rpm_remaining_pct",
|
|
600
664
|
"type": "number",
|
|
601
665
|
"required": false,
|
|
602
|
-
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
666
|
+
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
667
|
+
"range": "0-100"
|
|
603
668
|
},
|
|
604
669
|
{
|
|
605
670
|
"key": "rpm_exceeded",
|
|
@@ -611,13 +676,76 @@
|
|
|
611
676
|
"key": "tpm_remaining_pct",
|
|
612
677
|
"type": "number",
|
|
613
678
|
"required": false,
|
|
614
|
-
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
679
|
+
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
680
|
+
"range": "0-100"
|
|
615
681
|
},
|
|
616
682
|
{
|
|
617
683
|
"key": "tpm_exceeded",
|
|
618
684
|
"type": "boolean",
|
|
619
685
|
"required": false,
|
|
620
686
|
"description": "Whether the TPM limit has been exceeded. Use this to enforce token rate limits via Cedar policy"
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
"key": "package_install_detected",
|
|
690
|
+
"type": "boolean",
|
|
691
|
+
"required": false,
|
|
692
|
+
"description": "Whether the server-connect arguments contain a recognized package install command"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"key": "packages_checked",
|
|
696
|
+
"type": "number",
|
|
697
|
+
"required": false,
|
|
698
|
+
"description": "Number of unique packages checked against osv.dev for this connection event"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"key": "malicious_package_detected",
|
|
702
|
+
"type": "boolean",
|
|
703
|
+
"required": false,
|
|
704
|
+
"description": "Whether any referenced package has a known-malicious (MAL-) OSV advisory"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"key": "malicious_package_score",
|
|
708
|
+
"type": "number",
|
|
709
|
+
"required": false,
|
|
710
|
+
"description": "100 when a malicious package was detected, 0 otherwise",
|
|
711
|
+
"range": "0-100"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"key": "malicious_packages",
|
|
715
|
+
"type": "array",
|
|
716
|
+
"required": false,
|
|
717
|
+
"description": "Malicious packages as ecosystem/name[@version] strings"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"key": "package_names",
|
|
721
|
+
"type": "array",
|
|
722
|
+
"required": false,
|
|
723
|
+
"description": "Names of all packages parsed from install commands (without ecosystem prefix)"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"key": "package_ecosystems",
|
|
727
|
+
"type": "array",
|
|
728
|
+
"required": false,
|
|
729
|
+
"description": "Unique package ecosystems seen in this connection event"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"key": "package_advisory_count",
|
|
733
|
+
"type": "number",
|
|
734
|
+
"required": false,
|
|
735
|
+
"description": "Total non-malicious OSV advisories found across all checked packages"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"key": "package_risk_score",
|
|
739
|
+
"type": "number",
|
|
740
|
+
"required": false,
|
|
741
|
+
"description": "Graduated supply-chain risk score (0-100)",
|
|
742
|
+
"range": "0-100"
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"key": "package_check_status",
|
|
746
|
+
"type": "string",
|
|
747
|
+
"required": false,
|
|
748
|
+
"description": "Set to 'degraded' when the osv.dev lookup failed (fail-open)"
|
|
621
749
|
}
|
|
622
750
|
]
|
|
623
751
|
},
|
|
@@ -875,7 +1003,8 @@
|
|
|
875
1003
|
"key": "rpm_remaining_pct",
|
|
876
1004
|
"type": "number",
|
|
877
1005
|
"required": false,
|
|
878
|
-
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
1006
|
+
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
1007
|
+
"range": "0-100"
|
|
879
1008
|
},
|
|
880
1009
|
{
|
|
881
1010
|
"key": "rpm_exceeded",
|
|
@@ -887,7 +1016,8 @@
|
|
|
887
1016
|
"key": "tpm_remaining_pct",
|
|
888
1017
|
"type": "number",
|
|
889
1018
|
"required": false,
|
|
890
|
-
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
1019
|
+
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
1020
|
+
"range": "0-100"
|
|
891
1021
|
},
|
|
892
1022
|
{
|
|
893
1023
|
"key": "tpm_exceeded",
|
|
@@ -1079,7 +1209,8 @@
|
|
|
1079
1209
|
"key": "rpm_remaining_pct",
|
|
1080
1210
|
"type": "number",
|
|
1081
1211
|
"required": false,
|
|
1082
|
-
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
1212
|
+
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
1213
|
+
"range": "0-100"
|
|
1083
1214
|
},
|
|
1084
1215
|
{
|
|
1085
1216
|
"key": "rpm_exceeded",
|
|
@@ -1091,7 +1222,8 @@
|
|
|
1091
1222
|
"key": "tpm_remaining_pct",
|
|
1092
1223
|
"type": "number",
|
|
1093
1224
|
"required": false,
|
|
1094
|
-
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
1225
|
+
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
1226
|
+
"range": "0-100"
|
|
1095
1227
|
},
|
|
1096
1228
|
{
|
|
1097
1229
|
"key": "tpm_exceeded",
|
|
@@ -1283,7 +1415,8 @@
|
|
|
1283
1415
|
"key": "rpm_remaining_pct",
|
|
1284
1416
|
"type": "number",
|
|
1285
1417
|
"required": false,
|
|
1286
|
-
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
1418
|
+
"description": "Remaining RPM (requests per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
1419
|
+
"range": "0-100"
|
|
1287
1420
|
},
|
|
1288
1421
|
{
|
|
1289
1422
|
"key": "rpm_exceeded",
|
|
@@ -1295,7 +1428,8 @@
|
|
|
1295
1428
|
"key": "tpm_remaining_pct",
|
|
1296
1429
|
"type": "number",
|
|
1297
1430
|
"required": false,
|
|
1298
|
-
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)"
|
|
1431
|
+
"description": "Remaining TPM (tokens per minute) as percentage (0-100). Gateway-metered, Shield-decided (ADR 0014)",
|
|
1432
|
+
"range": "0-100"
|
|
1299
1433
|
},
|
|
1300
1434
|
{
|
|
1301
1435
|
"key": "tpm_exceeded",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Malicious Package (Default)
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Blocks tool calls that install or download packages flagged as malicious
|
|
5
|
+
// by the osv.dev database (OpenSSF MAL- advisories). The malicious_package
|
|
6
|
+
// detector (Shield, Tier Slow) parses package-manager invocations (pip, npm,
|
|
7
|
+
// yarn, pnpm, bun, uv, gem, cargo, go, composer) out of tool-call arguments
|
|
8
|
+
// and checks each referenced package against the OSV batch API.
|
|
9
|
+
//
|
|
10
|
+
// Context keys consumed:
|
|
11
|
+
// - malicious_package_detected: Bool
|
|
12
|
+
// - package_install_detected: Bool
|
|
13
|
+
// - package_check_status: String ("" | "degraded")
|
|
14
|
+
//
|
|
15
|
+
// Compliance:
|
|
16
|
+
// - OWASP LLM03 (Supply Chain), OWASP ASI02
|
|
17
|
+
//
|
|
18
|
+
// Category: agent-security
|
|
19
|
+
// Namespace: AIGateway
|
|
20
|
+
// =============================================================================
|
|
21
|
+
|
|
22
|
+
@id("agent-security.block-malicious-package")
|
|
23
|
+
@name("Block malicious package installs")
|
|
24
|
+
@description("Blocks call_tool when a referenced package carries a known-malicious osv.dev (MAL-) advisory.")
|
|
25
|
+
@severity("critical")
|
|
26
|
+
@tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:llm03,owasp:asi02")
|
|
27
|
+
@reject_message("Package install blocked: the requested package is flagged as malicious in the osv.dev database.")
|
|
28
|
+
forbid (
|
|
29
|
+
principal,
|
|
30
|
+
action == AIGateway::Action::"call_tool",
|
|
31
|
+
resource
|
|
32
|
+
)
|
|
33
|
+
when {
|
|
34
|
+
context has malicious_package_detected &&
|
|
35
|
+
context.malicious_package_detected == true
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Alternative (fail-closed): the detector fails OPEN by design — when the
|
|
39
|
+
// OSV lookup is unavailable, installs proceed with package_check_status set
|
|
40
|
+
// to "degraded". Uncomment to block package installs whenever they cannot be
|
|
41
|
+
// verified, trading install availability for supply-chain certainty.
|
|
42
|
+
//
|
|
43
|
+
// @id("agent-security.block-unverified-package")
|
|
44
|
+
// @name("Block unverified package installs")
|
|
45
|
+
// @description("Blocks call_tool package installs when the malicious-package lookup is degraded.")
|
|
46
|
+
// @severity("medium")
|
|
47
|
+
// @tags("category:agent-security,threat:supply-chain,detection:aggregate,surface:call-tool,owasp:llm03")
|
|
48
|
+
// @reject_message("Package install blocked: the package could not be verified against the malicious-package database.")
|
|
49
|
+
// forbid (
|
|
50
|
+
// principal,
|
|
51
|
+
// action == AIGateway::Action::"call_tool",
|
|
52
|
+
// resource
|
|
53
|
+
// )
|
|
54
|
+
// when {
|
|
55
|
+
// context has package_install_detected &&
|
|
56
|
+
// context.package_install_detected == true &&
|
|
57
|
+
// context has package_check_status &&
|
|
58
|
+
// context.package_check_status == "degraded"
|
|
59
|
+
// };
|
|
@@ -103,6 +103,20 @@
|
|
|
103
103
|
"owasp:asi04"
|
|
104
104
|
]
|
|
105
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"id": "agent-security.malicious-package",
|
|
108
|
+
"name": "Malicious Package",
|
|
109
|
+
"description": "Block package installs (pip, npm, yarn, pnpm, bun, uv, gem, cargo, go, composer) flagged as malicious.",
|
|
110
|
+
"category": "agent-security",
|
|
111
|
+
"file": "defaults/malicious_package.cedar",
|
|
112
|
+
"severity": "critical",
|
|
113
|
+
"tags": [
|
|
114
|
+
"category:agent-security",
|
|
115
|
+
"threat:supply-chain",
|
|
116
|
+
"owasp:llm03",
|
|
117
|
+
"owasp:asi02"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
106
120
|
{
|
|
107
121
|
"id": "tools.mcp-server-allowlist",
|
|
108
122
|
"name": "MCP Server Allowlist",
|