@o3co/auth.policy-verifier.builtins 0.15.0 → 0.16.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/README.ja.md +45 -7
- package/README.md +47 -8
- package/dist/collectors/DelegationRangeCollector.d.mts +29 -0
- package/dist/collectors/DelegationRangeCollector.d.mts.map +1 -0
- package/dist/collectors/DelegationRangeCollector.mjs +29 -0
- package/dist/collectors/PayloadClaimAttributeCollector.d.mts +24 -39
- package/dist/collectors/PayloadClaimAttributeCollector.d.mts.map +1 -1
- package/dist/collectors/PayloadClaimAttributeCollector.mjs +26 -41
- package/dist/collectors/PayloadScopeCollector.d.mts +1 -1
- package/dist/collectors/PayloadSubjectIdCollector.d.mts +1 -1
- package/dist/collectors/PayloadSubjectIdCollector.mjs +1 -1
- package/dist/collectors/RequestContextAttributeCollector.d.mts +24 -62
- package/dist/collectors/RequestContextAttributeCollector.d.mts.map +1 -1
- package/dist/collectors/RequestContextAttributeCollector.mjs +33 -74
- package/dist/collectors/StaticPermissionCollector.d.mts +7 -9
- package/dist/collectors/StaticPermissionCollector.d.mts.map +1 -1
- package/dist/collectors/StaticPermissionCollector.mjs +7 -9
- package/dist/collectors/StaticRoleCollector.d.mts +9 -10
- package/dist/collectors/StaticRoleCollector.d.mts.map +1 -1
- package/dist/collectors/StaticRoleCollector.mjs +10 -11
- package/dist/collectors/_attributeMapping.d.mts +1 -0
- package/dist/collectors/_attributeMapping.d.mts.map +1 -1
- package/dist/collectors/_attributeMapping.mjs +3 -0
- package/dist/collectors/_claims.d.mts +2 -3
- package/dist/collectors/_claims.d.mts.map +1 -1
- package/dist/collectors/_claims.mjs +3 -4
- package/dist/delegation/range.d.mts +48 -0
- package/dist/delegation/range.d.mts.map +1 -0
- package/dist/delegation/range.mjs +108 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/keys.d.mts +9 -0
- package/dist/keys.d.mts.map +1 -0
- package/dist/keys.mjs +31 -0
- package/dist/module.d.mts.map +1 -1
- package/dist/module.mjs +4 -0
- package/dist/resource/DotNotationResourceParser.d.mts +16 -19
- package/dist/resource/DotNotationResourceParser.d.mts.map +1 -1
- package/dist/resource/DotNotationResourceParser.mjs +20 -25
- package/dist/rules/AttrLiteralCompare.d.mts +3 -5
- package/dist/rules/AttrLiteralCompare.d.mts.map +1 -1
- package/dist/rules/AttrLiteralCompare.mjs +3 -5
- package/dist/rules/AttrLiteralEqual.d.mts +3 -5
- package/dist/rules/AttrLiteralEqual.d.mts.map +1 -1
- package/dist/rules/AttrLiteralEqual.mjs +3 -5
- package/dist/rules/AttrLiteralIn.d.mts +3 -5
- package/dist/rules/AttrLiteralIn.d.mts.map +1 -1
- package/dist/rules/AttrLiteralIn.mjs +3 -5
- package/dist/rules/AttrLiteralNotEqual.d.mts +6 -8
- package/dist/rules/AttrLiteralNotEqual.d.mts.map +1 -1
- package/dist/rules/AttrLiteralNotEqual.mjs +6 -8
- package/dist/rules/AttrLiteralNotIn.d.mts +4 -6
- package/dist/rules/AttrLiteralNotIn.d.mts.map +1 -1
- package/dist/rules/AttrLiteralNotIn.mjs +4 -6
- package/dist/rules/AttrMatchRule.d.mts +1 -1
- package/dist/rules/AttrMatchRule.mjs +1 -1
- package/dist/rules/AttrPairCompare.d.mts +3 -5
- package/dist/rules/AttrPairCompare.d.mts.map +1 -1
- package/dist/rules/AttrPairCompare.mjs +3 -5
- package/dist/rules/AttrPairEqual.d.mts +6 -9
- package/dist/rules/AttrPairEqual.d.mts.map +1 -1
- package/dist/rules/AttrPairEqual.mjs +6 -9
- package/dist/rules/AttrPairNotEqual.d.mts +3 -5
- package/dist/rules/AttrPairNotEqual.d.mts.map +1 -1
- package/dist/rules/AttrPairNotEqual.mjs +3 -5
- package/dist/rules/HasPermission.d.mts +9 -10
- package/dist/rules/HasPermission.d.mts.map +1 -1
- package/dist/rules/HasPermission.mjs +16 -20
- package/dist/rules/HasScope.d.mts +11 -14
- package/dist/rules/HasScope.d.mts.map +1 -1
- package/dist/rules/HasScope.mjs +8 -11
- package/dist/rules/WithinDelegationRange.d.mts +22 -0
- package/dist/rules/WithinDelegationRange.d.mts.map +1 -0
- package/dist/rules/WithinDelegationRange.mjs +38 -0
- package/dist/rules/_sharedValidation.d.mts +12 -19
- package/dist/rules/_sharedValidation.d.mts.map +1 -1
- package/dist/rules/_sharedValidation.mjs +17 -25
- package/dist/rules/collectors/DelegationRangeRuleCollector.d.mts +36 -0
- package/dist/rules/collectors/DelegationRangeRuleCollector.d.mts.map +1 -0
- package/dist/rules/collectors/DelegationRangeRuleCollector.mjs +36 -0
- package/dist/rules/collectors/ResourceActionScopeRuleCollector.d.mts +19 -28
- package/dist/rules/collectors/ResourceActionScopeRuleCollector.d.mts.map +1 -1
- package/dist/rules/collectors/ResourceActionScopeRuleCollector.mjs +21 -30
- package/package.json +5 -5
|
@@ -16,7 +16,7 @@ export interface ResourceActionScopeRuleCollectorConfig {
|
|
|
16
16
|
*/
|
|
17
17
|
allowBareScopeRewrite?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* The claim whose presence says the token asserted scopes
|
|
19
|
+
* The claim whose presence says the token asserted scopes. Defaults
|
|
20
20
|
* to `scope`; set it to what `PayloadScopeCollector` reads (`scp` for Okta)
|
|
21
21
|
* so the two look at the same claim — each keeps its own option, and
|
|
22
22
|
* nothing checks that both were given the same name. Only presence is
|
|
@@ -32,36 +32,27 @@ export interface ResourceActionScopeRuleCollectorConfig {
|
|
|
32
32
|
* ## Scope as capability ceiling
|
|
33
33
|
*
|
|
34
34
|
* The JWT `scope` claim represents what the session **can request** — a
|
|
35
|
-
* capability ceiling — not what the session **has been granted
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* capability ceiling — not what the session **has been granted**; the full
|
|
36
|
+
* rule pipeline decides the latter. This collector enforces the ceiling only:
|
|
37
|
+
* it produces a `HasScope` rule for the requested `{action}:{resourceType}`,
|
|
38
|
+
* which the token's scopes must satisfy, compared exactly and case-sensitively.
|
|
39
|
+
* An issuer that emits bare resource names (`project` rather than
|
|
40
|
+
* `read:project`) must opt in with `{ allowBareScopeRewrite: true }`.
|
|
40
41
|
*
|
|
41
|
-
* ##
|
|
42
|
+
* ## Scopeless tokens
|
|
42
43
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* By default the rule is emitted whether or not the token carries the scope
|
|
45
|
+
* claim, so a scopeless token fails it. Dropping the rule instead would remove
|
|
46
|
+
* the scope group from AND-evaluation, and in a scope-only pipeline that turns
|
|
47
|
+
* "the token asserts no capability" into "every capability is allowed".
|
|
47
48
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* Flows where the IdP does not issue a `scope` claim (e.g. DID-grant tokens)
|
|
56
|
-
* must opt out explicitly with `{ scopeless: "skip" }`, and only in a pipeline
|
|
57
|
-
* where another rule group authorizes the request — otherwise the request is
|
|
58
|
-
* left with no applicable rule, which the evaluator denies.
|
|
59
|
-
*
|
|
60
|
-
* For pipelines that exclusively serve scopeless flows, prefer collectors that
|
|
61
|
-
* derive rules from identity claims (e.g. DID, `sub`, role) instead.
|
|
62
|
-
*
|
|
63
|
-
* See https://github.com/o3co/auth.provider/issues/56 for background on why
|
|
64
|
-
* the IdP asserts identity, not permissions.
|
|
49
|
+
* Flows where the IdP issues no scope claim (e.g. DID-grant tokens) must opt
|
|
50
|
+
* out explicitly with `{ scopeless: "skip" }`, and only in a pipeline where
|
|
51
|
+
* another granting rule group authorizes the request — otherwise the request
|
|
52
|
+
* is left with no applicable rule, which the evaluator denies by default and
|
|
53
|
+
* allows under `onEmptyRuleSet: "allow"`. A restricting rule, such as the
|
|
54
|
+
* delegation range, authorizes nothing. A pipeline that serves only scopeless
|
|
55
|
+
* flows should derive rules from identity claims (DID, `sub`, role) instead.
|
|
65
56
|
*/
|
|
66
57
|
export declare class ResourceActionScopeRuleCollector implements RuleCollector {
|
|
67
58
|
private readonly scopeless;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceActionScopeRuleCollector.d.mts","sourceRoot":"","sources":["../../../src/rules/collectors/ResourceActionScopeRuleCollector.mts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAI7F,yGAAyG;AACzG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAI9C,mEAAmE;AACnE,MAAM,WAAW,sCAAsC;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED
|
|
1
|
+
{"version":3,"file":"ResourceActionScopeRuleCollector.d.mts","sourceRoot":"","sources":["../../../src/rules/collectors/ResourceActionScopeRuleCollector.mts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAI7F,yGAAyG;AACzG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAI9C,mEAAmE;AACnE,MAAM,WAAW,sCAAsC;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,gCAAiC,YAAW,aAAa;IACrE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAU;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,MAAM,CAAC,EAAE,sCAAsC;IA0BrD,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAOzD"}
|
|
@@ -9,36 +9,27 @@ const SCOPELESS_POLICIES = ["deny", "skip"];
|
|
|
9
9
|
* ## Scope as capability ceiling
|
|
10
10
|
*
|
|
11
11
|
* The JWT `scope` claim represents what the session **can request** — a
|
|
12
|
-
* capability ceiling — not what the session **has been granted
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* must opt out explicitly with `{ scopeless: "skip" }`, and only in a pipeline
|
|
34
|
-
* where another rule group authorizes the request — otherwise the request is
|
|
35
|
-
* left with no applicable rule, which the evaluator denies.
|
|
36
|
-
*
|
|
37
|
-
* For pipelines that exclusively serve scopeless flows, prefer collectors that
|
|
38
|
-
* derive rules from identity claims (e.g. DID, `sub`, role) instead.
|
|
39
|
-
*
|
|
40
|
-
* See https://github.com/o3co/auth.provider/issues/56 for background on why
|
|
41
|
-
* the IdP asserts identity, not permissions.
|
|
12
|
+
* capability ceiling — not what the session **has been granted**; the full
|
|
13
|
+
* rule pipeline decides the latter. This collector enforces the ceiling only:
|
|
14
|
+
* it produces a `HasScope` rule for the requested `{action}:{resourceType}`,
|
|
15
|
+
* which the token's scopes must satisfy, compared exactly and case-sensitively.
|
|
16
|
+
* An issuer that emits bare resource names (`project` rather than
|
|
17
|
+
* `read:project`) must opt in with `{ allowBareScopeRewrite: true }`.
|
|
18
|
+
*
|
|
19
|
+
* ## Scopeless tokens
|
|
20
|
+
*
|
|
21
|
+
* By default the rule is emitted whether or not the token carries the scope
|
|
22
|
+
* claim, so a scopeless token fails it. Dropping the rule instead would remove
|
|
23
|
+
* the scope group from AND-evaluation, and in a scope-only pipeline that turns
|
|
24
|
+
* "the token asserts no capability" into "every capability is allowed".
|
|
25
|
+
*
|
|
26
|
+
* Flows where the IdP issues no scope claim (e.g. DID-grant tokens) must opt
|
|
27
|
+
* out explicitly with `{ scopeless: "skip" }`, and only in a pipeline where
|
|
28
|
+
* another granting rule group authorizes the request — otherwise the request
|
|
29
|
+
* is left with no applicable rule, which the evaluator denies by default and
|
|
30
|
+
* allows under `onEmptyRuleSet: "allow"`. A restricting rule, such as the
|
|
31
|
+
* delegation range, authorizes nothing. A pipeline that serves only scopeless
|
|
32
|
+
* flows should derive rules from identity claims (DID, `sub`, role) instead.
|
|
42
33
|
*/
|
|
43
34
|
export class ResourceActionScopeRuleCollector {
|
|
44
35
|
scopeless;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3co/auth.policy-verifier.builtins",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@o3co/auth.policy-verifier.core": "0.
|
|
34
|
+
"@o3co/auth.policy-verifier.core": "0.16.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/node": "^26.6.
|
|
38
|
-
"@vitest/coverage-v8": "^5.0.
|
|
39
|
-
"vitest": "^5.0.
|
|
37
|
+
"@types/node": "^26.6.3",
|
|
38
|
+
"@vitest/coverage-v8": "^5.0.2",
|
|
39
|
+
"vitest": "^5.0.2"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"prebuild": "rimraf dist",
|