@highflame/policy 2.1.43 → 2.1.44
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/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/privilege-catalog.gen.d.ts +17 -0
- package/dist/privilege-catalog.gen.js +97 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +3 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './schema.gen.js';
|
|
|
5
5
|
export * from './decision-effects.gen.js';
|
|
6
6
|
export * from './aarm-annotations.gen.js';
|
|
7
7
|
export * from './aarm-annotation.js';
|
|
8
|
+
export * from './privilege-catalog.gen.js';
|
|
8
9
|
export * from './engine.js';
|
|
9
10
|
export * from './builder.js';
|
|
10
11
|
export * from './parser.js';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,9 @@ export * from './aarm-annotations.gen.js';
|
|
|
16
16
|
// AARM annotation parser/validator (typed parse + fail-closed validation,
|
|
17
17
|
// parity with Go's aarm_annotation.go).
|
|
18
18
|
export * from './aarm-annotation.js';
|
|
19
|
+
// Role -> capability privilege catalog (privilege_scope minted into
|
|
20
|
+
// the trusted-service JWT; checked by role-conditioned Cedar policies).
|
|
21
|
+
export * from './privilege-catalog.gen.js';
|
|
19
22
|
// Non-generated modules (require Node.js)
|
|
20
23
|
export * from './engine.js';
|
|
21
24
|
export * from './builder.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const PRIVILEGE_CATALOG_VERSION = "2026-06-08";
|
|
2
|
+
/** Every role in the catalog, in declaration order. */
|
|
3
|
+
export declare const PRIVILEGE_CATALOG_ROLES: readonly string[];
|
|
4
|
+
/** Every product the catalog applies to, in declaration order. */
|
|
5
|
+
export declare const PRIVILEGE_CATALOG_PRODUCTS: readonly string[];
|
|
6
|
+
/**
|
|
7
|
+
* Capabilities granted to `role` for `product`, as a fresh sorted
|
|
8
|
+
* `"<product>:<action>"[]`. Returns `[]` for an unknown role or product
|
|
9
|
+
* (least privilege). The returned array is a copy; callers may mutate it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function privilegeScopeForProduct(role: string, product: string): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Capabilities granted to `role` across every catalog product, as a fresh
|
|
14
|
+
* sorted+deduped `"<product>:<action>"[]`. Returns `[]` for an unknown
|
|
15
|
+
* role (least privilege). The returned array is a copy.
|
|
16
|
+
*/
|
|
17
|
+
export declare function privilegeScopeForRole(role: string): string[];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Code generated by highflame-policy-codegen. DO NOT EDIT.
|
|
2
|
+
// Source: schemas/privilege_catalog.json
|
|
3
|
+
//
|
|
4
|
+
// Role -> capability privilege catalog. Maps each RBAC role to the
|
|
5
|
+
// namespaced "<product>:<action>" capabilities it is provisioned to
|
|
6
|
+
// drive. privilege_scope is minted into the trusted-service JWT and
|
|
7
|
+
// checked by role-conditioned Cedar policies. Grants are validated
|
|
8
|
+
// against each product's Cedar action schema at codegen time.
|
|
9
|
+
// See adrs/0006-privilege-scope-catalog.md.
|
|
10
|
+
export const PRIVILEGE_CATALOG_VERSION = '2026-06-08';
|
|
11
|
+
/** Every role in the catalog, in declaration order. */
|
|
12
|
+
export const PRIVILEGE_CATALOG_ROLES = [
|
|
13
|
+
'auditor',
|
|
14
|
+
'viewer',
|
|
15
|
+
'support',
|
|
16
|
+
'member',
|
|
17
|
+
'admin',
|
|
18
|
+
'partner-admin',
|
|
19
|
+
'super-admin',
|
|
20
|
+
];
|
|
21
|
+
/** Every product the catalog applies to, in declaration order. */
|
|
22
|
+
export const PRIVILEGE_CATALOG_PRODUCTS = [
|
|
23
|
+
'guardrails',
|
|
24
|
+
'overwatch',
|
|
25
|
+
'ai_gateway',
|
|
26
|
+
];
|
|
27
|
+
// Role -> product -> sorted namespaced capabilities for that exact
|
|
28
|
+
// (role, product). Read via privilegeScopeForProduct.
|
|
29
|
+
const PRIVILEGE_SCOPE_BY_ROLE_PRODUCT = {
|
|
30
|
+
'auditor': {
|
|
31
|
+
'guardrails': ['guardrails:read_file'],
|
|
32
|
+
'overwatch': ['overwatch:read_file'],
|
|
33
|
+
'ai_gateway': ['ai_gateway:read_file'],
|
|
34
|
+
},
|
|
35
|
+
'viewer': {
|
|
36
|
+
'guardrails': ['guardrails:process_prompt', 'guardrails:read_file'],
|
|
37
|
+
'overwatch': ['overwatch:process_prompt', 'overwatch:read_file'],
|
|
38
|
+
'ai_gateway': ['ai_gateway:process_prompt', 'ai_gateway:read_file'],
|
|
39
|
+
},
|
|
40
|
+
'support': {
|
|
41
|
+
'guardrails': ['guardrails:process_prompt', 'guardrails:read_file'],
|
|
42
|
+
'overwatch': ['overwatch:process_prompt', 'overwatch:read_file'],
|
|
43
|
+
'ai_gateway': ['ai_gateway:process_prompt', 'ai_gateway:read_file'],
|
|
44
|
+
},
|
|
45
|
+
'member': {
|
|
46
|
+
'guardrails': ['guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file'],
|
|
47
|
+
'overwatch': ['overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file'],
|
|
48
|
+
'ai_gateway': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file'],
|
|
49
|
+
},
|
|
50
|
+
'admin': {
|
|
51
|
+
'guardrails': ['guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'guardrails:write_file'],
|
|
52
|
+
'overwatch': ['overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file', 'overwatch:write_file'],
|
|
53
|
+
'ai_gateway': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'ai_gateway:write_file'],
|
|
54
|
+
},
|
|
55
|
+
'partner-admin': {
|
|
56
|
+
'guardrails': ['guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'guardrails:write_file'],
|
|
57
|
+
'overwatch': ['overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file', 'overwatch:write_file'],
|
|
58
|
+
'ai_gateway': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'ai_gateway:write_file'],
|
|
59
|
+
},
|
|
60
|
+
'super-admin': {
|
|
61
|
+
'guardrails': ['guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'guardrails:write_file'],
|
|
62
|
+
'overwatch': ['overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file', 'overwatch:write_file'],
|
|
63
|
+
'ai_gateway': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'ai_gateway:write_file'],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
// Role -> sorted+deduped union of namespaced capabilities across every
|
|
67
|
+
// catalog product. Read via privilegeScopeForRole.
|
|
68
|
+
const PRIVILEGE_SCOPE_BY_ROLE = {
|
|
69
|
+
'auditor': ['ai_gateway:read_file', 'guardrails:read_file', 'overwatch:read_file'],
|
|
70
|
+
'viewer': ['ai_gateway:process_prompt', 'ai_gateway:read_file', 'guardrails:process_prompt', 'guardrails:read_file', 'overwatch:process_prompt', 'overwatch:read_file'],
|
|
71
|
+
'support': ['ai_gateway:process_prompt', 'ai_gateway:read_file', 'guardrails:process_prompt', 'guardrails:read_file', 'overwatch:process_prompt', 'overwatch:read_file'],
|
|
72
|
+
'member': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file'],
|
|
73
|
+
'admin': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'ai_gateway:write_file', 'guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'guardrails:write_file', 'overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file', 'overwatch:write_file'],
|
|
74
|
+
'partner-admin': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'ai_gateway:write_file', 'guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'guardrails:write_file', 'overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file', 'overwatch:write_file'],
|
|
75
|
+
'super-admin': ['ai_gateway:call_tool', 'ai_gateway:connect_server', 'ai_gateway:process_prompt', 'ai_gateway:read_file', 'ai_gateway:write_file', 'guardrails:call_tool', 'guardrails:connect_server', 'guardrails:process_prompt', 'guardrails:read_file', 'guardrails:write_file', 'overwatch:call_tool', 'overwatch:connect_server', 'overwatch:process_prompt', 'overwatch:read_file', 'overwatch:write_file'],
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Capabilities granted to `role` for `product`, as a fresh sorted
|
|
79
|
+
* `"<product>:<action>"[]`. Returns `[]` for an unknown role or product
|
|
80
|
+
* (least privilege). The returned array is a copy; callers may mutate it.
|
|
81
|
+
*/
|
|
82
|
+
export function privilegeScopeForProduct(role, product) {
|
|
83
|
+
const byProduct = PRIVILEGE_SCOPE_BY_ROLE_PRODUCT[role];
|
|
84
|
+
if (!byProduct)
|
|
85
|
+
return [];
|
|
86
|
+
const caps = byProduct[product];
|
|
87
|
+
return caps ? [...caps] : [];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Capabilities granted to `role` across every catalog product, as a fresh
|
|
91
|
+
* sorted+deduped `"<product>:<action>"[]`. Returns `[]` for an unknown
|
|
92
|
+
* role (least privilege). The returned array is a copy.
|
|
93
|
+
*/
|
|
94
|
+
export function privilegeScopeForRole(role) {
|
|
95
|
+
const caps = PRIVILEGE_SCOPE_BY_ROLE[role];
|
|
96
|
+
return caps ? [...caps] : [];
|
|
97
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './schema.gen.js';
|
|
|
5
5
|
export * from './decision-effects.gen.js';
|
|
6
6
|
export * from './aarm-annotations.gen.js';
|
|
7
7
|
export * from './aarm-annotation.js';
|
|
8
|
+
export * from './privilege-catalog.gen.js';
|
|
8
9
|
export * from './builder.js';
|
|
9
10
|
export * from './errors.js';
|
|
10
11
|
export * from './annotations.js';
|
package/dist/types.js
CHANGED
|
@@ -18,6 +18,9 @@ export * from './aarm-annotations.gen.js';
|
|
|
18
18
|
// AARM annotation parser/validator (browser-safe — typed parse + fail-closed
|
|
19
19
|
// validation; Studio lints with the exact rules Shield runs at sync time).
|
|
20
20
|
export * from './aarm-annotation.js';
|
|
21
|
+
// Role -> capability privilege catalog (browser-safe — Studio surfaces
|
|
22
|
+
// the default scope per role; checked by role-conditioned Cedar policies).
|
|
23
|
+
export * from './privilege-catalog.gen.js';
|
|
21
24
|
// PolicyBuilder - works in browser (no WASM dependency)
|
|
22
25
|
export * from './builder.js';
|
|
23
26
|
// Error types - works in browser (no WASM dependency)
|