Skip to content

Commit 8d94770

Browse files
committed
experimental_taintObjectReferenceを翻訳した。
1 parent f97f53d commit 8d94770

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

src/content/reference/react/experimental_taintObjectReference.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@ version: experimental
55

66
<Experimental>
77

8-
**This API is experimental and is not available in a stable version of React yet.**
8+
**この API は実験的なものであり、まだ安定版の React では利用できません。**
99

10-
You can try it by upgrading React packages to the most recent experimental version:
10+
React パッケージを最新の実験バージョンにアップグレードすることで試すことができます。
1111

1212
- `react@experimental`
1313
- `react-dom@experimental`
1414
- `eslint-plugin-react-hooks@experimental`
1515

16-
Experimental versions of React may contain bugs. Don't use them in production.
16+
React の実験バージョンにはバグが含まれている可能性があります。本番環境では使用しないでください。
1717

18-
This API is only available inside React Server Components.
18+
この API React Server Components 内でのみ利用できます。
1919

2020
</Experimental>
2121

2222

2323
<Intro>
2424

25-
`taintObjectReference` lets you prevent a specific object instance from being passed to a Client Component like a `user` object.
25+
`taintObjectReference` を使うと、`user` オブジェクトのような特定のオブジェクトインスタンスが Client Component に渡されるのを防げます。
2626

2727
```js
2828
experimental_taintObjectReference(message, object);
2929
```
3030

31-
To prevent passing a key, hash or token, see [`taintUniqueValue`](/reference/react/experimental_taintUniqueValue).
31+
キー、ハッシュ、トークンなどが渡されるのを防ぎたい場合は、[`taintUniqueValue`](/reference/react/experimental_taintUniqueValue) を参照してください。
3232

3333
</Intro>
3434

3535
<InlineToc />
3636

3737
---
3838

39-
## Reference {/*reference*/}
39+
## リファレンス {/*reference*/}
4040

4141
### `taintObjectReference(message, object)` {/*taintobjectreference*/}
4242

43-
Call `taintObjectReference` with an object to register it with React as something that should not be allowed to be passed to the Client as is:
43+
`taintObjectReference` をオブジェクトと共に呼び出すことで、そのオブジェクトを「クライアントにそのまま渡してはならないもの」として React に登録します。
4444

4545
```js
4646
import {experimental_taintObjectReference} from 'react';
@@ -51,35 +51,35 @@ experimental_taintObjectReference(
5151
);
5252
```
5353

54-
[See more examples below.](#usage)
54+
[さらに例を見る](#usage)
5555

56-
#### Parameters {/*parameters*/}
56+
#### 引数 {/*parameters*/}
5757

58-
* `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.
58+
* `message`: オブジェクトが Client Component に渡されてしまった場合に表示したいメッセージです。このメッセージは、そのオブジェクトが Client Component に渡されたときに投げられるエラーの一部として表示されます。
5959

60-
* `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.
60+
* `object`: taint するオブジェクトです。関数やクラスインスタンスを `taintObjectReference` `object` として渡すことができます。関数やクラスは Client Component に渡されることがすでにブロックされていますが、React のデフォルトのエラーメッセージは `message` で定義したものに置き換えられます。Typed Array の特定のインスタンスを `taintObjectReference` `object` として渡した場合、その Typed Array の他のコピーは taint されません。
6161

62-
#### Returns {/*returns*/}
62+
#### 返り値 {/*returns*/}
6363

64-
`experimental_taintObjectReference` returns `undefined`.
64+
`experimental_taintObjectReference` `undefined` を返します。
6565

66-
#### Caveats {/*caveats*/}
66+
#### 注意点 {/*caveats*/}
6767

68-
- 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.
68+
- taint されたオブジェクトを再作成またはクローンすると、機密データを含む可能性がある新しい taint されていないオブジェクトが作成されます。例えば、taint された `user` オブジェクトがある場合、`const userInfo = {name: user.name, ssn: user.ssn}` `{...user}` は taint されていない新しいオブジェクトを作成します。`taintObjectReference` が保護するのは、オブジェクトが変更されずに Client Component へそのまま渡されてしまうような単純なミスだけです。
6969

7070
<Pitfall>
7171

72-
**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.
72+
**セキュリティを taint だけに頼らないでください**。オブジェクトを taint しても、派生しうるあらゆる値の漏えいを防げるわけではありません。例えば、taint されたオブジェクトをクローンすると、taint されていない新しいオブジェクトが作成されます。taint されたオブジェクトのデータを使うと(例えば `{secret: taintedObj.secret}`)、taint されていない新しい値やオブジェクトが作成されます。taint は保護層の 1 つです。セキュアなアプリには、複数の保護層、適切に設計された API、分離パターンが必要です。
7373

7474
</Pitfall>
7575

7676
---
7777

78-
## Usage {/*usage*/}
78+
## 使用法 {/*usage*/}
7979

80-
### Prevent user data from unintentionally reaching the client {/*prevent-user-data-from-unintentionally-reaching-the-client*/}
80+
### ユーザデータが意図せずクライアントに到達するのを防ぐ {/*prevent-user-data-from-unintentionally-reaching-the-client*/}
8181

82-
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.
82+
Client Component は、機密データを持つオブジェクトを決して受け取るべきではありません。理想的には、データ取得関数は現在のユーザに見せるべきではないデータを公開しないようにするべきです。しかしリファクタリング中にミスが起きることもあります。後続の処理でそのようなミスが起きた場合に備えて、データ API 内で `user` オブジェクトを「taint」できます。
8383

8484
```js
8585
import {experimental_taintObjectReference} from 'react';
@@ -95,13 +95,13 @@ export async function getUser(id) {
9595
}
9696
```
9797

98-
Now whenever anyone tries to pass this object to a Client Component, an error will be thrown with the passed in error message instead.
98+
これにより、誰かがこのオブジェクトを Client Component に渡そうとすると、指定したエラーメッセージを含むエラーが投げられます。
9999

100100
<DeepDive>
101101

102-
#### Protecting against leaks in data fetching {/*protecting-against-leaks-in-data-fetching*/}
102+
#### データ取得での漏えいを防ぐ {/*protecting-against-leaks-in-data-fetching*/}
103103

104-
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:
104+
機密データにアクセスできる Server Components 環境を実行している場合、オブジェクトをそのまま渡さないように注意する必要があります。
105105

106106
```js
107107
// api.js
@@ -131,7 +131,7 @@ export async function InfoCard({ user }) {
131131
}
132132
```
133133

134-
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:
134+
理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトが Client Component に渡されるのを防ぐために、`user` オブジェクトを「taint」できます。
135135

136136

137137
```js
@@ -149,6 +149,6 @@ export async function getUser(id) {
149149
}
150150
```
151151

152-
Now if anyone tries to pass the `user` object to a Client Component, an error will be thrown with the passed in error message.
152+
これにより、誰かが `user` オブジェクトを Client Component に渡そうとすると、指定したエラーメッセージを含むエラーが投げられます。
153153

154154
</DeepDive>

0 commit comments

Comments
 (0)