-
Notifications
You must be signed in to change notification settings - Fork 188
Translate "experimental_taintObjectReference" #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,42 +5,42 @@ version: experimental | |||||
|
|
||||||
| <Experimental> | ||||||
|
|
||||||
| **This API is experimental and is not available in a stable version of React yet.** | ||||||
| **この API は実験的なものであり、まだ安定版の React では利用できません。** | ||||||
|
|
||||||
| You can try it by upgrading React packages to the most recent experimental version: | ||||||
| React パッケージを最新の実験バージョンにアップグレードすることで試すことができます。 | ||||||
|
|
||||||
| - `react@experimental` | ||||||
| - `react-dom@experimental` | ||||||
| - `eslint-plugin-react-hooks@experimental` | ||||||
|
|
||||||
| Experimental versions of React may contain bugs. Don't use them in production. | ||||||
| React の実験バージョンにはバグが含まれている可能性があります。本番環境では使用しないでください。 | ||||||
|
|
||||||
| This API is only available inside React Server Components. | ||||||
| この API は React Server Components 内でのみ利用できます。 | ||||||
|
|
||||||
| </Experimental> | ||||||
|
|
||||||
|
|
||||||
| <Intro> | ||||||
|
|
||||||
| `taintObjectReference` lets you prevent a specific object instance from being passed to a Client Component like a `user` object. | ||||||
| `taintObjectReference` を使うと、`user` オブジェクトのような特定のオブジェクトインスタンスが Client Component に渡されるのを防げます。 | ||||||
|
|
||||||
| ```js | ||||||
| experimental_taintObjectReference(message, object); | ||||||
| ``` | ||||||
|
|
||||||
| To prevent passing a key, hash or token, see [`taintUniqueValue`](/reference/react/experimental_taintUniqueValue). | ||||||
| キー、ハッシュ、トークンなどが渡されるのを防ぎたい場合は、[`taintUniqueValue`](/reference/react/experimental_taintUniqueValue) を参照してください。 | ||||||
|
|
||||||
| </Intro> | ||||||
|
|
||||||
| <InlineToc /> | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Reference {/*reference*/} | ||||||
| ## リファレンス {/*reference*/} | ||||||
|
|
||||||
| ### `taintObjectReference(message, object)` {/*taintobjectreference*/} | ||||||
|
|
||||||
| 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: | ||||||
| `taintObjectReference` をオブジェクトと共に呼び出すことで、そのオブジェクトをクライアントにそのまま渡してはならないものとして React に登録します。 | ||||||
|
|
||||||
| ```js | ||||||
| import {experimental_taintObjectReference} from 'react'; | ||||||
|
|
@@ -51,35 +51,35 @@ experimental_taintObjectReference( | |||||
| ); | ||||||
| ``` | ||||||
|
|
||||||
| [See more examples below.](#usage) | ||||||
| [さらに例を見る](#usage) | ||||||
|
|
||||||
| #### Parameters {/*parameters*/} | ||||||
| #### 引数 {/*parameters*/} | ||||||
|
|
||||||
| * `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. | ||||||
| * `message`: オブジェクトが Client Component に渡されてしまった場合に表示したいメッセージです。このメッセージは、そのオブジェクトが Client Component に渡されたときに投げられるエラーの一部として表示されます。 | ||||||
|
SSakutaro marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| * `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. | ||||||
| * `object`: taint するオブジェクトです。関数やクラスインスタンスを `taintObjectReference` に `object` として渡すことができます。関数やクラスは Client Component に渡されることがすでにブロックされていますが、React のデフォルトのエラーメッセージは `message` で定義したものに置き換えられます。Typed Array の特定のインスタンスを `taintObjectReference` に `object` として渡した場合、その Typed Array の他のコピーは taint されません。 | ||||||
|
||||||
| * `object`: taint するオブジェクトです。関数やクラスインスタンスを `taintObjectReference` に `object` として渡すことができます。関数やクラスは Client Component に渡されることがすでにブロックされていますが、React のデフォルトのエラーメッセージは `message` で定義したものに置き換えられます。Typed Array の特定のインスタンスを `taintObjectReference` に `object` として渡した場合、その Typed Array の他のコピーは taint されません。 | |
| * `object`: taint(汚染)するオブジェクト。関数やクラスインスタンスも `taintObjectReference` に `object` として渡すことができます。関数やクラスはクライアントコンポーネントに渡せないよう元々ブロックされていますが、React のデフォルトのエラーメッセージを `message` で定義したものに置き換えられます。Typed Array の特定のインスタンスを `taintObjectReference` に `object` として渡した場合、その Typed Array の他のコピーは taint されません。 |
原文で残すことは反対ではないのですが1回は訳語を入れておく感じにしましょう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - taint されたオブジェクトを再作成またはクローンすると、機密データを含む可能性がある新しい taint されていないオブジェクトが作成されます。例えば、taint された `user` オブジェクトがある場合、`const userInfo = {name: user.name, ssn: user.ssn}` や `{...user}` は taint されていない新しいオブジェクトを作成します。`taintObjectReference` が保護するのは、オブジェクトが変更されずに Client Component へそのまま渡されてしまうような単純なミスだけです。 | |
| - taint されたオブジェクトを再作成またはクローンすると、機密データを含む可能性がある新しい taint されていないオブジェクトが作成されます。例えば、taint された `user` オブジェクトがある場合、`const userInfo = {name: user.name, ssn: user.ssn}` や `{...user}` は taint されていない新しいオブジェクトを作成します。`taintObjectReference` が保護するのは、オブジェクトが変更されずにクライアントコンポーネントへそのまま渡されてしまうような単純なミスだけです。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **セキュリティを taint だけに頼らないでください**。オブジェクトを taint しても、派生しうるあらゆる値の漏えいを防げるわけではありません。例えば、taint されたオブジェクトをクローンすると、taint されていない新しいオブジェクトが作成されます。taint されたオブジェクトのデータを使うと(例えば `{secret: taintedObj.secret}`)、taint されていない新しい値やオブジェクトが作成されます。taint は保護層の 1 つです。セキュアなアプリには、複数の保護層、適切に設計された API、分離パターンが必要です。 | |
| **セキュリティを taint だけに頼らないでください**。オブジェクトを taint しても、そこから派生しうるあらゆる値の漏洩を防げるわけではありません。例えば、taint されたオブジェクトをクローンすると、taint されていない新しいオブジェクトが作成されます。taint されたオブジェクトのデータを使って(例えば `{secret: taintedObj.secret}`)、taint されていない新しい値やオブジェクトが作成できます。taint は保護層の 1 つです。セキュアなアプリには、複数の保護層、適切に設計された API、分離パターンが必要です。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Client Component は、機密データを持つオブジェクトを決して受け取るべきではありません。理想的には、データ取得関数は現在のユーザに見せるべきではないデータを公開しないようにするべきです。しかしリファクタリング中にミスが起きることもあります。後続の処理でそのようなミスが起きた場合に備えて、データ API 内で user オブジェクトを "taint" できます。 | |
| クライアントコンポーネントは、機密データを持つオブジェクトを決して受け取るべきではありません。理想的には、データ取得関数は現在のユーザに見せるべきではないデータを公開しないようにするべきです。しかしリファクタリング中にミスが起きることもあります。後続の処理でそのようなミスが起きた場合に備えて、データ API 内で user オブジェクトを "taint"(汚染)できます。 |
このfunctionは「データ取得の仕組み」のような気も少ししますが、このままで
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 機密データにアクセスできる Server Components 環境を実行している場合、オブジェクトをそのまま渡さないように注意する必要があります。 | |
| 機密データにアクセスできるサーバコンポーネント環境を利用している場合、オブジェクトをそのまま渡さないように注意する必要があります。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトが Client Component に渡されるのを防ぐために、user オブジェクトを "taint" できます。 | |
| 理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトがクライアントコンポーネントに渡されるのを防ぐために、user オブジェクトを "taint" できます。 |
Uh oh!
There was an error while loading. Please reload this page.