@blamejs/pki 0.5.23 → 0.5.24

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.
@@ -132,4 +132,6 @@ function hex(text, maxBytes, E, code, label) {
132
132
  return buf;
133
133
  }
134
134
 
135
- module.exports = { base64url: base64url, base64: base64, hex: hex };
135
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
136
+ // call, so a writable export would let a caller replace the check rather than pass it.
137
+ module.exports = _intrinsic.freeze({ base64url: base64url, base64: base64, hex: hex });
@@ -21,6 +21,7 @@ var C = require("./constants");
21
21
  // Taken at load. `byteLength` is what the RFC 5322 line limit is measured with, so a replacement
22
22
  // decides whether an over-long header line is refused. See guard-intrinsic for the whole set.
23
23
  var _byteLength = require("./guard-intrinsic").byteLength;
24
+ var _freeze = require("./guard-intrinsic").freeze;
24
25
  // The character-code read the RFC 5322 ftext and CR/LF/NUL checks are built on. One that never
25
26
  // reports a control byte is a header-injection defense that inspects nothing.
26
27
  var _charCodeAt = require("./guard-intrinsic").uncurry(String.prototype.charCodeAt);
@@ -60,4 +61,6 @@ function assertField(name, value, E, code) {
60
61
  return v;
61
62
  }
62
63
 
63
- module.exports = { assertField: assertField };
64
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
65
+ // call, so a writable export would let a caller replace the check rather than pass it.
66
+ module.exports = _freeze({ assertField: assertField });
@@ -851,7 +851,9 @@ function _settle(opts, E, code, label) {
851
851
  return opts;
852
852
  }
853
853
 
854
- module.exports = {
854
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
855
+ // call, so a writable export would let a caller replace the check rather than pass it.
856
+ module.exports = intrinsic.freeze({
855
857
  assertCanonicalOid: assertCanonicalOid,
856
858
  assertKnownKeys: assertKnownKeys,
857
859
  optionsObject: optionsObject,
@@ -864,4 +866,4 @@ module.exports = {
864
866
  // Exported for the same reason as its sibling: a caller copying an array has to reach the
865
867
  // elements a read reaches, and the own keys are not that set.
866
868
  readableIndices: readableIndices
867
- };
869
+ });
@@ -260,7 +260,12 @@ function sizeOf(value) {
260
260
  (value === null ? "null" : typeof value));
261
261
  }
262
262
 
