@platform-sec/sensitive-string-core 0.6.0 → 0.6.1
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/bson.d.ts +28 -0
- package/dist/bson.d.ts.map +1 -0
- package/dist/bson.js +37 -0
- package/dist/bson.js.map +1 -0
- package/dist/classification.d.ts +69 -0
- package/dist/classification.d.ts.map +1 -0
- package/dist/classification.js +104 -0
- package/dist/classification.js.map +1 -0
- package/dist/compare.d.ts +36 -0
- package/dist/compare.d.ts.map +1 -0
- package/dist/compare.js +123 -0
- package/dist/compare.js.map +1 -0
- package/dist/context.d.ts +78 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +110 -0
- package/dist/context.js.map +1 -0
- package/dist/derive.d.ts +110 -0
- package/dist/derive.d.ts.map +1 -0
- package/dist/derive.js +153 -0
- package/dist/derive.js.map +1 -0
- package/dist/destination.d.ts +120 -0
- package/dist/destination.d.ts.map +1 -0
- package/dist/destination.js +352 -0
- package/dist/destination.js.map +1 -0
- package/dist/deterministic.d.ts +145 -0
- package/dist/deterministic.d.ts.map +1 -0
- package/dist/deterministic.js +352 -0
- package/dist/deterministic.js.map +1 -0
- package/dist/dev-mode.d.ts +177 -0
- package/dist/dev-mode.d.ts.map +1 -0
- package/dist/dev-mode.js +503 -0
- package/dist/dev-mode.js.map +1 -0
- package/dist/environment.d.ts +181 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +558 -0
- package/dist/environment.js.map +1 -0
- package/dist/errors.d.ts +23 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +21 -0
- package/dist/errors.js.map +1 -0
- package/dist/global-state.d.ts +8 -0
- package/dist/global-state.d.ts.map +1 -0
- package/dist/global-state.js +22 -0
- package/dist/global-state.js.map +1 -0
- package/dist/hash.d.ts +74 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +253 -0
- package/dist/hash.js.map +1 -0
- package/dist/hygiene.d.ts +242 -0
- package/dist/hygiene.d.ts.map +1 -0
- package/dist/hygiene.js +257 -0
- package/dist/hygiene.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +233 -0
- package/dist/index.js.map +1 -0
- package/dist/mask.d.ts +51 -0
- package/dist/mask.d.ts.map +1 -0
- package/dist/mask.js +461 -0
- package/dist/mask.js.map +1 -0
- package/dist/own-property.d.ts +20 -0
- package/dist/own-property.d.ts.map +1 -0
- package/dist/own-property.js +34 -0
- package/dist/own-property.js.map +1 -0
- package/dist/patterns.d.ts +12 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +19 -0
- package/dist/patterns.js.map +1 -0
- package/dist/policy.d.ts +51 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +181 -0
- package/dist/policy.js.map +1 -0
- package/dist/probe.d.ts +141 -0
- package/dist/probe.d.ts.map +1 -0
- package/dist/probe.js +213 -0
- package/dist/probe.js.map +1 -0
- package/dist/redact-copy.d.ts +61 -0
- package/dist/redact-copy.d.ts.map +1 -0
- package/dist/redact-copy.js +217 -0
- package/dist/redact-copy.js.map +1 -0
- package/dist/redact.d.ts +141 -0
- package/dist/redact.d.ts.map +1 -0
- package/dist/redact.js +514 -0
- package/dist/redact.js.map +1 -0
- package/dist/redaction-marker.d.ts +48 -0
- package/dist/redaction-marker.d.ts.map +1 -0
- package/dist/redaction-marker.js +138 -0
- package/dist/redaction-marker.js.map +1 -0
- package/dist/redaction-observer.d.ts +108 -0
- package/dist/redaction-observer.d.ts.map +1 -0
- package/dist/redaction-observer.js +103 -0
- package/dist/redaction-observer.js.map +1 -0
- package/dist/redaction-scope.d.ts +21 -0
- package/dist/redaction-scope.d.ts.map +1 -0
- package/dist/redaction-scope.js +44 -0
- package/dist/redaction-scope.js.map +1 -0
- package/dist/reference.d.ts +101 -0
- package/dist/reference.d.ts.map +1 -0
- package/dist/reference.js +123 -0
- package/dist/reference.js.map +1 -0
- package/dist/regexp.d.ts +25 -0
- package/dist/regexp.d.ts.map +1 -0
- package/dist/regexp.js +61 -0
- package/dist/regexp.js.map +1 -0
- package/dist/release.d.ts +88 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +108 -0
- package/dist/release.js.map +1 -0
- package/dist/reveal-budget.d.ts +148 -0
- package/dist/reveal-budget.d.ts.map +1 -0
- package/dist/reveal-budget.js +314 -0
- package/dist/reveal-budget.js.map +1 -0
- package/dist/revocation.d.ts +168 -0
- package/dist/revocation.d.ts.map +1 -0
- package/dist/revocation.js +541 -0
- package/dist/revocation.js.map +1 -0
- package/dist/sealing.d.ts +283 -0
- package/dist/sealing.d.ts.map +1 -0
- package/dist/sealing.js +523 -0
- package/dist/sealing.js.map +1 -0
- package/dist/sensitive-string.d.ts +919 -0
- package/dist/sensitive-string.d.ts.map +1 -0
- package/dist/sensitive-string.js +2260 -0
- package/dist/sensitive-string.js.map +1 -0
- package/dist/serialized.d.ts +33 -0
- package/dist/serialized.d.ts.map +1 -0
- package/dist/serialized.js +65 -0
- package/dist/serialized.js.map +1 -0
- package/dist/template.d.ts +69 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +158 -0
- package/dist/template.js.map +1 -0
- package/dist/ttl.d.ts +104 -0
- package/dist/ttl.d.ts.map +1 -0
- package/dist/ttl.js +330 -0
- package/dist/ttl.js.map +1 -0
- package/dist/types.d.ts +859 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/winston.d.ts +114 -0
- package/dist/winston.d.ts.map +1 -0
- package/dist/winston.js +170 -0
- package/dist/winston.js.map +1 -0
- package/dist/worker.d.ts +398 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +861 -0
- package/dist/worker.js.map +1 -0
- package/dist/wrap.d.ts +287 -0
- package/dist/wrap.d.ts.map +1 -0
- package/dist/wrap.js +553 -0
- package/dist/wrap.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RevealRateLimitError = exports.RevealLimitExceededError = void 0;
|
|
4
|
+
exports.planRevealBudget = planRevealBudget;
|
|
5
|
+
exports.checkRevealBudget = checkRevealBudget;
|
|
6
|
+
exports.chargeReveal = chargeReveal;
|
|
7
|
+
exports.isBudgetExhausted = isBudgetExhausted;
|
|
8
|
+
exports.revealsRemaining = revealsRemaining;
|
|
9
|
+
exports.unshareableBudgetOptions = unshareableBudgetOptions;
|
|
10
|
+
const errors_js_1 = require("./errors.js");
|
|
11
|
+
/**
|
|
12
|
+
* Describe a rejected option without disclosing it.
|
|
13
|
+
*/
|
|
14
|
+
function describeType(value) {
|
|
15
|
+
return value === null ? 'null' : typeof value;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Raised when a value has been exposed as many times as it is allowed to be.
|
|
19
|
+
*
|
|
20
|
+
* The condition is permanent: nothing resets the count, so a caller that sees
|
|
21
|
+
* this fetches a fresh secret rather than retrying.
|
|
22
|
+
*/
|
|
23
|
+
class RevealLimitExceededError extends errors_js_1.SensitiveStringError {
|
|
24
|
+
limit;
|
|
25
|
+
attempts;
|
|
26
|
+
label;
|
|
27
|
+
name = 'RevealLimitExceededError';
|
|
28
|
+
code = 'reveal-limit-exceeded';
|
|
29
|
+
constructor(
|
|
30
|
+
/** The lifetime limit that was reached. */
|
|
31
|
+
limit,
|
|
32
|
+
/** Which attempt this was, counting from one. Always greater than `limit`. */
|
|
33
|
+
attempts, label) {
|
|
34
|
+
super(`Sensitive value${label !== undefined ? ` '${label}'` : ''} has been revealed ` +
|
|
35
|
+
`${limit} time${limit === 1 ? '' : 's'}, which is its limit`);
|
|
36
|
+
this.limit = limit;
|
|
37
|
+
this.attempts = attempts;
|
|
38
|
+
this.label = label;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.RevealLimitExceededError = RevealLimitExceededError;
|
|
42
|
+
/**
|
|
43
|
+
* Raised when a value has been exposed too often within its window.
|
|
44
|
+
*
|
|
45
|
+
* The condition is temporary, and `retryAfter` says how temporary, so a caller
|
|
46
|
+
* that means to continue can back off rather than fetch a new secret.
|
|
47
|
+
*/
|
|
48
|
+
class RevealRateLimitError extends errors_js_1.SensitiveStringError {
|
|
49
|
+
retryAfter;
|
|
50
|
+
windowLimit;
|
|
51
|
+
label;
|
|
52
|
+
name = 'RevealRateLimitError';
|
|
53
|
+
code = 'reveal-rate-limited';
|
|
54
|
+
constructor(
|
|
55
|
+
/** Milliseconds until the window has room again. Always positive. */
|
|
56
|
+
retryAfter,
|
|
57
|
+
/** The number of reveals the window allows. */
|
|
58
|
+
windowLimit, label) {
|
|
59
|
+
super(`Sensitive value${label !== undefined ? ` '${label}'` : ''} exceeded its rate limit of ` +
|
|
60
|
+
`${windowLimit} reveal${windowLimit === 1 ? '' : 's'}; retry in ${retryAfter}ms`);
|
|
61
|
+
this.retryAfter = retryAfter;
|
|
62
|
+
this.windowLimit = windowLimit;
|
|
63
|
+
this.label = label;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.RevealRateLimitError = RevealRateLimitError;
|
|
67
|
+
/**
|
|
68
|
+
* Validate a lifetime limit.
|
|
69
|
+
*
|
|
70
|
+
* Zero is a valid limit and means the value may never be exposed, which is the
|
|
71
|
+
* most conservative budget a caller can ask for. Testing the option for
|
|
72
|
+
* truthiness would turn it into no limit at all.
|
|
73
|
+
*/
|
|
74
|
+
function requireMaxReveals(value) {
|
|
75
|
+
if (value === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (typeof value !== 'number') {
|
|
79
|
+
throw new TypeError(`SensitiveString: maxReveals must be a number, received ${describeType(value)}`);
|
|
80
|
+
}
|
|
81
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
82
|
+
throw new RangeError('SensitiveString: maxReveals must be a non-negative integer');
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Validate the window length.
|
|
88
|
+
*
|
|
89
|
+
* Zero is rejected rather than read as "already elapsed". A zero-length window
|
|
90
|
+
* holds no timestamps and so can never be full, which is the least restrictive
|
|
91
|
+
* reading of the most restrictive-looking configuration. `ttl: 0` accepts zero
|
|
92
|
+
* for the opposite reason: there, zero denies everything.
|
|
93
|
+
*/
|
|
94
|
+
function requireWindow(value) {
|
|
95
|
+
if (value === undefined) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (typeof value !== 'number') {
|
|
99
|
+
throw new TypeError(`SensitiveString: revealWindow must be a number of milliseconds, received ${describeType(value)}`);
|
|
100
|
+
}
|
|
101
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
102
|
+
throw new RangeError('SensitiveString: revealWindow must be a positive, finite number');
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Validate the per-window limit.
|
|
108
|
+
*
|
|
109
|
+
* One is the floor. A window that admits nothing describes a value that can
|
|
110
|
+
* never be exposed, which `maxReveals: 0` says plainly, and it would raise a
|
|
111
|
+
* rate-limit error whose `retryAfter` no waiting could satisfy.
|
|
112
|
+
*/
|
|
113
|
+
function requireWindowLimit(value) {
|
|
114
|
+
if (value === undefined) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
if (typeof value !== 'number') {
|
|
118
|
+
throw new TypeError(`SensitiveString: maxRevealsPerWindow must be a number, received ${describeType(value)}`);
|
|
119
|
+
}
|
|
120
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
121
|
+
throw new RangeError('SensitiveString: maxRevealsPerWindow must be a positive integer; ' +
|
|
122
|
+
'use maxReveals: 0 for a value that may never be revealed');
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Build the reveal budget for a newly constructed value, or `undefined` when it
|
|
128
|
+
* has no limits.
|
|
129
|
+
*
|
|
130
|
+
* @throws TypeError If an option has the wrong type.
|
|
131
|
+
* @throws RangeError If a limit is out of range.
|
|
132
|
+
* @throws Error If only one half of the rate limit is given.
|
|
133
|
+
*/
|
|
134
|
+
function planRevealBudget(options) {
|
|
135
|
+
const maxReveals = requireMaxReveals(options?.maxReveals);
|
|
136
|
+
const window = requireWindow(options?.revealWindow);
|
|
137
|
+
const limit = requireWindowLimit(options?.maxRevealsPerWindow);
|
|
138
|
+
// Either option alone configures no rate limit whatsoever, which is the
|
|
139
|
+
// opposite of what somebody writing one of them meant.
|
|
140
|
+
if ((window === undefined) !== (limit === undefined)) {
|
|
141
|
+
throw new Error('SensitiveString: revealWindow and maxRevealsPerWindow must be given together; ' +
|
|
142
|
+
'one without the other is no rate limit at all');
|
|
143
|
+
}
|
|
144
|
+
if (maxReveals === undefined && window === undefined) {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
maxReveals,
|
|
149
|
+
rate: window === undefined || limit === undefined
|
|
150
|
+
? undefined
|
|
151
|
+
: { window, limit, times: [], head: 0 },
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Drop the charges that have left the window and report how many remain.
|
|
156
|
+
*/
|
|
157
|
+
function prune(rate, now) {
|
|
158
|
+
const { times } = rate;
|
|
159
|
+
const cutoff = now - rate.window;
|
|
160
|
+
let head = rate.head;
|
|
161
|
+
// A charge at exactly the cutoff has left the window, matching expiry, where
|
|
162
|
+
// a value is not usable at its own deadline.
|
|
163
|
+
for (; head < times.length; head++) {
|
|
164
|
+
const at = times[head];
|
|
165
|
+
if (at === undefined || at > cutoff) {
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Compacting when the dead prefix has grown to match what remains copies each
|
|
170
|
+
// entry a constant number of times and bounds the array at twice the limit.
|
|
171
|
+
if (head > 0 && head >= times.length - head) {
|
|
172
|
+
times.splice(0, head);
|
|
173
|
+
head = 0;
|
|
174
|
+
}
|
|
175
|
+
rate.head = head;
|
|
176
|
+
return times.length - head;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Decide whether every budget admits one more reveal, without charging any.
|
|
180
|
+
*
|
|
181
|
+
* Separating the decision from the charge is what lets the gate refuse before
|
|
182
|
+
* it authorizes and audits, so a refusal is not recorded as a reveal, and lets
|
|
183
|
+
* an audit hook that throws stop a reveal before it is counted.
|
|
184
|
+
*
|
|
185
|
+
* Every budget is checked before any is charged, so a derivative of two values
|
|
186
|
+
* cannot spend one parent's budget on a read the other refused.
|
|
187
|
+
*
|
|
188
|
+
* @throws RevealLimitExceededError If a lifetime limit has been reached.
|
|
189
|
+
* @throws RevealRateLimitError If a window is full.
|
|
190
|
+
*/
|
|
191
|
+
function checkRevealBudget(states, label) {
|
|
192
|
+
// The lifetime limit first. A value that is both exhausted and rate limited
|
|
193
|
+
// should report the condition that waiting will not clear.
|
|
194
|
+
for (const state of states) {
|
|
195
|
+
const { maxReveals } = state.budget;
|
|
196
|
+
if (maxReveals !== undefined && state.reveals >= maxReveals) {
|
|
197
|
+
throw new RevealLimitExceededError(maxReveals, state.reveals + 1, label);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
let now = -1;
|
|
201
|
+
let retryAfter = 0;
|
|
202
|
+
let windowLimit = 0;
|
|
203
|
+
for (const state of states) {
|
|
204
|
+
const { rate } = state.budget;
|
|
205
|
+
if (rate === undefined) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
// Read at most once, and only when a window can actually refuse.
|
|
209
|
+
if (now < 0) {
|
|
210
|
+
now = Date.now();
|
|
211
|
+
}
|
|
212
|
+
if (prune(rate, now) < rate.limit) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
// The oldest live charge is the one whose departure makes room. It is still
|
|
216
|
+
// inside the window, so the wait is positive.
|
|
217
|
+
const oldest = rate.times[rate.head] ?? now;
|
|
218
|
+
const wait = oldest + rate.window - now;
|
|
219
|
+
// The longest wait among the windows that refused, so a caller that honors
|
|
220
|
+
// it is not refused again by a second window on the next attempt.
|
|
221
|
+
if (wait > retryAfter) {
|
|
222
|
+
retryAfter = wait;
|
|
223
|
+
windowLimit = rate.limit;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (retryAfter > 0) {
|
|
227
|
+
throw new RevealRateLimitError(retryAfter, windowLimit, label);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Charge one reveal against every state a value reads.
|
|
232
|
+
*
|
|
233
|
+
* Called only once {@link checkRevealBudget} has admitted the read and the
|
|
234
|
+
* policy and audit hooks have let it through, so the count is of reveals that
|
|
235
|
+
* reached the caller rather than of attempts.
|
|
236
|
+
*
|
|
237
|
+
* The window records this instant rather than the one the check read, because
|
|
238
|
+
* the two are separated by however long a caller's audit hook takes. Dating a
|
|
239
|
+
* charge from the check would let an audit hook slower than the window push
|
|
240
|
+
* every entry out of it as it was written.
|
|
241
|
+
*/
|
|
242
|
+
function chargeReveal(states) {
|
|
243
|
+
let now = -1;
|
|
244
|
+
for (const state of states) {
|
|
245
|
+
state.reveals++;
|
|
246
|
+
const rate = state.budget?.rate;
|
|
247
|
+
if (rate !== undefined) {
|
|
248
|
+
// Read at most once, and only for a value that has a window.
|
|
249
|
+
if (now < 0) {
|
|
250
|
+
now = Date.now();
|
|
251
|
+
}
|
|
252
|
+
rate.times.push(now);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Whether any of these states has spent its lifetime limit.
|
|
258
|
+
*/
|
|
259
|
+
function isBudgetExhausted(states) {
|
|
260
|
+
for (const state of states) {
|
|
261
|
+
const { maxReveals } = state.budget;
|
|
262
|
+
if (maxReveals !== undefined && state.reveals >= maxReveals) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* The smallest number of reveals any of these states still allows, or
|
|
270
|
+
* `undefined` when none of them limits the total.
|
|
271
|
+
*/
|
|
272
|
+
function revealsRemaining(states) {
|
|
273
|
+
let fewest;
|
|
274
|
+
for (const state of states) {
|
|
275
|
+
const { maxReveals } = state.budget;
|
|
276
|
+
if (maxReveals === undefined) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
const remaining = Math.max(0, maxReveals - state.reveals);
|
|
280
|
+
if (fewest === undefined || remaining < fewest) {
|
|
281
|
+
fewest = remaining;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return fewest;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The construction options, among these states, that describe a limit no
|
|
288
|
+
* other isolate can share.
|
|
289
|
+
*
|
|
290
|
+
* A budget is a counter held by reference between a value and everything
|
|
291
|
+
* derived from it. A thread or a child process is a different isolate, so
|
|
292
|
+
* there is no reference to hand it, and the wire format resets counters for
|
|
293
|
+
* the same reason. A handoff would therefore give the far side a fresh budget,
|
|
294
|
+
* which turns a three-reveal limit into three per thread. `toWorkerPayload()`
|
|
295
|
+
* asks this before reading anything and refuses a value that answers.
|
|
296
|
+
*
|
|
297
|
+
* Named by option rather than by state so the message tells the caller what
|
|
298
|
+
* they wrote. The two halves of a rate limit are reported together, because
|
|
299
|
+
* they are given together.
|
|
300
|
+
*/
|
|
301
|
+
function unshareableBudgetOptions(states) {
|
|
302
|
+
const names = [];
|
|
303
|
+
for (const state of states) {
|
|
304
|
+
const { maxReveals, rate } = state.budget;
|
|
305
|
+
if (maxReveals !== undefined && !names.includes('maxReveals')) {
|
|
306
|
+
names.push('maxReveals');
|
|
307
|
+
}
|
|
308
|
+
if (rate !== undefined && !names.includes('revealWindow')) {
|
|
309
|
+
names.push('revealWindow', 'maxRevealsPerWindow');
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return names;
|
|
313
|
+
}
|
|
314
|
+
//# sourceMapp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AE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;QAE1C,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9D,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3B,CAAC;QAED,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { SensitiveStringError } from './errors.js';
|
|
2
|
+
import type { RevocationRegistry, RevocationScope, RevokeAuditDetails, SensitiveStringOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Why a value is refused, and where the refusal came from.
|
|
5
|
+
*
|
|
6
|
+
* `at` is epoch milliseconds rather than a Date, so a record can be shared and
|
|
7
|
+
* cannot be moved by whoever reads it.
|
|
8
|
+
*/
|
|
9
|
+
export interface RevocationRecord {
|
|
10
|
+
readonly reason: string;
|
|
11
|
+
readonly at: number;
|
|
12
|
+
readonly scope: RevocationScope;
|
|
13
|
+
/** What an unreachable registry threw, for a record of scope `'unavailable'`. */
|
|
14
|
+
readonly cause?: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Raised when an operation needs the raw value of a revoked instance.
|
|
18
|
+
*
|
|
19
|
+
* `scope` says which of the four revocation sources refused, and separates a
|
|
20
|
+
* value somebody revoked from one whose registry could not be reached: the
|
|
21
|
+
* first is permanent and the caller fetches a new secret, the second may clear
|
|
22
|
+
* and the caller may retry.
|
|
23
|
+
*
|
|
24
|
+
* `reason` and `label` are developer-supplied text and appear in the message.
|
|
25
|
+
* Neither may carry any part of the protected value.
|
|
26
|
+
*/
|
|
27
|
+
export declare class RevokedSensitiveValueError extends SensitiveStringError {
|
|
28
|
+
readonly reason: string;
|
|
29
|
+
readonly revokedAt: Date;
|
|
30
|
+
readonly label?: string | undefined;
|
|
31
|
+
readonly name = "RevokedSensitiveValueError";
|
|
32
|
+
readonly code = "revoked-value";
|
|
33
|
+
readonly scope: RevocationScope;
|
|
34
|
+
constructor(reason: string, revokedAt: Date, label?: string | undefined, scope?: RevocationScope, cause?: unknown);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A value's own revocation state, shared by reference between a value and
|
|
38
|
+
* everything derived from it.
|
|
39
|
+
*
|
|
40
|
+
* `label` is the label the owning value was constructed with, which is what
|
|
41
|
+
* label and pattern revocation match. A derived value is matched against the
|
|
42
|
+
* labels of the values it came from rather than against the label the
|
|
43
|
+
* derivation gave it, because no value was ever constructed under that one.
|
|
44
|
+
*/
|
|
45
|
+
export interface RevocationCell {
|
|
46
|
+
/**
|
|
47
|
+
* The revocation observed for this value. Latched: assigned once and never
|
|
48
|
+
* cleared, so pruning the entry that produced it cannot bring the value back.
|
|
49
|
+
*/
|
|
50
|
+
record: RevocationRecord | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* The generation of the process-global lists at which this cell was last
|
|
53
|
+
* found clean, or `-1` when it has never been checked. Comparing it is what
|
|
54
|
+
* keeps a read that revokes nothing from walking the pattern list.
|
|
55
|
+
*/
|
|
56
|
+
generation: number;
|
|
57
|
+
readonly label: string | undefined;
|
|
58
|
+
readonly registry: RevocationRegistry | undefined;
|
|
59
|
+
}
|
|
60
|
+
/** The part of a value's shared state this module reads and writes. */
|
|
61
|
+
export interface RevocationHolder {
|
|
62
|
+
readonly revocation: RevocationCell;
|
|
63
|
+
}
|
|
64
|
+
export declare function requireReason(value: unknown, operation: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Revoke every value constructed under a label, in this process.
|
|
67
|
+
*
|
|
68
|
+
* The first revocation of a label wins: a second call leaves the original
|
|
69
|
+
* reason and timestamp in place, because a revocation is a fact that already
|
|
70
|
+
* happened and re-stating it does not change when it did.
|
|
71
|
+
*
|
|
72
|
+
* @throws TypeError If `label` or `reason` is not a string.
|
|
73
|
+
* @throws RangeError If `label` is empty.
|
|
74
|
+
*/
|
|
75
|
+
export declare function revokeByLabel(label: string, reason: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Revoke every value whose construction label matches a pattern, in this
|
|
78
|
+
* process.
|
|
79
|
+
*
|
|
80
|
+
* The pattern is copied out of the caller's RegExp, so mutating theirs
|
|
81
|
+
* afterwards changes nothing, and the copy drops `g` and `y`, which would
|
|
82
|
+
* otherwise make it match every other time it was consulted.
|
|
83
|
+
*
|
|
84
|
+
* @throws TypeError If `pattern` is not a regular expression, if `reason` is
|
|
85
|
+
* not a string, or if the pattern nests quantifiers.
|
|
86
|
+
*/
|
|
87
|
+
export declare function revokeByPattern(pattern: RegExp, reason: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Drop label and pattern revocations recorded before a cutoff, and report how
|
|
90
|
+
* many were dropped.
|
|
91
|
+
*
|
|
92
|
+
* The lists hold strong references and grow for the life of the process, so
|
|
93
|
+
* something has to be able to shrink them. Dropping an entry while a value it
|
|
94
|
+
* matches is still reachable would bring that value back, so this is only safe
|
|
95
|
+
* once every instance that could match has been collected: after a rotation has
|
|
96
|
+
* drained, after the request that held the value has finished, at a point where
|
|
97
|
+
* the process no longer holds a reference to anything constructed under the
|
|
98
|
+
* label. A value that has already been refused stays refused whatever is
|
|
99
|
+
* pruned, because the refusal is latched onto the value when it is observed.
|
|
100
|
+
*
|
|
101
|
+
* @param olderThan - A Date or epoch milliseconds. Entries recorded strictly
|
|
102
|
+
* before it are dropped.
|
|
103
|
+
*/
|
|
104
|
+
export declare function pruneRevocations(olderThan: Date | number): number;
|
|
105
|
+
/** How many label and pattern revocations the process is holding. */
|
|
106
|
+
export declare function revocationCount(): {
|
|
107
|
+
labels: number;
|
|
108
|
+
patterns: number;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* A revocation list held in this process, for callers who want a scope smaller
|
|
112
|
+
* than the whole process, and the shape a store-backed registry implements.
|
|
113
|
+
*/
|
|
114
|
+
export declare class RevocationList implements RevocationRegistry {
|
|
115
|
+
#private;
|
|
116
|
+
/**
|
|
117
|
+
* Revoke a label. The first revocation of a label wins, as it does globally.
|
|
118
|
+
*
|
|
119
|
+
* @throws TypeError If `label` or `reason` is not a string.
|
|
120
|
+
* @throws RangeError If `label` is empty.
|
|
121
|
+
*/
|
|
122
|
+
revoke(label: string, reason: string): void;
|
|
123
|
+
isRevoked(label: string | undefined): boolean;
|
|
124
|
+
getReason(label: string): string | undefined;
|
|
125
|
+
/** When a label was revoked, or `undefined` when it was not. */
|
|
126
|
+
revokedAt(label: string): Date | undefined;
|
|
127
|
+
/** Drop entries recorded before a cutoff. The caveat on {@link pruneRevocations} applies. */
|
|
128
|
+
prune(olderThan: Date | number): number;
|
|
129
|
+
get size(): number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build the revocation state for a newly constructed value.
|
|
133
|
+
*
|
|
134
|
+
* @throws TypeError If `revocationRegistry` is not an object with an `isRevoked` method.
|
|
135
|
+
*/
|
|
136
|
+
export declare function planRevocation(options: SensitiveStringOptions | undefined, label: string | undefined): RevocationCell;
|
|
137
|
+
/**
|
|
138
|
+
* The revocation that refuses a read of these states, or `undefined`.
|
|
139
|
+
*
|
|
140
|
+
* A definite revocation is latched onto the cell that produced it, so a value
|
|
141
|
+
* that has once been refused stays refused even if the entry behind it is
|
|
142
|
+
* pruned. An unreachable registry is not latched: it describes the store.
|
|
143
|
+
*/
|
|
144
|
+
export declare function revocationInForce(states: readonly RevocationHolder[]): RevocationRecord | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* The revocation an inspection can see.
|
|
147
|
+
*
|
|
148
|
+
* Inspection observes and does not decide: it never calls out to an external
|
|
149
|
+
* registry, because a log line must not make a network call, and it never
|
|
150
|
+
* latches, because a value that was only ever printed has not been used.
|
|
151
|
+
*/
|
|
152
|
+
export declare function observedRevocation(states: readonly RevocationHolder[]): RevocationRecord | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Revoke every state a value shares, and report the record written, or
|
|
155
|
+
* `undefined` when every one of them was already revoked.
|
|
156
|
+
*
|
|
157
|
+
* Revocation runs along derivation edges in both directions. A derivative
|
|
158
|
+
* carries the material of the values it was built from, so a compromised
|
|
159
|
+
* substring is a compromised secret, and refusing to revoke through the handle
|
|
160
|
+
* a caller happens to be holding would fail open in exactly the incident this
|
|
161
|
+
* feature exists for. That is the opposite of `renew()`, which refuses on a
|
|
162
|
+
* derivative: refusing to extend a lifetime fails closed, refusing to end one
|
|
163
|
+
* does not.
|
|
164
|
+
*/
|
|
165
|
+
export declare function revokeStates(states: readonly RevocationHolder[], reason: string, scope?: RevocationScope): RevocationRecord | undefined;
|
|
166
|
+
/** The audit record for a revocation that took effect. */
|
|
167
|
+
export declare function revokeAuditDetails(record: RevocationRecord): RevokeAuditDetails;
|
|
168
|
+
//# sourceMappingURL=revocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../src/revocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AASpB;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,iFAAiF;IACjF,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,0BAA2B,SAAQ,oBAAoB;IAOhE,QAAQ,CAAC,MAAM,EAAE,MAAM;IAC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