main
js 27 lines 1.03 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 export interface Reference {}
11
12 export type TaintEntry = {
13 message: string,
14 count: number,
15 };
16
17 export const TaintRegistryObjects: WeakMap<Reference, string> = new WeakMap();
18 export const TaintRegistryValues: Map<string | bigint, TaintEntry> = new Map();
19 // Byte lengths of all binary values we've ever seen. We don't both refcounting this.
20 // We expect to see only a few lengths here such as the length of token.
21 export const TaintRegistryByteLengths: Set<number> = new Set();
22
23 // When a value is finalized, it means that it has been removed from any global caches.
24 // No future requests can get a handle on it but any ongoing requests can still have
25 // a handle on it. It's still tainted until that happens.
26 export type RequestCleanupQueue = Array<string | bigint>;
27 export const TaintRegistryPendingRequests: Set<RequestCleanupQueue> = new Set();