263
- module.exports = {
263
+ // Frozen, and that is what makes the capture worth taking. A consumer binds these at load, but it
264
+ // also reads several of them as `intrinsic.<name>(...)` at the call itself, and the module registry
265
+ // hands every caller this same object: assigning one property would redirect that call in every
266
+ // module at once, which is the substitution the captures exist to refuse. Freezing costs nothing
267
+ // here because nothing writes to it after load.
268
+ module.exports = Object.freeze({
264
269
  uncurry: uncurry,
265
270
  getter: getter,
266
271
  sizeOf: sizeOf,
@@ -347,4 +352,4 @@ module.exports = {
347
352
  Set: _Set,
348
353
  Map: _Map,
349
354
  WeakMap: _WeakMap,
350
- };
355
+ });
package/lib/guard-json.js CHANGED
@@ -27,6 +27,7 @@ var text = require("./guard-text");
27
27
  // setter, and `fromCharCode` is how an escape becomes the character it names; a replacement for
28
28
  // either decides what this parser produces. See guard-intrinsic for the whole captured set.
29
29
  var _defineProperty = require("./guard-intrinsic").defineProperty;
30
+ var _freeze = require("./guard-intrinsic").freeze;
30
31
  var _fromCharCode = require("./guard-intrinsic").fromCharCode;
31
32
  // The character-code read the whole scanner is built on: whitespace, escapes and the control-byte
32
33
  // reject all consult it, so one that lies decides what this parser sees in the input.
@@ -209,4 +210,6 @@ function parse(input, ErrorClass, spec) {
209
210
  return result;
210
211
  }
211
212
 
212
- module.exports = { parse: parse };
213
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
214
+ // call, so a writable export would let a caller replace the check rather than pass it.
215
+ module.exports = _freeze({ parse: parse });
@@ -27,6 +27,7 @@ var constants = require("./constants");
27
27
  // one returning true admits a NaN or fractional cap, which makes the comparison it guards always
28
28
  // false. See guard-intrinsic for the whole captured set.
29
29
  var _isInteger = require("./guard-intrinsic").isInteger;
30
+ var _freeze = require("./guard-intrinsic").freeze;
30
31
  // And the size measurement, for the same reason one step further in: a cap compares against a
31
32
  // length, and on a byte view `length` is a replaceable accessor. One reporting a small number for a
32
33
  // large buffer leaves every byteCap below always-false, which is the size defense silently dead.
@@ -137,4 +138,6 @@ function byteCap(buf, max, E, code, label) {
137
138
  return buf;
138
139
  }
139
140
 
140
- module.exports = { cap: cap, depthCap: depthCap, counter: counter, byteCap: byteCap };
141
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
142
+ // call, so a writable export would let a caller replace the check rather than pass it.
143
+ module.exports = _freeze({ cap: cap, depthCap: depthCap, counter: counter, byteCap: byteCap });
package/lib/guard-list.js CHANGED
@@ -28,6 +28,8 @@
28
28
  // over `===` has nothing to replace, so it holds whatever the prototype says, in a module that has
29
29
  // been swept and in one that has not.
30
30
 
31
+ var _freeze = require("./guard-intrinsic").freeze;
32
+
31
33
  // contains(list, value) -> boolean. Strict-equality membership, the `indexOf(v) !== -1` rule.
32
34
  // A null / undefined list is honestly empty, never a throw: these run on verdict paths.
33
35
  // @enforced-by behavioral -- `.indexOf(x) !== -1` has no rename-proof form that separates a
@@ -77,9 +79,11 @@ function allMatch(list, predicate) {
77
79
  return true;
78
80
  }
79
81
 
80
- module.exports = {
82
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
83
+ // call, so a writable export would let a caller replace the check rather than pass it.
84
+ module.exports = _freeze({
81
85
  contains: contains,
82
86
  containsAll: containsAll,
83
87
  anyMatches: anyMatches,
84
88
  allMatch: allMatch,
85
- };
89
+ });
package/lib/guard-name.js CHANGED
@@ -273,7 +273,7 @@ function emailEqual(a, b) {
273
273
  var aHost = _strSlice(a, ai + 1), bHost = _strSlice(b, bi + 1);
274
274
  if (!_asciiHost(aHost) || !_asciiHost(bHost)) return "not-comparable";
275
275
  if (aLocal !== bLocal) return "no-match";
276
- return _lowerAscii(aHost) === _lowerAscii(bHost) ? "match" : "no-match";
276
+ return lowerAscii(aHost) === lowerAscii(bHost) ? "match" : "no-match";
277
277
  }
278
278
 
279
279
  // A host-part this comparison can decide: ASCII, and carrying no A-label. Anything else
@@ -292,11 +292,18 @@ function _asciiHost(h) {
292
292
  return true;
293
293
  }
294
294
 
295
+ // lowerAscii(s) -> string
295
296
  // ASCII-only lowercase. String.toLowerCase() is Unicode-aware and would fold characters
296
- // outside ASCII (the Kelvin sign lowercases to "k"), which is precisely the mapping the
297
- // host-part rule does not authorize; _asciiHost has already excluded those inputs, so this
298
- // stays a plain A-Z shift rather than inheriting a locale-sensitive transform.
299
- function _lowerAscii(s) {
297
+ // outside ASCII (the Kelvin sign lowercases to "k"), which is precisely the mapping a
298
+ // name comparison does not authorize: a name folded that way is one the certificate or
299
+ // message does not carry, and comparing it equal to a name that was asked for is the
300
+ // defect. Every case-insensitive name comparison in the toolkit -- a host part, a CMP
301
+ // domain, an ACME identifier set -- folds through this one definition, so none of them can
302
+ // disagree about which characters case-fold.
303
+ //
304
+ // @enforced-by guard-shape-reinlined
305
+ // @guard-shape 0x41\s*&&\s*[A-Za-z_$][\w$]*\s*<=\s*0x5[aA]\s*\)\s*\?[^:]*\+\s*(?:32|0x20)\s*\)
306
+ function lowerAscii(s) {
300
307
  var out = "";
301
308
  for (var i = 0; i < s.length; i++) {
302
309
  var c = _charCodeAt(s, i);
@@ -305,8 +312,11 @@ function _lowerAscii(s) {
305
312
  return out;
306
313
  }
307
314
 
308
- module.exports = {
315
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
316
+ // call, so a writable export would let a caller replace the check rather than pass it.
317
+ module.exports = intrinsic.freeze({
309
318
  assertNoControlBytes: assertNoControlBytes, assertPrintableIa5: assertPrintableIa5,
310
319
  dnEqual: dnEqual, rdnEqual: rdnEqual, emailEqual: emailEqual,
311
320
  escapeControlBytes: escapeControlBytes, escapeDnValue: escapeDnValue,
312
- };
321
+ lowerAscii: lowerAscii,
322
+ });
@@ -44,6 +44,7 @@ var time = require("./guard-time");
44
44
  // one answering `false` makes each of those checks reject a well-formed parsed structure -- the
45
45
  // fail-closed direction, and still a caller deciding what this guard recognizes.
46
46
  var _isArray = require("./guard-intrinsic").isArray;
47
+ var _freezeExports = require("./guard-intrinsic").freeze;
47
48
  // The copy that becomes the recorded provenance bytes. A replacement returning a buffer over the
48
49
  // caller's own memory would let those bytes change after they were recorded, which is the one
49
50
  // thing provenance exists to prevent.
@@ -598,10 +599,12 @@ function acceptDerived(input, kind, parse, E, code, label) {
598
599
  ".parse result: " + _WHY[kind]);
599
600
  }
600
601
 
601
- module.exports = {
602
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
603
+ // call, so a writable export would let a caller replace the check rather than pass it.
604
+ module.exports = _freezeExports({
602
605
  accept: accept, acceptDerived: acceptDerived,
603
606
  fromTrustedSource: fromTrustedSource, recordingParser: recordingParser,
604
607
  recordingWalker: recordingWalker,
605
608
  isCert: certShape, isCrl: crlShape, isRecorded: isRecorded,
606
609
  isRecordedAsProduced: isRecordedAsProduced,
607
- };
610
+ });
@@ -25,6 +25,7 @@
25
25
  // Number at all, so one answering true for an unsafe magnitude reopens the precision loss this
26
26
  // guard exists to prevent. See guard-intrinsic for the whole captured set.
27
27
  var _isSafeInteger = require("./guard-intrinsic").isSafeInteger;
28
+ var _freeze = require("./guard-intrinsic").freeze;
28
29
  // The narrow itself. This module exists to turn a bounded BigInt into a Number without losing the
29
30
  // bound, and `Number` is a writable property of globalThis, so a replacement returns whatever it
30
31
  // likes from a value this function has just certified as in range.
@@ -131,7 +132,9 @@ function authoredInteger(value, E, code, label) {
131
132
  throw E(code, label + " must be an integer (a safe-integer number, or a bigint for a large value)");
132
133
  }
133
134
 
134
- module.exports = {
135
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
136
+ // call, so a writable export would let a caller replace the check rather than pass it.
137
+ module.exports = _freeze({
135
138
  int: int, uint31: uint31, positiveInt31: positiveInt31, uint64: uint64,
136
139
  authoredInteger: authoredInteger,
137
- };
140
+ });
@@ -138,4 +138,6 @@ function cipherFinish(transform, input, ErrorClass, code, label) {
138
138
  }
139
139
  }
140
140
 
141
- module.exports = { zeroize: zeroize, zeroizeAll: zeroizeAll, cipherFinish: cipherFinish };
141
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
142
+ // call, so a writable export would let a caller replace the check rather than pass it.
143
+ module.exports = intrinsic.freeze({ zeroize: zeroize, zeroizeAll: zeroizeAll, cipherFinish: cipherFinish });
package/lib/guard-text.js CHANGED
@@ -99,4 +99,6 @@ function decode(input, maxBytes, ErrorClass, spec) {
99
99
  throw new ErrorClass(spec.badInput, spec.label + " expects a string or Buffer");
100
100
  }
101
101
 
102
- module.exports = { decode: decode };
102
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
103
+ // call, so a writable export would let a caller replace the check rather than pass it.
104
+ module.exports = intrinsic.freeze({ decode: decode });
package/lib/guard-time.js CHANGED
@@ -32,6 +32,7 @@
32
32
  // the global `isNaN` is writable, and one returning false makes an invalid Date pass the check
33
33
  // below, which is the fail-open direction.
34
34
  var util = { types: require("./guard-intrinsic").types };
35
+ var _freeze = require("./guard-intrinsic").freeze;
35
36
  var _isNaN = Number.isNaN;
36
37
 
37
38
  // assertValid(value, E, code, label) -> the same Date, once proven valid.
@@ -130,9 +131,11 @@ function isDate(value) {
130
131
  return util.types.isDate(value);
131
132
  }
132
133
 
133
- module.exports = {
134
+ // Frozen for the reason the family header gives: a boundary reads its guard off this object at the
135
+ // call, so a writable export would let a caller replace the check rather than pass it.
136
+ module.exports = _freeze({
134
137
  assertValid: assertValid,
135
138
  instantOf: instantOf,
136
139
  isDate: isDate,
137
140
  within: within,
138
- };
141
+ });