@peac/policy-kit 0.10.8 → 0.10.10
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/LICENSE +1 -1
- package/dist/index.cjs +1356 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +1270 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +19 -6
- package/dist/compiler.js +0 -304
- package/dist/compiler.js.map +0 -1
- package/dist/enforce.js +0 -309
- package/dist/enforce.js.map +0 -1
- package/dist/enforcement-profiles.js +0 -293
- package/dist/enforcement-profiles.js.map +0 -1
- package/dist/evaluate.js +0 -258
- package/dist/evaluate.js.map +0 -1
- package/dist/generated/profiles.js +0 -212
- package/dist/generated/profiles.js.map +0 -1
- package/dist/index.js +0 -120
- package/dist/index.js.map +0 -1
- package/dist/loader.js +0 -245
- package/dist/loader.js.map +0 -1
- package/dist/profiles.js +0 -368
- package/dist/profiles.js.map +0 -1
- package/dist/types.js +0 -348
- package/dist/types.js.map +0 -1
package/dist/evaluate.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* PEAC Policy Kit Evaluation
|
|
4
|
-
*
|
|
5
|
-
* Deterministic policy evaluation for CAL semantics.
|
|
6
|
-
* First-match-wins rule semantics.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.evaluate = evaluate;
|
|
12
|
-
exports.explainMatches = explainMatches;
|
|
13
|
-
exports.findEffectiveRule = findEffectiveRule;
|
|
14
|
-
exports.isAllowed = isAllowed;
|
|
15
|
-
exports.isDenied = isDenied;
|
|
16
|
-
exports.requiresReview = requiresReview;
|
|
17
|
-
exports.evaluateBatch = evaluateBatch;
|
|
18
|
-
/**
|
|
19
|
-
* Check if a value matches a single-or-array pattern
|
|
20
|
-
*
|
|
21
|
-
* @param value - Value to check
|
|
22
|
-
* @param pattern - Single value or array of values
|
|
23
|
-
* @returns true if value matches pattern
|
|
24
|
-
*/
|
|
25
|
-
function matchesSingleOrArray(value, pattern) {
|
|
26
|
-
// If no pattern specified, match anything
|
|
27
|
-
if (pattern === undefined) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
// If no value and pattern exists, no match
|
|
31
|
-
if (value === undefined) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
// Check against array or single value
|
|
35
|
-
if (Array.isArray(pattern)) {
|
|
36
|
-
return pattern.includes(value);
|
|
37
|
-
}
|
|
38
|
-
return value === pattern;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if a subject ID matches a pattern
|
|
42
|
-
*
|
|
43
|
-
* Supports:
|
|
44
|
-
* - Exact match: "user:abc123"
|
|
45
|
-
* - Prefix match with wildcard: "user:*" matches "user:abc123"
|
|
46
|
-
*
|
|
47
|
-
* @param id - Subject ID to check
|
|
48
|
-
* @param pattern - Pattern to match against
|
|
49
|
-
* @returns true if ID matches pattern
|
|
50
|
-
*/
|
|
51
|
-
function matchesIdPattern(id, pattern) {
|
|
52
|
-
// No pattern = match anything
|
|
53
|
-
if (pattern === undefined) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
// No ID but pattern exists = no match
|
|
57
|
-
if (id === undefined) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
// Wildcard prefix match
|
|
61
|
-
if (pattern.endsWith('*')) {
|
|
62
|
-
const prefix = pattern.slice(0, -1);
|
|
63
|
-
return id.startsWith(prefix);
|
|
64
|
-
}
|
|
65
|
-
// Exact match
|
|
66
|
-
return id === pattern;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if subject labels contain all required labels
|
|
70
|
-
*
|
|
71
|
-
* @param subjectLabels - Labels on the subject
|
|
72
|
-
* @param requiredLabels - Labels required by the rule
|
|
73
|
-
* @returns true if subject has all required labels
|
|
74
|
-
*/
|
|
75
|
-
function hasAllLabels(subjectLabels, requiredLabels) {
|
|
76
|
-
// No required labels = match
|
|
77
|
-
if (requiredLabels === undefined || requiredLabels.length === 0) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
// Required labels but no subject labels = no match
|
|
81
|
-
if (subjectLabels === undefined || subjectLabels.length === 0) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
// Check all required labels are present
|
|
85
|
-
return requiredLabels.every((label) => subjectLabels.includes(label));
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Check if a subject matches a subject matcher
|
|
89
|
-
*
|
|
90
|
-
* @param subject - Subject from evaluation context
|
|
91
|
-
* @param matcher - Subject matcher from rule
|
|
92
|
-
* @returns true if subject matches all criteria
|
|
93
|
-
*/
|
|
94
|
-
function matchesSubject(subject, matcher) {
|
|
95
|
-
// No matcher = match any subject
|
|
96
|
-
if (matcher === undefined) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
// Check type
|
|
100
|
-
if (!matchesSingleOrArray(subject?.type, matcher.type)) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
// Check labels (must have ALL required labels)
|
|
104
|
-
if (!hasAllLabels(subject?.labels, matcher.labels)) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
// Check ID pattern
|
|
108
|
-
if (!matchesIdPattern(subject?.id, matcher.id)) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Check if a rule matches the evaluation context
|
|
115
|
-
*
|
|
116
|
-
* All criteria must match (AND logic).
|
|
117
|
-
*
|
|
118
|
-
* @param rule - Policy rule to check
|
|
119
|
-
* @param context - Evaluation context
|
|
120
|
-
* @returns true if rule matches context
|
|
121
|
-
*/
|
|
122
|
-
function ruleMatches(rule, context) {
|
|
123
|
-
// Check subject
|
|
124
|
-
if (!matchesSubject(context.subject, rule.subject)) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
// Check purpose
|
|
128
|
-
if (!matchesSingleOrArray(context.purpose, rule.purpose)) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
// Check licensing mode
|
|
132
|
-
if (!matchesSingleOrArray(context.licensing_mode, rule.licensing_mode)) {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Evaluate a policy against a context
|
|
139
|
-
*
|
|
140
|
-
* Uses first-match-wins semantics:
|
|
141
|
-
* - Rules are evaluated in order
|
|
142
|
-
* - First matching rule determines the decision
|
|
143
|
-
* - If no rule matches, defaults are applied
|
|
144
|
-
*
|
|
145
|
-
* @param policy - Policy document
|
|
146
|
-
* @param context - Evaluation context
|
|
147
|
-
* @returns Evaluation result
|
|
148
|
-
*/
|
|
149
|
-
function evaluate(policy, context) {
|
|
150
|
-
// Find first matching rule
|
|
151
|
-
for (const rule of policy.rules) {
|
|
152
|
-
if (ruleMatches(rule, context)) {
|
|
153
|
-
return {
|
|
154
|
-
decision: rule.decision,
|
|
155
|
-
matched_rule: rule.name,
|
|
156
|
-
reason: rule.reason,
|
|
157
|
-
is_default: false,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
// No rule matched, apply defaults
|
|
162
|
-
return {
|
|
163
|
-
decision: policy.defaults.decision,
|
|
164
|
-
reason: policy.defaults.reason,
|
|
165
|
-
is_default: true,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Explain which rules could potentially match a context
|
|
170
|
-
*
|
|
171
|
-
* Useful for debugging and policy analysis.
|
|
172
|
-
* Returns all rules that would match if evaluated, in order.
|
|
173
|
-
*
|
|
174
|
-
* @param policy - Policy document
|
|
175
|
-
* @param context - Evaluation context
|
|
176
|
-
* @returns Array of rule names that match, or 'default' if none
|
|
177
|
-
*/
|
|
178
|
-
function explainMatches(policy, context) {
|
|
179
|
-
const matches = [];
|
|
180
|
-
for (const rule of policy.rules) {
|
|
181
|
-
if (ruleMatches(rule, context)) {
|
|
182
|
-
matches.push(rule.name);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (matches.length === 0) {
|
|
186
|
-
matches.push('[default]');
|
|
187
|
-
}
|
|
188
|
-
return matches;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Find the effective rule for a context
|
|
192
|
-
*
|
|
193
|
-
* Same as evaluate() but returns the full rule object.
|
|
194
|
-
*
|
|
195
|
-
* @param policy - Policy document
|
|
196
|
-
* @param context - Evaluation context
|
|
197
|
-
* @returns Matched rule or undefined if default applies
|
|
198
|
-
*/
|
|
199
|
-
function findEffectiveRule(policy, context) {
|
|
200
|
-
for (const rule of policy.rules) {
|
|
201
|
-
if (ruleMatches(rule, context)) {
|
|
202
|
-
return rule;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return undefined;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Check if a policy would allow a given context
|
|
209
|
-
*
|
|
210
|
-
* Convenience helper for common allow/deny checks.
|
|
211
|
-
*
|
|
212
|
-
* @param policy - Policy document
|
|
213
|
-
* @param context - Evaluation context
|
|
214
|
-
* @returns true if decision is 'allow'
|
|
215
|
-
*/
|
|
216
|
-
function isAllowed(policy, context) {
|
|
217
|
-
const result = evaluate(policy, context);
|
|
218
|
-
return result.decision === 'allow';
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Check if a policy would deny a given context
|
|
222
|
-
*
|
|
223
|
-
* Convenience helper for common allow/deny checks.
|
|
224
|
-
*
|
|
225
|
-
* @param policy - Policy document
|
|
226
|
-
* @param context - Evaluation context
|
|
227
|
-
* @returns true if decision is 'deny'
|
|
228
|
-
*/
|
|
229
|
-
function isDenied(policy, context) {
|
|
230
|
-
const result = evaluate(policy, context);
|
|
231
|
-
return result.decision === 'deny';
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Check if a policy requires review for a given context
|
|
235
|
-
*
|
|
236
|
-
* Convenience helper for review checks.
|
|
237
|
-
*
|
|
238
|
-
* @param policy - Policy document
|
|
239
|
-
* @param context - Evaluation context
|
|
240
|
-
* @returns true if decision is 'review'
|
|
241
|
-
*/
|
|
242
|
-
function requiresReview(policy, context) {
|
|
243
|
-
const result = evaluate(policy, context);
|
|
244
|
-
return result.decision === 'review';
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Batch evaluate multiple contexts against a policy
|
|
248
|
-
*
|
|
249
|
-
* Useful for testing or bulk authorization checks.
|
|
250
|
-
*
|
|
251
|
-
* @param policy - Policy document
|
|
252
|
-
* @param contexts - Array of evaluation contexts
|
|
253
|
-
* @returns Array of evaluation results (same order as contexts)
|
|
254
|
-
*/
|
|
255
|
-
function evaluateBatch(policy, contexts) {
|
|
256
|
-
return contexts.map((context) => evaluate(policy, context));
|
|
257
|
-
}
|
|
258
|
-
//# sourceMappingURL=evaluate.js.map
|
package/dist/evaluate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AA0KH,4BAmBC;AAYD,wCAcC;AAWD,8CAUC;AAWD,8BAGC;AAWD,4BAGC;AAWD,wCAGC;AAWD,sCAKC;AAzRD;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAI,KAAoB,EAAE,OAA4B;IACjF,0CAA0C;IAC1C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2CAA2C;IAC3C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,sCAAsC;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B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AAO,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,QAAQ,CAAC,MAAsB,EAAE,OAA0B;IACzE,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,MAAsB,EAAE,OAA0B;IAC/E,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACtC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAC3B,MAAsB,EACtB,QAA6B;IAE7B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Generated Profile Definitions
|
|
4
|
-
*
|
|
5
|
-
* DO NOT EDIT MANUALLY - Generated by scripts/generate-profiles.ts
|
|
6
|
-
* Source: profiles/*.yaml
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.PROFILES = exports.PROFILE_IDS = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Available profile IDs
|
|
12
|
-
*/
|
|
13
|
-
exports.PROFILE_IDS = ['api-provider', 'news-media', 'open-source', 'saas-docs'];
|
|
14
|
-
/**
|
|
15
|
-
* All profiles indexed by ID
|
|
16
|
-
*/
|
|
17
|
-
exports.PROFILES = {
|
|
18
|
-
'api-provider': {
|
|
19
|
-
defaults: {
|
|
20
|
-
rate_limit: {
|
|
21
|
-
limit: 200,
|
|
22
|
-
window_seconds: 3600,
|
|
23
|
-
},
|
|
24
|
-
requirements: {
|
|
25
|
-
receipt: true,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
description: 'Policy profile for API providers and developer platforms.\nAllows search indexing for API discoverability.\nBlocks training to protect API design and documentation IP.\nRequires receipts for inference to enable usage tracking.\n',
|
|
29
|
-
id: 'api-provider',
|
|
30
|
-
name: 'API Provider',
|
|
31
|
-
parameters: {
|
|
32
|
-
contact: {
|
|
33
|
-
description: 'Developer relations or API support email',
|
|
34
|
-
example: 'api-support@example.com',
|
|
35
|
-
required: true,
|
|
36
|
-
validate: 'email',
|
|
37
|
-
},
|
|
38
|
-
negotiate_url: {
|
|
39
|
-
description: 'URL for API access negotiation',
|
|
40
|
-
required: false,
|
|
41
|
-
validate: 'url',
|
|
42
|
-
},
|
|
43
|
-
rate_limit: {
|
|
44
|
-
default: '200/hour',
|
|
45
|
-
description: 'Rate limit for API documentation access',
|
|
46
|
-
validate: 'rate_limit',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
policy: {
|
|
50
|
-
defaults: {
|
|
51
|
-
decision: 'deny',
|
|
52
|
-
reason: 'Default deny - explicit permission required',
|
|
53
|
-
},
|
|
54
|
-
name: 'API Provider Policy',
|
|
55
|
-
rules: [
|
|
56
|
-
{
|
|
57
|
-
decision: 'allow',
|
|
58
|
-
name: 'allow-discovery',
|
|
59
|
-
purpose: ['crawl', 'index', 'search', 'ai_index'],
|
|
60
|
-
reason: 'Allow API discovery and search indexing',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
decision: 'deny',
|
|
64
|
-
name: 'block-training',
|
|
65
|
-
purpose: 'train',
|
|
66
|
-
reason: 'API documentation training requires license',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
decision: 'review',
|
|
70
|
-
name: 'inference-with-receipt',
|
|
71
|
-
purpose: ['inference', 'ai_input'],
|
|
72
|
-
reason: 'Inference requires valid PEAC receipt for tracking',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
version: 'peac-policy/0.1',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
'news-media': {
|
|
79
|
-
defaults: {
|
|
80
|
-
rate_limit: {
|
|
81
|
-
limit: 100,
|
|
82
|
-
window_seconds: 3600,
|
|
83
|
-
},
|
|
84
|
-
requirements: {
|
|
85
|
-
receipt: true,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
description: 'Policy profile for news and media publishers.\nAllows search engine indexing while blocking unauthorized AI training.\nInference access requires a valid PEAC receipt.\n',
|
|
89
|
-
id: 'news-media',
|
|
90
|
-
name: 'News Media Publisher',
|
|
91
|
-
parameters: {
|
|
92
|
-
contact: {
|
|
93
|
-
description: 'Contact email for licensing inquiries',
|
|
94
|
-
example: 'licensing@example.com',
|
|
95
|
-
required: true,
|
|
96
|
-
validate: 'email',
|
|
97
|
-
},
|
|
98
|
-
negotiate_url: {
|
|
99
|
-
description: 'URL for license negotiation',
|
|
100
|
-
required: false,
|
|
101
|
-
validate: 'url',
|
|
102
|
-
},
|
|
103
|
-
rate_limit: {
|
|
104
|
-
default: '100/hour',
|
|
105
|
-
description: 'Rate limit for allowed purposes',
|
|
106
|
-
validate: 'rate_limit',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
policy: {
|
|
110
|
-
defaults: {
|
|
111
|
-
decision: 'deny',
|
|
112
|
-
reason: 'Default deny - explicit permission required',
|
|
113
|
-
},
|
|
114
|
-
name: 'News Media Policy',
|
|
115
|
-
rules: [
|
|
116
|
-
{
|
|
117
|
-
decision: 'allow',
|
|
118
|
-
name: 'allow-search-indexing',
|
|
119
|
-
purpose: ['crawl', 'index', 'search', 'ai_index'],
|
|
120
|
-
reason: 'Allow discovery and search engine indexing',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
decision: 'deny',
|
|
124
|
-
name: 'block-training',
|
|
125
|
-
purpose: 'train',
|
|
126
|
-
reason: 'Training requires explicit licensing agreement',
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
decision: 'review',
|
|
130
|
-
name: 'inference-needs-receipt',
|
|
131
|
-
purpose: ['inference', 'ai_input'],
|
|
132
|
-
reason: 'Inference access requires valid PEAC receipt',
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
version: 'peac-policy/0.1',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
'open-source': {
|
|
139
|
-
defaults: {
|
|
140
|
-
rate_limit: {
|
|
141
|
-
limit: 1000,
|
|
142
|
-
window_seconds: 3600,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
description: 'Policy profile for open source projects.\nFully open access including AI training.\nEncourages broad AI ecosystem adoption.\nReceipts are optional for attribution tracking.\n',
|
|
146
|
-
id: 'open-source',
|
|
147
|
-
name: 'Open Source Project',
|
|
148
|
-
parameters: {
|
|
149
|
-
attribution: {
|
|
150
|
-
default: 'optional',
|
|
151
|
-
description: 'Attribution requirement',
|
|
152
|
-
example: 'required',
|
|
153
|
-
},
|
|
154
|
-
contact: {
|
|
155
|
-
description: 'Project contact or maintainer email',
|
|
156
|
-
example: 'maintainer@example.com',
|
|
157
|
-
required: false,
|
|
158
|
-
validate: 'email',
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
policy: {
|
|
162
|
-
defaults: {
|
|
163
|
-
decision: 'allow',
|
|
164
|
-
reason: 'Open source - all access permitted',
|
|
165
|
-
},
|
|
166
|
-
name: 'Open Source Policy',
|
|
167
|
-
rules: [],
|
|
168
|
-
version: 'peac-policy/0.1',
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
'saas-docs': {
|
|
172
|
-
defaults: {
|
|
173
|
-
rate_limit: {
|
|
174
|
-
limit: 500,
|
|
175
|
-
window_seconds: 3600,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
description: 'Policy profile for SaaS documentation sites.\nOpen access for search and inference to improve discoverability.\nTraining blocked to protect proprietary documentation.\nReceipts are optional to encourage AI agent adoption.\n',
|
|
179
|
-
id: 'saas-docs',
|
|
180
|
-
name: 'SaaS Documentation',
|
|
181
|
-
parameters: {
|
|
182
|
-
contact: {
|
|
183
|
-
description: 'Contact email for questions',
|
|
184
|
-
example: 'docs@example.com',
|
|
185
|
-
required: false,
|
|
186
|
-
validate: 'email',
|
|
187
|
-
},
|
|
188
|
-
rate_limit: {
|
|
189
|
-
default: '500/hour',
|
|
190
|
-
description: 'Rate limit for access',
|
|
191
|
-
validate: 'rate_limit',
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
policy: {
|
|
195
|
-
defaults: {
|
|
196
|
-
decision: 'allow',
|
|
197
|
-
reason: 'Open by default for documentation',
|
|
198
|
-
},
|
|
199
|
-
name: 'SaaS Documentation Policy',
|
|
200
|
-
rules: [
|
|
201
|
-
{
|
|
202
|
-
decision: 'deny',
|
|
203
|
-
name: 'block-training',
|
|
204
|
-
purpose: 'train',
|
|
205
|
-
reason: 'Proprietary documentation - training requires license',
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
version: 'peac-policy/0.1',
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
//# sourceMappingURL=profiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/generated/profiles.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH;;GAEG;AACU,QAAA,WAAW,GAAG,CAAC,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,CAAU,CAAC;AAI/F;;GAEG;AACU,QAAA,QAAQ,GAAyC;IAC5D,cAAc,EAAE;QACd,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,KAAK,EAAE,GAAG;gBACV,cAAc,EAAE,IAAI;aACrB;YACD,YAAY,EAAE;gBACZ,OAAO,EAAE,IAAI;aACd;SACF;QACD,WAAW,EACT,sOAAsO;QACxO,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE;YACV,OAAO,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AE;gBACP,WAAW,EAAE,qCAAqC;gBAClD,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,OAAO;aAClB;SACF;QACD,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,QAAQ,EAAE,OAAO;gBACjB,MAAM,EAAE,oCAAoC;aAC7C;YACD,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,iBAAiB;SAC3B;KACF;IACD,WAAW,EAAE;QACX,QAAQ,EAAE;YACR,UAAU,EAAE;gBACV,KAAK,EAAE,GAAG;gBACV,cAAc,EAAE,IAAI;aACrB;SACF;QACD,WAAW,EACT,iOAAiO;QACnO,EAAE,EAAE,WAAW;QACf,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,WAAW,EAAE,6BAA6B;gBAC1C,OAAO,EAAE,kBAAkB;gBAC3B,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,OAAO;aAClB;YACD,UAAU,EAAE;gBACV,OAAO,EAAE,UAAU;gBACnB,WAAW,EAAE,uBAAuB;gBACpC,QAAQ,EAAE,YAAY;aACvB;SACF;QACD,MAAM,EAAE;YACN,QAAQ,EAAE;gBACR,QAAQ,EAAE,OAAO;gBACjB,MAAM,EAAE,mCAAmC;aAC5C;YACD,IAAI,EAAE,2BAA2B;YACjC,KAAK,EAAE;gBACL;oBACE,QAAQ,EAAE,MAAM;oBAChB,IAAI,EAAE,gBAAgB;oBACtB,OAAO,EAAE,OAAO;oBAChB,MAAM,EAAE,uDAAuD;iBAChE;aACF;YACD,OAAO,EAAE,iBAAiB;SAC3B;KACF;CACF,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* PEAC Policy Kit
|
|
4
|
-
*
|
|
5
|
-
* Deterministic policy evaluation for Control Abstraction Layer (CAL) semantics.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - File-based policy format (YAML or JSON)
|
|
9
|
-
* - First-match-wins rule semantics
|
|
10
|
-
* - Subject matching by type, labels, and ID patterns
|
|
11
|
-
* - Purpose and licensing mode matching
|
|
12
|
-
* - No scripting, no dynamic code
|
|
13
|
-
* - Deterministic, auditable, side-effect free
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { loadPolicy, evaluate } from '@peac/policy-kit';
|
|
18
|
-
*
|
|
19
|
-
* const policy = loadPolicy('peac-policy.yaml');
|
|
20
|
-
*
|
|
21
|
-
* const result = evaluate(policy, {
|
|
22
|
-
* subject: { type: 'human', labels: ['subscribed'] },
|
|
23
|
-
* purpose: 'crawl',
|
|
24
|
-
* licensing_mode: 'subscription',
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* console.log(result.decision); // 'allow' | 'deny' | 'review'
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @packageDocumentation
|
|
31
|
-
*/
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.enforcePurposeDecision = exports.enforceForHttp = exports.getChallengeHeader = exports.requiresChallenge = exports.enforceDecision = exports.ProfileError = exports.getProfileSummary = exports.getAllProfiles = exports.customizeProfile = exports.validateProfileParams = exports.getProfile = exports.loadProfile = exports.hasProfile = exports.listProfiles = exports.PROFILE_IDS = exports.PROFILES = exports.renderPolicyMarkdown = exports.compileAiprefTemplates = exports.compileRobotsSnippet = exports.compilePeacTxt = exports.PEAC_PROTOCOL_VERSION = exports.evaluateBatch = exports.requiresReview = exports.isDenied = exports.isAllowed = exports.findEffectiveRule = exports.explainMatches = exports.evaluate = exports.PolicyValidationError = exports.PolicyLoadError = exports.serializePolicyJson = exports.serializePolicyYaml = exports.createExamplePolicy = exports.policyFileExists = exports.validatePolicy = exports.parsePolicy = exports.loadPolicy = exports.EnforcementProfileSchema = exports.PolicyConstraintsSchema = exports.ProfileDefinitionSchema = exports.ProfileParameterSchema = exports.DecisionRequirementsSchema = exports.RateLimitConfigSchema = exports.PolicyDocumentSchema = exports.PolicyDefaultsSchema = exports.PolicyRuleSchema = exports.SubjectMatcherSchema = exports.formatRateLimit = exports.parseRateLimit = exports.POLICY_VERSION = void 0;
|
|
34
|
-
exports.getRetryAfter = exports.getPurposeStatusCode = exports.evaluatePurpose = exports.getDefaultEnforcementProfile = exports.isEnforcementProfileId = exports.getEnforcementProfile = exports.DEFAULT_ENFORCEMENT_PROFILE = exports.ENFORCEMENT_PROFILE_IDS = exports.ENFORCEMENT_PROFILES = exports.OPEN_PROFILE = exports.BALANCED_PROFILE = exports.STRICT_PROFILE = exports.getPurposeDecisionStatusCode = void 0;
|
|
35
|
-
// Types
|
|
36
|
-
var types_1 = require("./types");
|
|
37
|
-
Object.defineProperty(exports, "POLICY_VERSION", { enumerable: true, get: function () { return types_1.POLICY_VERSION; } });
|
|
38
|
-
Object.defineProperty(exports, "parseRateLimit", { enumerable: true, get: function () { return types_1.parseRateLimit; } });
|
|
39
|
-
Object.defineProperty(exports, "formatRateLimit", { enumerable: true, get: function () { return types_1.formatRateLimit; } });
|
|
40
|
-
// Schemas for advanced validation
|
|
41
|
-
Object.defineProperty(exports, "SubjectMatcherSchema", { enumerable: true, get: function () { return types_1.SubjectMatcherSchema; } });
|
|
42
|
-
Object.defineProperty(exports, "PolicyRuleSchema", { enumerable: true, get: function () { return types_1.PolicyRuleSchema; } });
|
|
43
|
-
Object.defineProperty(exports, "PolicyDefaultsSchema", { enumerable: true, get: function () { return types_1.PolicyDefaultsSchema; } });
|
|
44
|
-
Object.defineProperty(exports, "PolicyDocumentSchema", { enumerable: true, get: function () { return types_1.PolicyDocumentSchema; } });
|
|
45
|
-
Object.defineProperty(exports, "RateLimitConfigSchema", { enumerable: true, get: function () { return types_1.RateLimitConfigSchema; } });
|
|
46
|
-
Object.defineProperty(exports, "DecisionRequirementsSchema", { enumerable: true, get: function () { return types_1.DecisionRequirementsSchema; } });
|
|
47
|
-
Object.defineProperty(exports, "ProfileParameterSchema", { enumerable: true, get: function () { return types_1.ProfileParameterSchema; } });
|
|
48
|
-
Object.defineProperty(exports, "ProfileDefinitionSchema", { enumerable: true, get: function () { return types_1.ProfileDefinitionSchema; } });
|
|
49
|
-
Object.defineProperty(exports, "PolicyConstraintsSchema", { enumerable: true, get: function () { return types_1.PolicyConstraintsSchema; } });
|
|
50
|
-
Object.defineProperty(exports, "EnforcementProfileSchema", { enumerable: true, get: function () { return types_1.EnforcementProfileSchema; } });
|
|
51
|
-
// Loader
|
|
52
|
-
var loader_1 = require("./loader");
|
|
53
|
-
Object.defineProperty(exports, "loadPolicy", { enumerable: true, get: function () { return loader_1.loadPolicy; } });
|
|
54
|
-
Object.defineProperty(exports, "parsePolicy", { enumerable: true, get: function () { return loader_1.parsePolicy; } });
|
|
55
|
-
Object.defineProperty(exports, "validatePolicy", { enumerable: true, get: function () { return loader_1.validatePolicy; } });
|
|
56
|
-
Object.defineProperty(exports, "policyFileExists", { enumerable: true, get: function () { return loader_1.policyFileExists; } });
|
|
57
|
-
Object.defineProperty(exports, "createExamplePolicy", { enumerable: true, get: function () { return loader_1.createExamplePolicy; } });
|
|
58
|
-
Object.defineProperty(exports, "serializePolicyYaml", { enumerable: true, get: function () { return loader_1.serializePolicyYaml; } });
|
|
59
|
-
Object.defineProperty(exports, "serializePolicyJson", { enumerable: true, get: function () { return loader_1.serializePolicyJson; } });
|
|
60
|
-
Object.defineProperty(exports, "PolicyLoadError", { enumerable: true, get: function () { return loader_1.PolicyLoadError; } });
|
|
61
|
-
Object.defineProperty(exports, "PolicyValidationError", { enumerable: true, get: function () { return loader_1.PolicyValidationError; } });
|
|
62
|
-
// Evaluation
|
|
63
|
-
var evaluate_1 = require("./evaluate");
|
|
64
|
-
Object.defineProperty(exports, "evaluate", { enumerable: true, get: function () { return evaluate_1.evaluate; } });
|
|
65
|
-
Object.defineProperty(exports, "explainMatches", { enumerable: true, get: function () { return evaluate_1.explainMatches; } });
|
|
66
|
-
Object.defineProperty(exports, "findEffectiveRule", { enumerable: true, get: function () { return evaluate_1.findEffectiveRule; } });
|
|
67
|
-
Object.defineProperty(exports, "isAllowed", { enumerable: true, get: function () { return evaluate_1.isAllowed; } });
|
|
68
|
-
Object.defineProperty(exports, "isDenied", { enumerable: true, get: function () { return evaluate_1.isDenied; } });
|
|
69
|
-
Object.defineProperty(exports, "requiresReview", { enumerable: true, get: function () { return evaluate_1.requiresReview; } });
|
|
70
|
-
Object.defineProperty(exports, "evaluateBatch", { enumerable: true, get: function () { return evaluate_1.evaluateBatch; } });
|
|
71
|
-
// Compiler (artifact generation)
|
|
72
|
-
var compiler_1 = require("./compiler");
|
|
73
|
-
Object.defineProperty(exports, "PEAC_PROTOCOL_VERSION", { enumerable: true, get: function () { return compiler_1.PEAC_PROTOCOL_VERSION; } });
|
|
74
|
-
Object.defineProperty(exports, "compilePeacTxt", { enumerable: true, get: function () { return compiler_1.compilePeacTxt; } });
|
|
75
|
-
Object.defineProperty(exports, "compileRobotsSnippet", { enumerable: true, get: function () { return compiler_1.compileRobotsSnippet; } });
|
|
76
|
-
Object.defineProperty(exports, "compileAiprefTemplates", { enumerable: true, get: function () { return compiler_1.compileAiprefTemplates; } });
|
|
77
|
-
Object.defineProperty(exports, "renderPolicyMarkdown", { enumerable: true, get: function () { return compiler_1.renderPolicyMarkdown; } });
|
|
78
|
-
// Generated profiles (v0.9.23+)
|
|
79
|
-
var profiles_1 = require("./generated/profiles");
|
|
80
|
-
Object.defineProperty(exports, "PROFILES", { enumerable: true, get: function () { return profiles_1.PROFILES; } });
|
|
81
|
-
Object.defineProperty(exports, "PROFILE_IDS", { enumerable: true, get: function () { return profiles_1.PROFILE_IDS; } });
|
|
82
|
-
// Profile loader API (v0.9.23+)
|
|
83
|
-
var profiles_2 = require("./profiles");
|
|
84
|
-
Object.defineProperty(exports, "listProfiles", { enumerable: true, get: function () { return profiles_2.listProfiles; } });
|
|
85
|
-
Object.defineProperty(exports, "hasProfile", { enumerable: true, get: function () { return profiles_2.hasProfile; } });
|
|
86
|
-
Object.defineProperty(exports, "loadProfile", { enumerable: true, get: function () { return profiles_2.loadProfile; } });
|
|
87
|
-
Object.defineProperty(exports, "getProfile", { enumerable: true, get: function () { return profiles_2.getProfile; } });
|
|
88
|
-
Object.defineProperty(exports, "validateProfileParams", { enumerable: true, get: function () { return profiles_2.validateProfileParams; } });
|
|
89
|
-
Object.defineProperty(exports, "customizeProfile", { enumerable: true, get: function () { return profiles_2.customizeProfile; } });
|
|
90
|
-
Object.defineProperty(exports, "getAllProfiles", { enumerable: true, get: function () { return profiles_2.getAllProfiles; } });
|
|
91
|
-
Object.defineProperty(exports, "getProfileSummary", { enumerable: true, get: function () { return profiles_2.getProfileSummary; } });
|
|
92
|
-
Object.defineProperty(exports, "ProfileError", { enumerable: true, get: function () { return profiles_2.ProfileError; } });
|
|
93
|
-
// Decision enforcement (v0.9.23+)
|
|
94
|
-
var enforce_1 = require("./enforce");
|
|
95
|
-
Object.defineProperty(exports, "enforceDecision", { enumerable: true, get: function () { return enforce_1.enforceDecision; } });
|
|
96
|
-
Object.defineProperty(exports, "requiresChallenge", { enumerable: true, get: function () { return enforce_1.requiresChallenge; } });
|
|
97
|
-
Object.defineProperty(exports, "getChallengeHeader", { enumerable: true, get: function () { return enforce_1.getChallengeHeader; } });
|
|
98
|
-
Object.defineProperty(exports, "enforceForHttp", { enumerable: true, get: function () { return enforce_1.enforceForHttp; } });
|
|
99
|
-
// Purpose-specific enforcement (v0.9.24+)
|
|
100
|
-
// These functions NEVER return 402 - that is reserved for payment/receipts
|
|
101
|
-
Object.defineProperty(exports, "enforcePurposeDecision", { enumerable: true, get: function () { return enforce_1.enforcePurposeDecision; } });
|
|
102
|
-
Object.defineProperty(exports, "getPurposeDecisionStatusCode", { enumerable: true, get: function () { return enforce_1.getPurposeDecisionStatusCode; } });
|
|
103
|
-
// Enforcement profiles (v0.9.24+)
|
|
104
|
-
var enforcement_profiles_1 = require("./enforcement-profiles");
|
|
105
|
-
// Profile definitions
|
|
106
|
-
Object.defineProperty(exports, "STRICT_PROFILE", { enumerable: true, get: function () { return enforcement_profiles_1.STRICT_PROFILE; } });
|
|
107
|
-
Object.defineProperty(exports, "BALANCED_PROFILE", { enumerable: true, get: function () { return enforcement_profiles_1.BALANCED_PROFILE; } });
|
|
108
|
-
Object.defineProperty(exports, "OPEN_PROFILE", { enumerable: true, get: function () { return enforcement_profiles_1.OPEN_PROFILE; } });
|
|
109
|
-
Object.defineProperty(exports, "ENFORCEMENT_PROFILES", { enumerable: true, get: function () { return enforcement_profiles_1.ENFORCEMENT_PROFILES; } });
|
|
110
|
-
Object.defineProperty(exports, "ENFORCEMENT_PROFILE_IDS", { enumerable: true, get: function () { return enforcement_profiles_1.ENFORCEMENT_PROFILE_IDS; } });
|
|
111
|
-
Object.defineProperty(exports, "DEFAULT_ENFORCEMENT_PROFILE", { enumerable: true, get: function () { return enforcement_profiles_1.DEFAULT_ENFORCEMENT_PROFILE; } });
|
|
112
|
-
// Profile lookup
|
|
113
|
-
Object.defineProperty(exports, "getEnforcementProfile", { enumerable: true, get: function () { return enforcement_profiles_1.getEnforcementProfile; } });
|
|
114
|
-
Object.defineProperty(exports, "isEnforcementProfileId", { enumerable: true, get: function () { return enforcement_profiles_1.isEnforcementProfileId; } });
|
|
115
|
-
Object.defineProperty(exports, "getDefaultEnforcementProfile", { enumerable: true, get: function () { return enforcement_profiles_1.getDefaultEnforcementProfile; } });
|
|
116
|
-
// Purpose evaluation
|
|
117
|
-
Object.defineProperty(exports, "evaluatePurpose", { enumerable: true, get: function () { return enforcement_profiles_1.evaluatePurpose; } });
|
|
118
|
-
Object.defineProperty(exports, "getPurposeStatusCode", { enumerable: true, get: function () { return enforcement_profiles_1.getPurposeStatusCode; } });
|
|
119
|
-
Object.defineProperty(exports, "getRetryAfter", { enumerable: true, get: function () { return enforcement_profiles_1.getRetryAfter; } });
|
|
120
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;;AAEH,QAAQ;AACR,iCAqCiB;AApCf,uGAAA,cAAc,OAAA;AAad,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AAWf,kCAAkC;AAClC,6GAAA,oBAAoB,OAAA;AACpB,yGAAA,gBAAgB,OAAA;AAChB,6GAAA,oBAAoB,OAAA;AACpB,6GAAA,oBAAoB,OAAA;AACpB,8GAAA,qBAAqB,OAAA;AACrB,mHAAA,0BAA0B,OAAA;AAC1B,+GAAA,sBAAsB,OAAA;AACtB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,iHAAA,wBAAwB,OAAA;AAG1B,SAAS;AACT,mCAUkB;AAThB,oGAAA,UAAU,OAAA;AACV,qGAAA,WAAW,OAAA;AACX,wGAAA,cAAc,OAAA;AACd,0GAAA,gBAAgB,OAAA;AAChB,6GAAA,mBAAmB,OAAA;AACnB,6GAAA,mBAAmB,OAAA;AACnB,6GAAA,mBAAmB,OAAA;AACnB,yGAAA,eAAe,OAAA;AACf,+GAAA,qBAAqB,OAAA;AAGvB,aAAa;AACb,uCAQoB;AAPlB,oGAAA,QAAQ,OAAA;AACR,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,qGAAA,SAAS,OAAA;AACT,oGAAA,QAAQ,OAAA;AACR,0GAAA,cAAc,OAAA;AACd,yGAAA,aAAa,OAAA;AAGf,iCAAiC;AACjC,uCAQoB;AAPlB,iHAAA,qBAAqB,OAAA;AACrB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,kHAAA,sBAAsB,OAAA;AACtB,gHAAA,oBAAoB,OAAA;AAKtB,gCAAgC;AAChC,iDAA6E;AAApE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