@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
package/dist/hygiene.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hygiene = exports.ClearedSensitiveValueError = void 0;
|
|
4
|
+
exports.trackInstance = trackInstance;
|
|
5
|
+
exports.setMemoryHygiene = setMemoryHygiene;
|
|
6
|
+
exports.getMemoryHygiene = getMemoryHygiene;
|
|
7
|
+
exports.clearAllSensitiveValues = clearAllSensitiveValues;
|
|
8
|
+
exports.resetMemoryHygiene = resetMemoryHygiene;
|
|
9
|
+
exports.trackedInstanceCount = trackedInstanceCount;
|
|
10
|
+
const global_state_js_1 = require("./global-state.js");
|
|
11
|
+
const errors_js_1 = require("./errors.js");
|
|
12
|
+
/**
|
|
13
|
+
* What this library can do about the plaintext already in the V8 heap, which
|
|
14
|
+
* is less than the phrase "memory hygiene" suggests and is worth stating
|
|
15
|
+
* before the API rather than after it.
|
|
16
|
+
*
|
|
17
|
+
* JavaScript cannot overwrite the backing store of a string it holds a
|
|
18
|
+
* reference to. There is no primitive for it, and encoding the value into a
|
|
19
|
+
* buffer so the buffer can be zeroed only adds a second copy, in external
|
|
20
|
+
* memory a heap snapshot cannot even show. The one thing available is dropping
|
|
21
|
+
* the last reference and letting the collector reclaim the memory on its own
|
|
22
|
+
* schedule.
|
|
23
|
+
*
|
|
24
|
+
* So `clear()` drops *the library's* reference. Whether that was the last
|
|
25
|
+
* reference is a property of the calling code: a route that wraps
|
|
26
|
+
* `req.body.token` and keeps the parsed body alive for the rest of the request
|
|
27
|
+
* gains nothing from it, because the instance's value and `req.body.token` are
|
|
28
|
+
* the same string object. The shape this feature is for is a credential the
|
|
29
|
+
* library holds alone, loaded once and used once.
|
|
30
|
+
*
|
|
31
|
+
* Two process-global switches sit beside it, both off by default and both
|
|
32
|
+
* under rule R6: they narrow an accident, not an attacker who is already
|
|
33
|
+
* running code in the process.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Raised when an operation needs the raw value of a cleared instance.
|
|
37
|
+
*
|
|
38
|
+
* Distinguished from `ExpiredSensitiveValueError` so a caller can tell a value
|
|
39
|
+
* that lapsed from one this process destroyed: the first may be worth fetching
|
|
40
|
+
* again, the second means the code holds a reference it was done with.
|
|
41
|
+
*/
|
|
42
|
+
class ClearedSensitiveValueError extends errors_js_1.SensitiveStringError {
|
|
43
|
+
clearedAt;
|
|
44
|
+
attemptedAt;
|
|
45
|
+
label;
|
|
46
|
+
name = 'ClearedSensitiveValueError';
|
|
47
|
+
code = 'cleared-value';
|
|
48
|
+
constructor(clearedAt, attemptedAt, label) {
|
|
49
|
+
super(`Sensitive value${label !== undefined ? ` '${label}'` : ''} was cleared at ` +
|
|
50
|
+
clearedAt.toISOString());
|
|
51
|
+
this.clearedAt = clearedAt;
|
|
52
|
+
this.attemptedAt = attemptedAt;
|
|
53
|
+
this.label = label;
|
|
54
|
+
}
|
|
55
|
+
/** Milliseconds between the clear and the attempted access. */
|
|
56
|
+
get clearedFor() {
|
|
57
|
+
return this.attemptedAt.getTime() - this.clearedAt.getTime();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ClearedSensitiveValueError = ClearedSensitiveValueError;
|
|
61
|
+
const DISABLED = Object.freeze({
|
|
62
|
+
freezeInstances: false,
|
|
63
|
+
trackInstances: false,
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* The one registry and configuration every physical copy of core shares.
|
|
67
|
+
*
|
|
68
|
+
* Exported for `sensitive-string.ts`, which reads `config` on the construction
|
|
69
|
+
* path: one property chain rather than a call through an accessor, which is
|
|
70
|
+
* what a process that never turns either switch on pays for the feature.
|
|
71
|
+
*
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
exports.hygiene = (0, global_state_js_1.getGlobalSingleton)('memory-hygiene', () => {
|
|
75
|
+
const tracked = new Set();
|
|
76
|
+
return {
|
|
77
|
+
config: DISABLED,
|
|
78
|
+
tracked,
|
|
79
|
+
finalizer: new FinalizationRegistry((ref) => {
|
|
80
|
+
tracked.delete(ref);
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* Start tracking an instance, so a later bulk clear can reach it.
|
|
86
|
+
*
|
|
87
|
+
* The instance is its own unregister token, so `clearAllSensitiveValues` can
|
|
88
|
+
* drop what it has already destroyed.
|
|
89
|
+
*
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
function trackInstance(instance) {
|
|
93
|
+
const ref = new WeakRef(instance);
|
|
94
|
+
exports.hygiene.tracked.add(ref);
|
|
95
|
+
exports.hygiene.finalizer.register(instance, ref, instance);
|
|
96
|
+
}
|
|
97
|
+
function describeType(value) {
|
|
98
|
+
return value === null ? 'null' : typeof value;
|
|
99
|
+
}
|
|
100
|
+
function requireBoolean(value, name, fallback) {
|
|
101
|
+
if (value === undefined) {
|
|
102
|
+
return fallback;
|
|
103
|
+
}
|
|
104
|
+
if (typeof value !== 'boolean') {
|
|
105
|
+
throw new TypeError(`setMemoryHygiene: ${name} must be a boolean, received ${describeType(value)}`);
|
|
106
|
+
}
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Configure memory hygiene for this process. Merges: an unset field is left as
|
|
111
|
+
* it was, so turning tracking on later does not silently unfreeze.
|
|
112
|
+
*
|
|
113
|
+
* Both switches are read at construction, so this belongs in the entry module
|
|
114
|
+
* beside `registerPolicy`, before anything wraps a value. An instance built
|
|
115
|
+
* before this call is neither frozen nor tracked, and there is no way to
|
|
116
|
+
* retrofit either onto it.
|
|
117
|
+
*
|
|
118
|
+
* Per-isolate, like every other process-global in this library: a worker
|
|
119
|
+
* thread has its own `globalThis` and so its own configuration and its own
|
|
120
|
+
* tracked set. Configuring the main thread configures the main thread.
|
|
121
|
+
*
|
|
122
|
+
* @param config - The switches to change.
|
|
123
|
+
* @throws TypeError If the configuration, or one of its fields, has the wrong type.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* setMemoryHygiene({ trackInstances: true, freezeInstances: true });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
function setMemoryHygiene(config) {
|
|
131
|
+
if (typeof config !== 'object' || config === null) {
|
|
132
|
+
throw new TypeError(`setMemoryHygiene expects a configuration object; received ${describeType(config)}`);
|
|
133
|
+
}
|
|
134
|
+
const current = exports.hygiene.config;
|
|
135
|
+
exports.hygiene.config = Object.freeze({
|
|
136
|
+
freezeInstances: requireBoolean(config.freezeInstances, 'freezeInstances', current.freezeInstances),
|
|
137
|
+
trackInstances: requireBoolean(config.trackInstances, 'trackInstances', current.trackInstances),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The configuration in force, with every default resolved.
|
|
142
|
+
*
|
|
143
|
+
* A frozen copy of the live object rather than the object itself, so a caller
|
|
144
|
+
* cannot reconfigure the process by writing to what it reads back. The result
|
|
145
|
+
* is accepted by {@link setMemoryHygiene}, so it can be saved and restored.
|
|
146
|
+
*/
|
|
147
|
+
function getMemoryHygiene() {
|
|
148
|
+
const { freezeInstances, trackInstances } = exports.hygiene.config;
|
|
149
|
+
return Object.freeze({ freezeInstances, trackInstances });
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Clear every instance this process is still tracking, and report how many.
|
|
153
|
+
*
|
|
154
|
+
* Only reaches values constructed while `trackInstances` was on, so this
|
|
155
|
+
* returns `0` in a process that never turned tracking on. It is the only way
|
|
156
|
+
* to reach a derivative whose holder cannot be named, which is what makes it
|
|
157
|
+
* more than a convenience: a substring of 13 characters or more pins its
|
|
158
|
+
* parent's entire backing store, so the parent's own `clear()` frees nothing
|
|
159
|
+
* until that substring is cleared too, and the substring is usually a local
|
|
160
|
+
* some function has already dropped.
|
|
161
|
+
*
|
|
162
|
+
* The walk reaches origins and derivatives in whatever order the set holds
|
|
163
|
+
* them, so it clears values whose origin it has already cleared. That is
|
|
164
|
+
* deliberate: `clear()` is idempotent per instance and not per lineage, so a
|
|
165
|
+
* derivative reached after its origin still drops its own copy and releases
|
|
166
|
+
* its own pin.
|
|
167
|
+
*
|
|
168
|
+
* The set is emptied of what this call reached, and is not empty afterwards in
|
|
169
|
+
* any promised sense: entries whose instance has been collected are removed by
|
|
170
|
+
* a `FinalizationRegistry` that needs at least two GC cycles and two macrotask
|
|
171
|
+
* turns to run, and a pass that calls `deref()` on an entry keeps that target
|
|
172
|
+
* alive to the end of the current job. The set's size is a lagging indicator
|
|
173
|
+
* with no bound worth promising.
|
|
174
|
+
*
|
|
175
|
+
* On a `SIGTERM` handler, call it after the drain and not before it: clearing
|
|
176
|
+
* at the top of the handler destroys credentials that in-flight requests are
|
|
177
|
+
* still using. It buys nothing at all if the handler ends in `process.exit()`;
|
|
178
|
+
* what it narrows is the window a process stays alive after draining, where a
|
|
179
|
+
* heap snapshot or a crash dump can still be taken.
|
|
180
|
+
*
|
|
181
|
+
* @returns How many instances were cleared by this call.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* process.on('SIGTERM', async () => {
|
|
186
|
+
* await server.close(); // stop accepting, drain what is in flight
|
|
187
|
+
* await pool.end(); // nothing still needs a credential
|
|
188
|
+
* clearAllSensitiveValues(); // now the values are dead weight
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
function clearAllSensitiveValues() {
|
|
193
|
+
let cleared = 0;
|
|
194
|
+
// A snapshot, not the live set. `clear()` calls the class policy's `redact`,
|
|
195
|
+
// and a policy is caller-supplied code: one that constructs a value of its
|
|
196
|
+
// own while tracking is on would add to the set being iterated, and a `Set`
|
|
197
|
+
// iterator visits what is added during iteration. That is an unbounded loop
|
|
198
|
+
// in a shutdown handler. The copy costs one array on a path that runs once.
|
|
199
|
+
for (const ref of [...exports.hygiene.tracked]) {
|
|
200
|
+
const instance = ref.deref();
|
|
201
|
+
if (instance === undefined) {
|
|
202
|
+
// Cheap, and finds little: a ref whose target was collected before this
|
|
203
|
+
// loop began. Anything collected since is still held by the deref above.
|
|
204
|
+
exports.hygiene.tracked.delete(ref);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
instance.clear();
|
|
208
|
+
exports.hygiene.finalizer.unregister(instance);
|
|
209
|
+
exports.hygiene.tracked.delete(ref);
|
|
210
|
+
cleared++;
|
|
211
|
+
}
|
|
212
|
+
return cleared;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Restore the defaults and forget every tracked instance.
|
|
216
|
+
*
|
|
217
|
+
* Test-only, and gated exactly as `resetPolicies()` is: it undoes process-wide
|
|
218
|
+
* configuration, so a production caller reaching for it is describing a bug.
|
|
219
|
+
* It does not clear the instances it forgets, because forgetting is not
|
|
220
|
+
* destroying and a test that wanted them cleared has
|
|
221
|
+
* {@link clearAllSensitiveValues} for that.
|
|
222
|
+
*
|
|
223
|
+
* The finalizer entries for forgotten instances are left registered. Their
|
|
224
|
+
* callbacks delete a ref from a set that no longer holds it, which costs
|
|
225
|
+
* nothing and is the only alternative to `deref()`ing every entry, which would
|
|
226
|
+
* keep every one of them alive to the end of the turn.
|
|
227
|
+
*/
|
|
228
|
+
function resetMemoryHygiene() {
|
|
229
|
+
exports.hygiene.config = DISABLED;
|
|
230
|
+
exports.hygiene.tracked.clear();
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* How many refs the tracked set currently holds.
|
|
234
|
+
*
|
|
235
|
+
* Not a census of live values, and read it as a ceiling rather than a count.
|
|
236
|
+
* It is `0` in any process that never turned `trackInstances` on, since
|
|
237
|
+
* nothing is tracked there. Where tracking is on it counts every instance
|
|
238
|
+
* built since, minus the ones a `FinalizationRegistry` has already pruned, and
|
|
239
|
+
* that pruning needs at least two GC cycles and two macrotask turns, so a value
|
|
240
|
+
* that became garbage a moment ago is still in this number and there is no
|
|
241
|
+
* bound on how long it stays.
|
|
242
|
+
*
|
|
243
|
+
* Exported because a gauge is the one reader that wants it besides the suite
|
|
244
|
+
* measuring that lag: `@platform-sec/sensitive-string-metrics` publishes it as
|
|
245
|
+
* `sensitive_values_tracked`, under that name rather than an `active` one
|
|
246
|
+
* precisely because the lag makes "active" a claim this number cannot support.
|
|
247
|
+
*
|
|
248
|
+
* There is deliberately no per-class breakdown. Splitting the set by class
|
|
249
|
+
* means calling `deref()` on every entry, and a `deref()` that returns an
|
|
250
|
+
* instance keeps that instance alive to the end of the current job, so a
|
|
251
|
+
* gauge scraped every fifteen seconds would extend the life of everything it
|
|
252
|
+
* measured.
|
|
253
|
+
*/
|
|
254
|
+
function trackedInstanceCount() {
|
|
255
|
+
return exports.hygiene.tracked.size;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=hygiene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hygiene.js","sourceRoot":"","sources":["../src/hygiene.ts"],"names":[],"mappings":";;;AAmKA,sCAIC;AAyCD,4CAiBC;AASD,4CAGC;AA2CD,0DAyBC;AAgBD,gDAGC;AAwBD,oDAEC;AA9VD,uDAAuD;AACvD,2CAAmD;AAInD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,gCAAoB;IAKvD;IACA;IACA;IANO,IAAI,GAAG,4BAA4B,CAAC;IACpC,IAAI,GAAG,eAAe,CAAC;IAEzC,YACW,SAAe,EACf,WAAiB,EACjB,KAAc;QAEvB,KAAK,CACH,kBAAkB,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,kBAAkB;YAC1E,SAAS,CAAC,WAAW,EAAE,CAC1B,CAAC;QAPO,cAAS,GAAT,SAAS,CAAM;QACf,gBAAW,GAAX,WAAW,CAAM;QACjB,UAAK,GAAL,KAAK,CAAS;IAMzB,CAAC;IAED,+DAA+D;IAC/D,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CA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,eAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QAED,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjB,eAAO,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACvC,eAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,kBAAkB;IAChC,eAAO,CAAC,MAAM,GAAG,QAAQ,CAAC;IAC1B,eAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,oBAAoB;IAClC,OAAO,eAAO,CAAC,OAAO,CAAC,IAAI,CAAC;AAC9B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @platform-sec/sensitive-string-core
|
|
3
|
+
*
|
|
4
|
+
* Enterprise-grade library for handling sensitive string data in Node.js.
|
|
5
|
+
*
|
|
6
|
+
* Features:
|
|
7
|
+
* - Automatic redaction in logging, serialization, and display
|
|
8
|
+
* - Type-safe sensitivity classification
|
|
9
|
+
* - Explicit reveal with audit hooks
|
|
10
|
+
* - Partial masking for support, debugging, and user confirmation
|
|
11
|
+
* - Constant-time comparison for credentials
|
|
12
|
+
* - AsyncLocalStorage context propagation
|
|
13
|
+
* - An explicit handoff across worker threads and child processes
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { SensitiveString, safeLog, withRevealContext } from '@platform-sec/sensitive-string-core';
|
|
18
|
+
*
|
|
19
|
+
* // Create a sensitive value
|
|
20
|
+
* const apiKey = new SensitiveString(process.env.API_KEY!, 'credential', 'api_key');
|
|
21
|
+
*
|
|
22
|
+
* // Safe for logging
|
|
23
|
+
* console.log('Authenticating with', apiKey);
|
|
24
|
+
* // Output: Authenticating with SensitiveString<credential:api_key> { [REDACTED:credential] }
|
|
25
|
+
*
|
|
26
|
+
* // Explicit reveal with audit
|
|
27
|
+
* await withRevealContext({ name: 'api-call', reason: 'authenticate' }, async () => {
|
|
28
|
+
* const raw = apiKey.reveal();
|
|
29
|
+
* await callApi(raw);
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @packageDocumentation
|
|
34
|
+
*/
|
|
35
|
+
export type { SensitivityClass, SensitivityPolicy, SensitivityAdvisory, SensitiveStringOptions, SerializedSensitiveString, MaskOptions, MaskStrategy, MaskAuditDetails, HashAlgorithm, HashEncoding, HashOptions, HashAuditDetails, HmacOptions, HmacAuditDetails, RenewalOptions, RenewAuditDetails, ClearAuditDetails, AuditContext, RevealAccess, RevealAuditDetails, RevealContext, RevealDetails, RevocationRegistry, RevocationScope, EnvironmentInfo, EnvironmentRestrictions, SerializedEnvironmentRestrictions, DestinationBinding, SerializedDestinationBinding, RevokeAuditDetails, WorkerHandoffAuditDetails, ISensitiveString, } from './types.js';
|
|
36
|
+
export { SENSITIVITY_PRECEDENCE } from './types.js';
|
|
37
|
+
export { SensitiveString } from './sensitive-string.js';
|
|
38
|
+
export { SensitiveStringError } from './errors.js';
|
|
39
|
+
export { ExpiredSensitiveValueError, RenewalNotAllowedError } from './ttl.js';
|
|
40
|
+
export { RevealDuringRedactionError } from './redaction-scope.js';
|
|
41
|
+
export { SensitiveBsonError } from './bson.js';
|
|
42
|
+
export type { RenewalRefusal } from './ttl.js';
|
|
43
|
+
export { RevealLimitExceededError, RevealRateLimitError } from './reveal-budget.js';
|
|
44
|
+
export { RevokedSensitiveValueError, RevocationList, revokeByLabel, revokeByPattern, pruneRevocations, revocationCount, } from './revocation.js';
|
|
45
|
+
export type { RevocationRecord } from './revocation.js';
|
|
46
|
+
export { setEnvironmentInfo, getEnvironmentInfo, lockEnvironmentInfo, isEnvironmentLocked, resetEnvironmentInfo, EnvironmentRestrictedError, EnvironmentLockedError, UnserializableRestrictionError, } from './environment.js';
|
|
47
|
+
export type { RestrictionKind } from './environment.js';
|
|
48
|
+
export { DestinationRestrictedError } from './destination.js';
|
|
49
|
+
export type { DestinationKind } from './destination.js';
|
|
50
|
+
export { UnreleasedSensitiveValueError } from './release.js';
|
|
51
|
+
export type { ReleaseStatus } from './release.js';
|
|
52
|
+
export { toWorkerPayload, fromWorkerPayload, withWorkerPayload, MalformedWorkerPayloadError, ConsumedWorkerPayloadError, MissingWorkerValueError, UnregisteredClassError, UnauditedWorkerError, UnportableDataError, UnshareableConstraintError, } from './worker.js';
|
|
53
|
+
export type { WorkerTransport, SensitiveValues, AnySensitiveValues, PortableRevealContext, WorkerPayloadOptions, WorkerPayloadValues, WorkerPayload, FromWorkerPayloadOptions, ReceivedWorkerPayload, } from './worker.js';
|
|
54
|
+
export { REFERENCE_VERSION, carriesReferenceMarker, isSensitiveValueReference, referenceFormatVersion, } from './reference.js';
|
|
55
|
+
export type { SensitiveValueReference } from './reference.js';
|
|
56
|
+
export { clearAllSensitiveValues, setMemoryHygiene, getMemoryHygiene, resetMemoryHygiene, trackedInstanceCount, ClearedSensitiveValueError, } from './hygiene.js';
|
|
57
|
+
export type { MemoryHygieneConfig } from './hygiene.js';
|
|
58
|
+
export { setSealing, getSealing, resetSealing, destroySealingKey, SealingUnavailableError, SealingKeyDestroyedError, SealedValueIntegrityError, } from './sealing.js';
|
|
59
|
+
export type { SealingConfig } from './sealing.js';
|
|
60
|
+
export { setDevMode, getDevModeConfig, withDevMode } from './dev-mode.js';
|
|
61
|
+
export type { DevModeConfig, DevInfo, RepeatedRevealOptions, RevealLogOptions, } from './dev-mode.js';
|
|
62
|
+
export { observeRedactions } from './redaction-observer.js';
|
|
63
|
+
export type { RedactionEvent, RedactionObserver, RedactionSurface } from './redaction-observer.js';
|
|
64
|
+
export { patterns } from './patterns.js';
|
|
65
|
+
export { deriveKeyedToken, assertKeyedDerivationOptions, DEFAULT_DERIVED_TOKEN_LENGTH, MIN_DERIVED_TOKEN_LENGTH, MAX_DERIVED_TOKEN_LENGTH, MIN_DERIVATION_KEY_BYTES, } from './derive.js';
|
|
66
|
+
export type { KeyedDerivationOptions } from './derive.js';
|
|
67
|
+
export { createDeterministicRedactor, deterministicRedaction, DeterministicRedactionNotAllowedError, } from './deterministic.js';
|
|
68
|
+
export type { DeterministicRedactorOptions } from './deterministic.js';
|
|
69
|
+
export { sensitiveTemplate, st } from './template.js';
|
|
70
|
+
export type { TemplateValue, SensitiveTemplateOptions, SensitiveTemplateTag } from './template.js';
|
|
71
|
+
export { registerPolicy, getPolicy, getDefaultPolicy, hasPolicy, getRegisteredClasses, resetPolicies, defaultCombineClasses, policyRegistryVersion, } from './policy.js';
|
|
72
|
+
export type { RegisterPolicyOptions } from './policy.js';
|
|
73
|
+
export { containsRedactionMarker, redactionMatchers, resetRedactionMarkerCache, MARKER_PREFIX, } from './redaction-marker.js';
|
|
74
|
+
export { withRevealContext, getCurrentRevealContext, createChildContext, withAuditedReveals, } from './context.js';
|
|
75
|
+
export { UNREADABLE } from './probe.js';
|
|
76
|
+
export { redactInStructure, safeLog, safeStringify, createSensitiveSerializer, containsSensitive, sensitiveClassesIn, } from './redact.js';
|
|
77
|
+
export type { SafeStringifyOptions } from './redact.js';
|
|
78
|
+
export { redactCopy } from './redact-copy.js';
|
|
79
|
+
export { sensitiveFormat } from './winston.js';
|
|
80
|
+
export type { SensitiveFormatOptions, WinstonFormat, WinstonInfo } from './winston.js';
|
|
81
|
+
export { compileClassification, classifyField } from './classification.js';
|
|
82
|
+
export type { FieldClass, ClassificationRule, ClassificationSpec, CompiledClassification, } from './classification.js';
|
|
83
|
+
export { wrapSensitiveByPath, unwrapSensitiveByPath, validateSensitiveFieldConfig, checkSensitiveFieldsWrapped, wrapSensitiveByClassification, checkClassifiedFieldsWrapped, } from './wrap.js';
|
|
84
|
+
export type { SensitiveFieldConfig, SensitiveFieldOptions, WrappedResult, ClassifiedWrapOptions, } from './wrap.js';
|
|
85
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,iCAAiC,EACjC,kBAAkB,EAClB,4BAA4B,EAC5B,kBAAkB,EAClB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAIlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGpF,OAAO,EACL,0BAA0B,EAC1B,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MA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BAAkB,GACnB,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EACL,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIvF,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,qBAAqB,GACtB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @platform-sec/sensitive-string-core
|
|
4
|
+
*
|
|
5
|
+
* Enterprise-grade library for handling sensitive string data in Node.js.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Automatic redaction in logging, serialization, and display
|
|
9
|
+
* - Type-safe sensitivity classification
|
|
10
|
+
* - Explicit reveal with audit hooks
|
|
11
|
+
* - Partial masking for support, debugging, and user confirmation
|
|
12
|
+
* - Constant-time comparison for credentials
|
|
13
|
+
* - AsyncLocalStorage context propagation
|
|
14
|
+
* - An explicit handoff across worker threads and child processes
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { SensitiveString, safeLog, withRevealContext } from '@platform-sec/sensitive-string-core';
|
|
19
|
+
*
|
|
20
|
+
* // Create a sensitive value
|
|
21
|
+
* const apiKey = new SensitiveString(process.env.API_KEY!, 'credential', 'api_key');
|
|
22
|
+
*
|
|
23
|
+
* // Safe for logging
|
|
24
|
+
* console.log('Authenticating with', apiKey);
|
|
25
|
+
* // Output: Authenticating with SensitiveString<credential:api_key> { [REDACTED:credential] }
|
|
26
|
+
*
|
|
27
|
+
* // Explicit reveal with audit
|
|
28
|
+
* await withRevealContext({ name: 'api-call', reason: 'authenticate' }, async () => {
|
|
29
|
+
* const raw = apiKey.reveal();
|
|
30
|
+
* await callApi(raw);
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.SealingUnavailableError = exports.destroySealingKey = exports.resetSealing = exports.getSealing = exports.setSealing = exports.ClearedSensitiveValueError = exports.trackedInstanceCount = exports.resetMemoryHygiene = exports.getMemoryHygiene = exports.setMemoryHygiene = exports.clearAllSensitiveValues = exports.referenceFormatVersion = exports.isSensitiveValueReference = exports.carriesReferenceMarker = exports.REFERENCE_VERSION = exports.UnshareableConstraintError = exports.UnportableDataError = exports.UnauditedWorkerError = exports.UnregisteredClassError = exports.MissingWorkerValueError = exports.ConsumedWorkerPayloadError = exports.MalformedWorkerPayloadError = exports.withWorkerPayload = exports.fromWorkerPayload = exports.toWorkerPayload = exports.UnreleasedSensitiveValueError = exports.DestinationRestrictedError = exports.UnserializableRestrictionError = exports.EnvironmentLockedError = exports.EnvironmentRestrictedError = exports.resetEnvironmentInfo = exports.isEnvironmentLocked = exports.lockEnvironmentInfo = exports.getEnvironmentInfo = exports.setEnvironmentInfo = exports.revocationCount = exports.pruneRevocations = exports.revokeByPattern = exports.revokeByLabel = exports.RevocationList = exports.RevokedSensitiveValueError = exports.RevealRateLimitError = exports.RevealLimitExceededError = exports.SensitiveBsonError = exports.RevealDuringRedactionError = exports.RenewalNotAllowedError = exports.ExpiredSensitiveValueError = exports.SensitiveStringError = exports.SensitiveString = exports.SENSITIVITY_PRECEDENCE = void 0;
|
|
38
|
+
exports.wrapSensitiveByClassification = exports.checkSensitiveFieldsWrapped = exports.validateSensitiveFieldConfig = exports.unwrapSensitiveByPath = exports.wrapSensitiveByPath = exports.classifyField = exports.compileClassification = exports.sensitiveFormat = exports.redactCopy = exports.sensitiveClassesIn = exports.containsSensitive = exports.createSensitiveSerializer = exports.safeStringify = exports.safeLog = exports.redactInStructure = exports.UNREADABLE = exports.withAuditedReveals = exports.createChildContext = exports.getCurrentRevealContext = exports.withRevealContext = exports.MARKER_PREFIX = exports.resetRedactionMarkerCache = exports.redactionMatchers = exports.containsRedactionMarker = exports.policyRegistryVersion = exports.defaultCombineClasses = exports.resetPolicies = exports.getRegisteredClasses = exports.hasPolicy = exports.getDefaultPolicy = exports.getPolicy = exports.registerPolicy = exports.st = exports.sensitiveTemplate = exports.DeterministicRedactionNotAllowedError = exports.deterministicRedaction = exports.createDeterministicRedactor = exports.MIN_DERIVATION_KEY_BYTES = exports.MAX_DERIVED_TOKEN_LENGTH = exports.MIN_DERIVED_TOKEN_LENGTH = exports.DEFAULT_DERIVED_TOKEN_LENGTH = exports.assertKeyedDerivationOptions = exports.deriveKeyedToken = exports.patterns = exports.observeRedactions = exports.withDevMode = exports.getDevModeConfig = exports.setDevMode = exports.SealedValueIntegrityError = exports.SealingKeyDestroyedError = void 0;
|
|
39
|
+
exports.checkClassifiedFieldsWrapped = void 0;
|
|
40
|
+
var types_js_1 = require("./types.js");
|
|
41
|
+
Object.defineProperty(exports, "SENSITIVITY_PRECEDENCE", { enumerable: true, get: function () { return types_js_1.SENSITIVITY_PRECEDENCE; } });
|
|
42
|
+
// Main class
|
|
43
|
+
var sensitive_string_js_1 = require("./sensitive-string.js");
|
|
44
|
+
Object.defineProperty(exports, "SensitiveString", { enumerable: true, get: function () { return sensitive_string_js_1.SensitiveString; } });
|
|
45
|
+
// The base every refusal extends, so a caller can catch any of them at once
|
|
46
|
+
var errors_js_1 = require("./errors.js");
|
|
47
|
+
Object.defineProperty(exports, "SensitiveStringError", { enumerable: true, get: function () { return errors_js_1.SensitiveStringError; } });
|
|
48
|
+
// Expiration
|
|
49
|
+
var ttl_js_1 = require("./ttl.js");
|
|
50
|
+
Object.defineProperty(exports, "ExpiredSensitiveValueError", { enumerable: true, get: function () { return ttl_js_1.ExpiredSensitiveValueError; } });
|
|
51
|
+
Object.defineProperty(exports, "RenewalNotAllowedError", { enumerable: true, get: function () { return ttl_js_1.RenewalNotAllowedError; } });
|
|
52
|
+
var redaction_scope_js_1 = require("./redaction-scope.js");
|
|
53
|
+
Object.defineProperty(exports, "RevealDuringRedactionError", { enumerable: true, get: function () { return redaction_scope_js_1.RevealDuringRedactionError; } });
|
|
54
|
+
// BSON refusal. on the class throws this; BSON honours toBSON() and
|
|
55
|
+
// ignores toJSON(), so without it a Mongo write silently persists the husk.
|
|
56
|
+
var bson_js_1 = require("./bson.js");
|
|
57
|
+
Object.defineProperty(exports, "SensitiveBsonError", { enumerable: true, get: function () { return bson_js_1.SensitiveBsonError; } });
|
|
58
|
+
// Reveal limits and rate limiting
|
|
59
|
+
var reveal_budget_js_1 = require("./reveal-budget.js");
|
|
60
|
+
Object.defineProperty(exports, "RevealLimitExceededError", { enumerable: true, get: function () { return reveal_budget_js_1.RevealLimitExceededError; } });
|
|
61
|
+
Object.defineProperty(exports, "RevealRateLimitError", { enumerable: true, get: function () { return reveal_budget_js_1.RevealRateLimitError; } });
|
|
62
|
+
// Revocation
|
|
63
|
+
var revocation_js_1 = require("./revocation.js");
|
|
64
|
+
Object.defineProperty(exports, "RevokedSensitiveValueError", { enumerable: true, get: function () { return revocation_js_1.RevokedSensitiveValueError; } });
|
|
65
|
+
Object.defineProperty(exports, "RevocationList", { enumerable: true, get: function () { return revocation_js_1.RevocationList; } });
|
|
66
|
+
Object.defineProperty(exports, "revokeByLabel", { enumerable: true, get: function () { return revocation_js_1.revokeByLabel; } });
|
|
67
|
+
Object.defineProperty(exports, "revokeByPattern", { enumerable: true, get: function () { return revocation_js_1.revokeByPattern; } });
|
|
68
|
+
Object.defineProperty(exports, "pruneRevocations", { enumerable: true, get: function () { return revocation_js_1.pruneRevocations; } });
|
|
69
|
+
Object.defineProperty(exports, "revocationCount", { enumerable: true, get: function () { return revocation_js_1.revocationCount; } });
|
|
70
|
+
// Environment and region restrictions. The environment is process-global
|
|
71
|
+
// configuration under rule R6: it protects against a value being deployed
|
|
72
|
+
// somewhere it was not meant to run, not against a caller who wants it.
|
|
73
|
+
var environment_js_1 = require("./environment.js");
|
|
74
|
+
Object.defineProperty(exports, "setEnvironmentInfo", { enumerable: true, get: function () { return environment_js_1.setEnvironmentInfo; } });
|
|
75
|
+
Object.defineProperty(exports, "getEnvironmentInfo", { enumerable: true, get: function () { return environment_js_1.getEnvironmentInfo; } });
|
|
76
|
+
Object.defineProperty(exports, "lockEnvironmentInfo", { enumerable: true, get: function () { return environment_js_1.lockEnvironmentInfo; } });
|
|
77
|
+
Object.defineProperty(exports, "isEnvironmentLocked", { enumerable: true, get: function () { return environment_js_1.isEnvironmentLocked; } });
|
|
78
|
+
Object.defineProperty(exports, "resetEnvironmentInfo", { enumerable: true, get: function () { return environment_js_1.resetEnvironmentInfo; } });
|
|
79
|
+
Object.defineProperty(exports, "EnvironmentRestrictedError", { enumerable: true, get: function () { return environment_js_1.EnvironmentRestrictedError; } });
|
|
80
|
+
Object.defineProperty(exports, "EnvironmentLockedError", { enumerable: true, get: function () { return environment_js_1.EnvironmentLockedError; } });
|
|
81
|
+
Object.defineProperty(exports, "UnserializableRestrictionError", { enumerable: true, get: function () { return environment_js_1.UnserializableRestrictionError; } });
|
|
82
|
+
// Destination binding: a value says which sinks and hosts it may be revealed
|
|
83
|
+
// toward, and the gate checks the reveal context's `sink` and `host` tags. The
|
|
84
|
+
// complement of the environment restrictions above: those ask where the
|
|
85
|
+
// process is, this asks where the plaintext is going.
|
|
86
|
+
var destination_js_1 = require("./destination.js");
|
|
87
|
+
Object.defineProperty(exports, "DestinationRestrictedError", { enumerable: true, get: function () { return destination_js_1.DestinationRestrictedError; } });
|
|
88
|
+
// A reveal that waits on a verification: the value is constructed with the
|
|
89
|
+
// check in flight and refuses every exposing read until the check says yes,
|
|
90
|
+
// for good if it says anything else.
|
|
91
|
+
var release_js_1 = require("./release.js");
|
|
92
|
+
Object.defineProperty(exports, "UnreleasedSensitiveValueError", { enumerable: true, get: function () { return release_js_1.UnreleasedSensitiveValueError; } });
|
|
93
|
+
// Worker thread and child process handoff
|
|
94
|
+
var worker_js_1 = require("./worker.js");
|
|
95
|
+
Object.defineProperty(exports, "toWorkerPayload", { enumerable: true, get: function () { return worker_js_1.toWorkerPayload; } });
|
|
96
|
+
Object.defineProperty(exports, "fromWorkerPayload", { enumerable: true, get: function () { return worker_js_1.fromWorkerPayload; } });
|
|
97
|
+
Object.defineProperty(exports, "withWorkerPayload", { enumerable: true, get: function () { return worker_js_1.withWorkerPayload; } });
|
|
98
|
+
Object.defineProperty(exports, "MalformedWorkerPayloadError", { enumerable: true, get: function () { return worker_js_1.MalformedWorkerPayloadError; } });
|
|
99
|
+
Object.defineProperty(exports, "ConsumedWorkerPayloadError", { enumerable: true, get: function () { return worker_js_1.ConsumedWorkerPayloadError; } });
|
|
100
|
+
Object.defineProperty(exports, "MissingWorkerValueError", { enumerable: true, get: function () { return worker_js_1.MissingWorkerValueError; } });
|
|
101
|
+
Object.defineProperty(exports, "UnregisteredClassError", { enumerable: true, get: function () { return worker_js_1.UnregisteredClassError; } });
|
|
102
|
+
Object.defineProperty(exports, "UnauditedWorkerError", { enumerable: true, get: function () { return worker_js_1.UnauditedWorkerError; } });
|
|
103
|
+
Object.defineProperty(exports, "UnportableDataError", { enumerable: true, get: function () { return worker_js_1.UnportableDataError; } });
|
|
104
|
+
Object.defineProperty(exports, "UnshareableConstraintError", { enumerable: true, get: function () { return worker_js_1.UnshareableConstraintError; } });
|
|
105
|
+
// The reference wire format. Minting and resolving live in
|
|
106
|
+
// `@platform-sec/sensitive-string-secrets`, which is the layer that knows the
|
|
107
|
+
// store, the version and the credentials; the format lives here because the
|
|
108
|
+
// walks that meet one on the way to a log line do.
|
|
109
|
+
var reference_js_1 = require("./reference.js");
|
|
110
|
+
Object.defineProperty(exports, "REFERENCE_VERSION", { enumerable: true, get: function () { return reference_js_1.REFERENCE_VERSION; } });
|
|
111
|
+
Object.defineProperty(exports, "carriesReferenceMarker", { enumerable: true, get: function () { return reference_js_1.carriesReferenceMarker; } });
|
|
112
|
+
Object.defineProperty(exports, "isSensitiveValueReference", { enumerable: true, get: function () { return reference_js_1.isSensitiveValueReference; } });
|
|
113
|
+
Object.defineProperty(exports, "referenceFormatVersion", { enumerable: true, get: function () { return reference_js_1.referenceFormatVersion; } });
|
|
114
|
+
// Memory hygiene. `clear()` drops the library's reference to the plaintext and
|
|
115
|
+
// nothing else: JavaScript cannot zero a string, and whether the library held
|
|
116
|
+
// the last reference is a property of the calling code. The two switches are
|
|
117
|
+
// process-global under rule R6, both off by default, and both read at
|
|
118
|
+
// construction.
|
|
119
|
+
var hygiene_js_1 = require("./hygiene.js");
|
|
120
|
+
Object.defineProperty(exports, "clearAllSensitiveValues", { enumerable: true, get: function () { return hygiene_js_1.clearAllSensitiveValues; } });
|
|
121
|
+
Object.defineProperty(exports, "setMemoryHygiene", { enumerable: true, get: function () { return hygiene_js_1.setMemoryHygiene; } });
|
|
122
|
+
Object.defineProperty(exports, "getMemoryHygiene", { enumerable: true, get: function () { return hygiene_js_1.getMemoryHygiene; } });
|
|
123
|
+
Object.defineProperty(exports, "resetMemoryHygiene", { enumerable: true, get: function () { return hygiene_js_1.resetMemoryHygiene; } });
|
|
124
|
+
Object.defineProperty(exports, "trackedInstanceCount", { enumerable: true, get: function () { return hygiene_js_1.trackedInstanceCount; } });
|
|
125
|
+
Object.defineProperty(exports, "ClearedSensitiveValueError", { enumerable: true, get: function () { return hygiene_js_1.ClearedSensitiveValueError; } });
|
|
126
|
+
// Sealing: holding the value as AES-256-GCM ciphertext in a Buffer rather than
|
|
127
|
+
// as a string. Not encryption at rest, and encryption is not even what keeps a
|
|
128
|
+
// sealed value out of a heap snapshot, which a plain Buffer does on its own.
|
|
129
|
+
// What the key adds is that destroying it makes every sealed value in the
|
|
130
|
+
// process unreadable at once, and that a byte-oriented store lets `clear()` and
|
|
131
|
+
// `equals()` leave nothing behind. Off by default, per value or per process,
|
|
132
|
+
// and `sealed` is documented with the cost it carries.
|
|
133
|
+
var sealing_js_1 = require("./sealing.js");
|
|
134
|
+
Object.defineProperty(exports, "setSealing", { enumerable: true, get: function () { return sealing_js_1.setSealing; } });
|
|
135
|
+
Object.defineProperty(exports, "getSealing", { enumerable: true, get: function () { return sealing_js_1.getSealing; } });
|
|
136
|
+
Object.defineProperty(exports, "resetSealing", { enumerable: true, get: function () { return sealing_js_1.resetSealing; } });
|
|
137
|
+
Object.defineProperty(exports, "destroySealingKey", { enumerable: true, get: function () { return sealing_js_1.destroySealingKey; } });
|
|
138
|
+
Object.defineProperty(exports, "SealingUnavailableError", { enumerable: true, get: function () { return sealing_js_1.SealingUnavailableError; } });
|
|
139
|
+
Object.defineProperty(exports, "SealingKeyDestroyedError", { enumerable: true, get: function () { return sealing_js_1.SealingKeyDestroyedError; } });
|
|
140
|
+
Object.defineProperty(exports, "SealedValueIntegrityError", { enumerable: true, get: function () { return sealing_js_1.SealedValueIntegrityError; } });
|
|
141
|
+
// Development mode
|
|
142
|
+
var dev_mode_js_1 = require("./dev-mode.js");
|
|
143
|
+
Object.defineProperty(exports, "setDevMode", { enumerable: true, get: function () { return dev_mode_js_1.setDevMode; } });
|
|
144
|
+
Object.defineProperty(exports, "getDevModeConfig", { enumerable: true, get: function () { return dev_mode_js_1.getDevModeConfig; } });
|
|
145
|
+
Object.defineProperty(exports, "withDevMode", { enumerable: true, get: function () { return dev_mode_js_1.withDevMode; } });
|
|
146
|
+
// Redaction observers. A reveal is audited; a redaction was not recorded
|
|
147
|
+
// anywhere, and it is the number that says what the library prevented: every
|
|
148
|
+
// rendering of a marker is a place a plain string would have been written.
|
|
149
|
+
// The event carries the class, the label and the surface, never the value or
|
|
150
|
+
// its rendering, and an unobserved process pays one length read per rendering.
|
|
151
|
+
var redaction_observer_js_1 = require("./redaction-observer.js");
|
|
152
|
+
Object.defineProperty(exports, "observeRedactions", { enumerable: true, get: function () { return redaction_observer_js_1.observeRedactions; } });
|
|
153
|
+
// Anchored patterns for common sensitive-value formats
|
|
154
|
+
var patterns_js_1 = require("./patterns.js");
|
|
155
|
+
Object.defineProperty(exports, "patterns", { enumerable: true, get: function () { return patterns_js_1.patterns; } });
|
|
156
|
+
// Keyed derivation, shared by deterministic redaction and by LLM entity
|
|
157
|
+
// handles. One implementation, because a truncated keyed HMAC over a
|
|
158
|
+
// low-entropy value has exactly one correct shape.
|
|
159
|
+
var derive_js_1 = require("./derive.js");
|
|
160
|
+
Object.defineProperty(exports, "deriveKeyedToken", { enumerable: true, get: function () { return derive_js_1.deriveKeyedToken; } });
|
|
161
|
+
Object.defineProperty(exports, "assertKeyedDerivationOptions", { enumerable: true, get: function () { return derive_js_1.assertKeyedDerivationOptions; } });
|
|
162
|
+
Object.defineProperty(exports, "DEFAULT_DERIVED_TOKEN_LENGTH", { enumerable: true, get: function () { return derive_js_1.DEFAULT_DERIVED_TOKEN_LENGTH; } });
|
|
163
|
+
Object.defineProperty(exports, "MIN_DERIVED_TOKEN_LENGTH", { enumerable: true, get: function () { return derive_js_1.MIN_DERIVED_TOKEN_LENGTH; } });
|
|
164
|
+
Object.defineProperty(exports, "MAX_DERIVED_TOKEN_LENGTH", { enumerable: true, get: function () { return derive_js_1.MAX_DERIVED_TOKEN_LENGTH; } });
|
|
165
|
+
Object.defineProperty(exports, "MIN_DERIVATION_KEY_BYTES", { enumerable: true, get: function () { return derive_js_1.MIN_DERIVATION_KEY_BYTES; } });
|
|
166
|
+
// Deterministic redaction, the first caller of that derivation inside core. It
|
|
167
|
+
// changes what redacted output means, so it is opt-in through a registered
|
|
168
|
+
// policy and never a default.
|
|
169
|
+
var deterministic_js_1 = require("./deterministic.js");
|
|
170
|
+
Object.defineProperty(exports, "createDeterministicRedactor", { enumerable: true, get: function () { return deterministic_js_1.createDeterministicRedactor; } });
|
|
171
|
+
Object.defineProperty(exports, "deterministicRedaction", { enumerable: true, get: function () { return deterministic_js_1.deterministicRedaction; } });
|
|
172
|
+
Object.defineProperty(exports, "DeterministicRedactionNotAllowedError", { enumerable: true, get: function () { return deterministic_js_1.DeterministicRedactionNotAllowedError; } });
|
|
173
|
+
// Template literals
|
|
174
|
+
var template_js_1 = require("./template.js");
|
|
175
|
+
Object.defineProperty(exports, "sensitiveTemplate", { enumerable: true, get: function () { return template_js_1.sensitiveTemplate; } });
|
|
176
|
+
Object.defineProperty(exports, "st", { enumerable: true, get: function () { return template_js_1.st; } });
|
|
177
|
+
// Policy management
|
|
178
|
+
var policy_js_1 = require("./policy.js");
|
|
179
|
+
Object.defineProperty(exports, "registerPolicy", { enumerable: true, get: function () { return policy_js_1.registerPolicy; } });
|
|
180
|
+
Object.defineProperty(exports, "getPolicy", { enumerable: true, get: function () { return policy_js_1.getPolicy; } });
|
|
181
|
+
Object.defineProperty(exports, "getDefaultPolicy", { enumerable: true, get: function () { return policy_js_1.getDefaultPolicy; } });
|
|
182
|
+
Object.defineProperty(exports, "hasPolicy", { enumerable: true, get: function () { return policy_js_1.hasPolicy; } });
|
|
183
|
+
Object.defineProperty(exports, "getRegisteredClasses", { enumerable: true, get: function () { return policy_js_1.getRegisteredClasses; } });
|
|
184
|
+
Object.defineProperty(exports, "resetPolicies", { enumerable: true, get: function () { return policy_js_1.resetPolicies; } });
|
|
185
|
+
Object.defineProperty(exports, "defaultCombineClasses", { enumerable: true, get: function () { return policy_js_1.defaultCombineClasses; } });
|
|
186
|
+
Object.defineProperty(exports, "policyRegistryVersion", { enumerable: true, get: function () { return policy_js_1.policyRegistryVersion; } });
|
|
187
|
+
// Recognizing this library's own redacted output, for the guards that refuse to
|
|
188
|
+
// hand a redaction onward: a write that would persist one, a request body that
|
|
189
|
+
// would transmit one, a column read that hands one back as if it were a value.
|
|
190
|
+
var redaction_marker_js_1 = require("./redaction-marker.js");
|
|
191
|
+
Object.defineProperty(exports, "containsRedactionMarker", { enumerable: true, get: function () { return redaction_marker_js_1.containsRedactionMarker; } });
|
|
192
|
+
Object.defineProperty(exports, "redactionMatchers", { enumerable: true, get: function () { return redaction_marker_js_1.redactionMatchers; } });
|
|
193
|
+
Object.defineProperty(exports, "resetRedactionMarkerCache", { enumerable: true, get: function () { return redaction_marker_js_1.resetRedactionMarkerCache; } });
|
|
194
|
+
Object.defineProperty(exports, "MARKER_PREFIX", { enumerable: true, get: function () { return redaction_marker_js_1.MARKER_PREFIX; } });
|
|
195
|
+
// Context management
|
|
196
|
+
var context_js_1 = require("./context.js");
|
|
197
|
+
Object.defineProperty(exports, "withRevealContext", { enumerable: true, get: function () { return context_js_1.withRevealContext; } });
|
|
198
|
+
Object.defineProperty(exports, "getCurrentRevealContext", { enumerable: true, get: function () { return context_js_1.getCurrentRevealContext; } });
|
|
199
|
+
Object.defineProperty(exports, "createChildContext", { enumerable: true, get: function () { return context_js_1.createChildContext; } });
|
|
200
|
+
Object.defineProperty(exports, "withAuditedReveals", { enumerable: true, get: function () { return context_js_1.withAuditedReveals; } });
|
|
201
|
+
// The marker a redaction substitutes for an object it could not read at all.
|
|
202
|
+
// Exported because it appears in output, so a caller asserting on redacted
|
|
203
|
+
// values needs a name for it rather than a string literal.
|
|
204
|
+
var probe_js_1 = require("./probe.js");
|
|
205
|
+
Object.defineProperty(exports, "UNREADABLE", { enumerable: true, get: function () { return probe_js_1.UNREADABLE; } });
|
|
206
|
+
// Redaction helpers
|
|
207
|
+
var redact_js_1 = require("./redact.js");
|
|
208
|
+
Object.defineProperty(exports, "redactInStructure", { enumerable: true, get: function () { return redact_js_1.redactInStructure; } });
|
|
209
|
+
Object.defineProperty(exports, "safeLog", { enumerable: true, get: function () { return redact_js_1.safeLog; } });
|
|
210
|
+
Object.defineProperty(exports, "safeStringify", { enumerable: true, get: function () { return redact_js_1.safeStringify; } });
|
|
211
|
+
Object.defineProperty(exports, "createSensitiveSerializer", { enumerable: true, get: function () { return redact_js_1.createSensitiveSerializer; } });
|
|
212
|
+
Object.defineProperty(exports, "containsSensitive", { enumerable: true, get: function () { return redact_js_1.containsSensitive; } });
|
|
213
|
+
Object.defineProperty(exports, "sensitiveClassesIn", { enumerable: true, get: function () { return redact_js_1.sensitiveClassesIn; } });
|
|
214
|
+
var redact_copy_js_1 = require("./redact-copy.js");
|
|
215
|
+
Object.defineProperty(exports, "redactCopy", { enumerable: true, get: function () { return redact_copy_js_1.redactCopy; } });
|
|
216
|
+
// Winston format
|
|
217
|
+
var winston_js_1 = require("./winston.js");
|
|
218
|
+
Object.defineProperty(exports, "sensitiveFormat", { enumerable: true, get: function () { return winston_js_1.sensitiveFormat; } });
|
|
219
|
+
// Field classification, shared by the integrations that decide which keys of a
|
|
220
|
+
// decoded payload get wrapped
|
|
221
|
+
var classification_js_1 = require("./classification.js");
|
|
222
|
+
Object.defineProperty(exports, "compileClassification", { enumerable: true, get: function () { return classification_js_1.compileClassification; } });
|
|
223
|
+
Object.defineProperty(exports, "classifyField", { enumerable: true, get: function () { return classification_js_1.classifyField; } });
|
|
224
|
+
// Bulk wrapping: by an enumerated path list when the payload's shape is known,
|
|
225
|
+
// and by classification when its keys are not the caller's to enumerate
|
|
226
|
+
var wrap_js_1 = require("./wrap.js");
|
|
227
|
+
Object.defineProperty(exports, "wrapSensitiveByPath", { enumerable: true, get: function () { return wrap_js_1.wrapSensitiveByPath; } });
|
|
228
|
+
Object.defineProperty(exports, "unwrapSensitiveByPath", { enumerable: true, get: function () { return wrap_js_1.unwrapSensitiveByPath; } });
|
|
229
|
+
Object.defineProperty(exports, "validateSensitiveFieldConfig", { enumerable: true, get: function () { return wrap_js_1.validateSensitiveFieldConfig; } });
|
|
230
|
+
Object.defineProperty(exports, "checkSensitiveFieldsWrapped", { enumerable: true, get: function () { return wrap_js_1.checkSensitiveFieldsWrapped; } });
|
|
231
|
+
Object.defineProperty(exports, "wrapSensitiveByClassification", { enumerable: true, get: function () { return wrap_js_1.wrapSensitiveByClassification; } });
|
|
232
|
+
Object.defineProperty(exports, "checkClassifiedFieldsWrapped", { enumerable: true, get: function () { return wrap_js_1.checkClassifiedFieldsWrapped; } });
|
|
233
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;;;AAsCH,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAE/B,aAAa;AACb,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AAExB,4EAA4E;AAC5E,yCAAmD;AAA1C,iHAAA,oBAAoB,OAAA;AAE7B,aAAa;AACb,mCAA8E;AAArE,oHAAA,0BAA0B,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAC3D,2DAAkE;AAAzD,gIAAA,0BAA0B,OAAA;AAEnC,qEAAqE;AACrE,4EAA4E;AAC5E,qCAA+C;AAAtC,6GAAA,kBAAkB,OAAA;AAG3B,kCAAkC;AAClC,uDAAoF;AAA3E,4HAAA,wBAAwB,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAEvD,aAAa;AACb,iDAOyB;AANvB,2HAAA,0BAA0B,OAAA;AAC1B,+GAAA,cAAc,OAAA;AACd,8GAAA,aAAa,OAAA;AACb,gHAAA,eAAe,OAAA;AACf,iHAAA,gBAAgB,OAAA;AAChB,gHAAA,eAAe,OAAA;AAIjB,yEAAyE;AACzE,0EAA0E;AAC1E,wEAAwE;AACxE,mDAS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