@o3co/auth.policy-verifier.builtins 0.13.0 → 0.15.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 +2 -2
- package/README.md +2 -2
- package/dist/rules/AttrLiteralNotEqual.d.mts +5 -3
- package/dist/rules/AttrLiteralNotEqual.d.mts.map +1 -1
- package/dist/rules/AttrLiteralNotEqual.mjs +7 -3
- package/dist/rules/AttrLiteralNotIn.d.mts +5 -3
- package/dist/rules/AttrLiteralNotIn.d.mts.map +1 -1
- package/dist/rules/AttrLiteralNotIn.mjs +7 -3
- package/package.json +2 -2
package/README.ja.md
CHANGED
|
@@ -172,7 +172,7 @@ new AttrLiteralNotEqual({ a: string, v: string | number | boolean, group?: strin
|
|
|
172
172
|
|
|
173
173
|
- `code`: `"attr_equal"`。
|
|
174
174
|
- 既定の `ruleType`: `` `attr_literal_not_equal:${a}:${typeof v}:${String(v)}` ``。`typeof v` セグメントは異型リテラル間の衝突を防ぎます(`AttrLiteralEqual` と同じ理由)。
|
|
175
|
-
- `attrs.get(a)` が `v`
|
|
175
|
+
- `attrs.get(a)` が `v` と同じ型で厳密等価でないときに通過します。欠落・型不一致・`NaN` は `false`(safe-deny)を返します。`NaN` はどの数値とも等しくないため、数値でない値で制限が通過しないよう明示的に拒否します(#254)。
|
|
176
176
|
|
|
177
177
|
### AttrLiteralIn
|
|
178
178
|
|
|
@@ -192,7 +192,7 @@ new AttrLiteralNotIn({ a: string, values: (string | number | boolean)[], group?:
|
|
|
192
192
|
|
|
193
193
|
- `code`: `"attr_in_set"`。
|
|
194
194
|
- 既定の `ruleType`: `` `attr_literal_not_in:${a}:${type}:${count}:${hashPrefix}` `` — `AttrLiteralIn` と同じ、重複除去済みの安定ハッシュ方式。
|
|
195
|
-
- `values` は非空かつ同種の配列。`attrs.get(a)`
|
|
195
|
+
- `values` は非空かつ同種の配列。`attrs.get(a)` が `values` と同じ型で、集合に含まれないときに通過します。欠落・型不一致・`NaN` は `false`(safe-deny)を返します — `NaN` はどの集合にも含まれませんが、同様に拒否します(#254)。`values` 内の重複要素は Rule の挙動に影響しません。
|
|
196
196
|
|
|
197
197
|
### AttrLiteralCompare
|
|
198
198
|
|
package/README.md
CHANGED
|
@@ -187,7 +187,7 @@ new AttrLiteralNotEqual({ a: string, v: string | number | boolean, group?: strin
|
|
|
187
187
|
|
|
188
188
|
- `code`: `"attr_equal"`.
|
|
189
189
|
- Default `ruleType`: `` `attr_literal_not_equal:${a}:${typeof v}:${String(v)}` ``. The `typeof v` segment prevents silent collisions between distinct-type literals (same rationale as `AttrLiteralEqual`).
|
|
190
|
-
- Passes when `attrs.get(a)` is the same type as `v` and strictly not equal to it. Missing
|
|
190
|
+
- Passes when `attrs.get(a)` is the same type as `v` and strictly not equal to it. Missing, wrong-type or `NaN` attributes return `false` (safe-deny): `NaN` is unequal to every number, and a restriction must not pass on a value that is not a number at all (#254).
|
|
191
191
|
|
|
192
192
|
### AttrLiteralIn
|
|
193
193
|
|
|
@@ -207,7 +207,7 @@ new AttrLiteralNotIn({ a: string, values: (string | number | boolean)[], group?:
|
|
|
207
207
|
|
|
208
208
|
- `code`: `"attr_in_set"`.
|
|
209
209
|
- Default `ruleType`: `` `attr_literal_not_in:${a}:${type}:${count}:${hashPrefix}` `` — same stable, deduplication-aware hash scheme as `AttrLiteralIn`.
|
|
210
|
-
- `values` must be a non-empty, homogeneous array. Passes when `attrs.get(a)` is NOT in the set
|
|
210
|
+
- `values` must be a non-empty, homogeneous array. Passes when `attrs.get(a)` is the same type as the values and NOT in the set. Missing, wrong-type or `NaN` attributes return `false` (safe-deny); `NaN` is in no set, so it would otherwise pass (#254). Duplicate elements in `values` are ignored.
|
|
211
211
|
|
|
212
212
|
### AttrLiteralCompare
|
|
213
213
|
|
|
@@ -8,9 +8,11 @@ export interface AttrLiteralNotEqualConfig {
|
|
|
8
8
|
/**
|
|
9
9
|
* Rule that passes when a named attribute is present, matches the type of the
|
|
10
10
|
* configured literal value, and is strictly NOT equal to it. No type coercion
|
|
11
|
-
* is performed. If the attribute is missing, null,
|
|
12
|
-
* rule returns false (safe-deny).
|
|
13
|
-
*
|
|
11
|
+
* is performed. If the attribute is missing, null, of the wrong type, or
|
|
12
|
+
* `NaN` the rule returns false (safe-deny). `NaN` is unequal to every number,
|
|
13
|
+
* so `!==` alone would pass it: a restriction that allows on an attribute
|
|
14
|
+
* that is not a number at all (#254). Construction refuses a `NaN` literal
|
|
15
|
+
* for the mirror reason.
|
|
14
16
|
*
|
|
15
17
|
* ## Grouping and the default ruleType
|
|
16
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttrLiteralNotEqual.d.mts","sourceRoot":"","sources":["../../src/rules/AttrLiteralNotEqual.mts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,KAAK,YAAY,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,yBAAyB;IACzC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED
|
|
1
|
+
{"version":3,"file":"AttrLiteralNotEqual.d.mts","sourceRoot":"","sources":["../../src/rules/AttrLiteralNotEqual.mts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACN,KAAK,YAAY,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,yBAAyB;IACzC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,mBAAoB,YAAW,IAAI;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAe;gBAErB,MAAM,EAAE,yBAAyB;IAW7C,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO;CAM1C"}
|
|
@@ -4,9 +4,11 @@ import { requireAttrName, requireLiteralValue, requireOptionalGroup, } from "./_
|
|
|
4
4
|
/**
|
|
5
5
|
* Rule that passes when a named attribute is present, matches the type of the
|
|
6
6
|
* configured literal value, and is strictly NOT equal to it. No type coercion
|
|
7
|
-
* is performed. If the attribute is missing, null,
|
|
8
|
-
* rule returns false (safe-deny).
|
|
9
|
-
*
|
|
7
|
+
* is performed. If the attribute is missing, null, of the wrong type, or
|
|
8
|
+
* `NaN` the rule returns false (safe-deny). `NaN` is unequal to every number,
|
|
9
|
+
* so `!==` alone would pass it: a restriction that allows on an attribute
|
|
10
|
+
* that is not a number at all (#254). Construction refuses a `NaN` literal
|
|
11
|
+
* for the mirror reason.
|
|
10
12
|
*
|
|
11
13
|
* ## Grouping and the default ruleType
|
|
12
14
|
*
|
|
@@ -49,6 +51,8 @@ export class AttrLiteralNotEqual {
|
|
|
49
51
|
const x = attrs.get(this.a);
|
|
50
52
|
if (typeof x !== typeof this.v)
|
|
51
53
|
return false;
|
|
54
|
+
if (Number.isNaN(x))
|
|
55
|
+
return false;
|
|
52
56
|
return x !== this.v;
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -8,9 +8,11 @@ export interface AttrLiteralNotInConfig {
|
|
|
8
8
|
/**
|
|
9
9
|
* Rule that passes when a named attribute is present, matches the element type
|
|
10
10
|
* of the configured values array, and is NOT included in that array. No type
|
|
11
|
-
* coercion is performed. If the attribute is missing, null,
|
|
12
|
-
* type the rule returns false (safe-deny).
|
|
13
|
-
*
|
|
11
|
+
* coercion is performed. If the attribute is missing, null, of the wrong
|
|
12
|
+
* type, or `NaN` the rule returns false (safe-deny). `NaN` is in no set of
|
|
13
|
+
* numbers — construction refuses one that holds it — so the membership test
|
|
14
|
+
* alone would pass it: a restriction that allows on an attribute that is not
|
|
15
|
+
* a number at all (#254).
|
|
14
16
|
*
|
|
15
17
|
* ## Grouping and the default ruleType
|
|
16
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttrLiteralNotIn.d.mts","sourceRoot":"","sources":["../../src/rules/AttrLiteralNotIn.mts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAEN,KAAK,YAAY,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED
|
|
1
|
+
{"version":3,"file":"AttrLiteralNotIn.d.mts","sourceRoot":"","sources":["../../src/rules/AttrLiteralNotIn.mts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAEN,KAAK,YAAY,EAIjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,gBAAiB,YAAW,IAAI;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;gBAElC,MAAM,EAAE,sBAAsB;IAc1C,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO;CAM1C"}
|
|
@@ -4,9 +4,11 @@ import { computeValuesKey, requireAttrName, requireHomogeneousLiteralArray, requ
|
|
|
4
4
|
/**
|
|
5
5
|
* Rule that passes when a named attribute is present, matches the element type
|
|
6
6
|
* of the configured values array, and is NOT included in that array. No type
|
|
7
|
-
* coercion is performed. If the attribute is missing, null,
|
|
8
|
-
* type the rule returns false (safe-deny).
|
|
9
|
-
*
|
|
7
|
+
* coercion is performed. If the attribute is missing, null, of the wrong
|
|
8
|
+
* type, or `NaN` the rule returns false (safe-deny). `NaN` is in no set of
|
|
9
|
+
* numbers — construction refuses one that holds it — so the membership test
|
|
10
|
+
* alone would pass it: a restriction that allows on an attribute that is not
|
|
11
|
+
* a number at all (#254).
|
|
10
12
|
*
|
|
11
13
|
* ## Grouping and the default ruleType
|
|
12
14
|
*
|
|
@@ -47,6 +49,8 @@ export class AttrLiteralNotIn {
|
|
|
47
49
|
const x = attrs.get(this.a);
|
|
48
50
|
if (typeof x !== this.elementType)
|
|
49
51
|
return false;
|
|
52
|
+
if (Number.isNaN(x))
|
|
53
|
+
return false;
|
|
50
54
|
return !this.valuesSet.has(x);
|
|
51
55
|
}
|
|
52
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3co/auth.policy-verifier.builtins",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@o3co/auth.policy-verifier.core": "0.
|
|
34
|
+
"@o3co/auth.policy-verifier.core": "0.15.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^26.6.2",
|