ReactTaint.js — react Source File
Architecture documentation for ReactTaint.js, a javascript file in the react codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a8bdfe62_cd6b_92f3_5994_4bad086def0d["ReactTaint.js"] 07e97397_bfd8_cd84_0c06_177fdc7a878a["ReactSharedInternalsServer.js"] a8bdfe62_cd6b_92f3_5994_4bad086def0d --> 07e97397_bfd8_cd84_0c06_177fdc7a878a 37747956_3bf3_6b83_377b_2f2276422c46["ReactSharedInternals"] a8bdfe62_cd6b_92f3_5994_4bad086def0d --> 37747956_3bf3_6b83_377b_2f2276422c46 8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"] a8bdfe62_cd6b_92f3_5994_4bad086def0d --> 8344de1b_978c_be0f_eebd_38ccc4962a93 12b1040a_3a93_df40_9c68_e6293b207a7a["getPrototypeOf"] a8bdfe62_cd6b_92f3_5994_4bad086def0d --> 12b1040a_3a93_df40_9c68_e6293b207a7a c4ff46f1_08aa_cd5d_d726_5e1e58202d31["binaryToComparableString"] a8bdfe62_cd6b_92f3_5994_4bad086def0d --> c4ff46f1_08aa_cd5d_d726_5e1e58202d31 style a8bdfe62_cd6b_92f3_5994_4bad086def0d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {enableTaint} from 'shared/ReactFeatureFlags';
import getPrototypeOf from 'shared/getPrototypeOf';
import binaryToComparableString from 'shared/binaryToComparableString';
import ReactSharedInternals from './ReactSharedInternalsServer';
const {
TaintRegistryObjects,
TaintRegistryValues,
TaintRegistryByteLengths,
TaintRegistryPendingRequests,
} = ReactSharedInternals;
interface Reference {}
// This is the shared constructor of all typed arrays.
const TypedArrayConstructor = getPrototypeOf(Uint32Array.prototype).constructor;
const defaultMessage =
'A tainted value was attempted to be serialized to a Client Component or Action closure. ' +
'This would leak it to the client.';
function cleanup(entryValue: string | bigint): void {
const entry = TaintRegistryValues.get(entryValue);
if (entry !== undefined) {
TaintRegistryPendingRequests.forEach(function (requestQueue) {
requestQueue.push(entryValue);
entry.count++;
});
if (entry.count === 1) {
TaintRegistryValues.delete(entryValue);
} else {
entry.count--;
}
}
}
// If FinalizationRegistry doesn't exist, we assume that objects life forever.
// E.g. the whole VM is just the lifetime of a request.
const finalizationRegistry =
typeof FinalizationRegistry === 'function'
? new FinalizationRegistry(cleanup)
: null;
export function taintUniqueValue(
message: ?string,
lifetime: Reference,
value: string | bigint | $ArrayBufferView,
): void {
if (!enableTaint) {
// ... (79 more lines)
Domain
Dependencies
- ReactFeatureFlags
- ReactSharedInternals
- ReactSharedInternalsServer.js
- binaryToComparableString
- getPrototypeOf
Source
Frequently Asked Questions
What does ReactTaint.js do?
ReactTaint.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactTaint.js depend on?
ReactTaint.js imports 5 module(s): ReactFeatureFlags, ReactSharedInternals, ReactSharedInternalsServer.js, binaryToComparableString, getPrototypeOf.
Where is ReactTaint.js in the architecture?
ReactTaint.js is located at packages/react/src/ReactTaint.js (domain: BabelCompiler, directory: packages/react/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free