You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`message`: The message you want to display if the object gets passed to a Client Component. This message will be displayed as a part of the Error that will be thrown if the object gets passed to a Client Component.
57
+
*`message`: El mensaje que deseas mostrar si el objeto se pasa a un Componente Cliente. Este mensaje se mostrará como parte del Error que se lanzará si el objeto se pasa a un Componente Cliente.
58
58
59
-
*`object`: The object to be tainted. Functions and class instances can be passed to `taintObjectReference`as`object`. Functions and classes are already blocked from being passed to Client Components but the React's default error message will be replaced by what you defined in `message`. When a specific instance of a Typed Array is passed to`taintObjectReference`as`object`, any other copies of the Typed Array will not be tainted.
59
+
*`object`: El objeto a contaminar. Funciones e instancias de clases pueden ser pasadas a `taintObjectReference`como`object`. Las funciones y clases ya están bloqueadas para ser pasadas a Componentes Cliente, pero el mensaje de error predeterminado de React será reemplazado por lo que hayas definido en el `message`. Cuando una instancia específica de una matriz tipada se pasa a`taintObjectReference`como`object`, cualquier otra copia de la matriz tipada no será contaminada.
-Recreating or cloning a tainted object creates a new untainted object which may contain sensitive data. For example, if you have a tainted `user`object, `const userInfo = {name: user.name, ssn: user.ssn}`or`{...user}`will create new objects which are not tainted. `taintObjectReference`only protects against simple mistakes when the object is passed through to a Client Component unchanged.
67
+
-Recrear o clonar un objeto contaminado crea un nuevo objeto no contaminado que puede contener datos sensibles. Por ejemplo, si tienes un objeto `user`contaminado, `const userInfo = {name: user.name, ssn: user.ssn}`o`{...user}`creará nuevos objetos que no estarán contamidos. `taintObjectReference`solo protege contra errores simples cuando el objeto se pasa sin cambios a un Componente Cliente.
68
68
69
69
<Pitfall>
70
70
71
-
**Do not rely on just tainting for security.**Tainting an object doesn't prevent leaking of every possible derived value. For example, the clone of a tainted object will create a new untainted object. Using data from a tainted object (e.g. `{secret: taintedObj.secret}`) will create a new value or object that is not tainted. Tainting is a layer of protection; a secure app will have multiple layers of protection, well designed APIs, and isolation patterns.
71
+
**No confíes únicamente en la 'contaminación' para la seguridad.**Contaminar un objeto no evita la filtración de todos los valores derivados posibles. Por ejemplo, el clon de un objeto contaminado creará un nuevo objeto no contaminado. Usar datos de un objeto contaminado (e.j. `{secret: taintedObj.secret}`) creará un nuevo valor u objeto que no esté contaminado. La contaminación es una capa de protección; una aplicación segura tendrá múltiples capas de protección, APIs bien diseñadas y patrones de aislamiento.
72
72
73
73
</Pitfall>
74
74
75
75
---
76
76
77
-
## Usage {/*usage*/}
77
+
## Uso {/*usage*/}
78
78
79
-
### Prevent user data from unintentionally reaching the client {/*prevent-user-data-from-unintentionally-reaching-the-client*/}
79
+
### Evita que los datos de usuario lleguen al cliente de manera no intencionada {/*prevent-user-data-from-unintentionally-reaching-the-client*/}
80
80
81
-
A Client Component should never accept objects that carry sensitive data. Ideally, the data fetching functions should not expose data that the current user should not have access to. Sometimes mistakes happen during refactoring. To protect against these mistakes happening down the line we can "taint" the user object in our data API.
81
+
Un Componente Cliente nunca debería aceptar objetos que contengan datos sensibles. Idealmente, las funciones de obtención de datos no deberían exponer datos a los que el usuario actual no debería tener acceso. A veces, ocurren errores durante la refactorización. Para protegernos contra estos errores en el futuro, podemos 'contaminar' el objeto de usuario en nuestra API de datos.
@@ -94,13 +94,13 @@ export async function getUser(id) {
94
94
}
95
95
```
96
96
97
-
Now whenever anyone tries to pass this object to a Client Component, an error will be thrown with the passed in error message instead.
97
+
Ahora, cada vez que alguien intente pasar este objeto a un Componente Cliente, se lanzará un error con el mensaje de error proporcionado.
98
98
99
99
<DeepDive>
100
100
101
-
#### Protecting against leaks in data fetching {/*protecting-against-leaks-in-data-fetching*/}
101
+
#### Protegiendo contra fugas en la obtención de datos. {/*protecting-against-leaks-in-data-fetching*/}
102
102
103
-
If you're running a Server Components environment that has access to sensitive data, you have to be careful not to pass objects straight through:
103
+
Si estás ejecutando un entorno de Componentes de Servidor que tiene acceso a datos sensibles, debes tener cuidado de no pasar objetos directamente:
104
104
105
105
```js
106
106
// api.js
@@ -130,7 +130,7 @@ export async function InfoCard({ user }) {
130
130
}
131
131
```
132
132
133
-
Ideally, the `getUser`should not expose data that the current user should not have access to. To prevent passing the `user` object to a Client Component down the line we can "taint" the user object:
133
+
Idealmente, la función `getUser`no debería exponer datos a los que el `user` actual no debería tener acceso. Para evitar pasar el objeto de usuario a un Componente Cliente más adelante, podemos "contaminar" el objeto de usuario:
134
134
135
135
136
136
```js
@@ -148,6 +148,6 @@ export async function getUser(id) {
148
148
}
149
149
```
150
150
151
-
Now if anyone tries to pass the `user`object to a Client Component, an error will be thrown with the passed in error message.
151
+
Ahora, si alguien intenta pasar el objeto de `user`a un Componente Cliente, se lanzará un error con el mensaje de error proporcionado.
0 commit comments