Translate "experimental_taintObjectReference"#925
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
There was a problem hiding this comment.
Pull request overview
React の実験的 API experimental_taintObjectReference リファレンスページを日本語化し、React Server Components における taint(汚染)API の使い方・注意点・例を日本語で読めるようにする PR です。
Changes:
<Experimental>/<Intro>/Reference/Usageセクション本文の日本語翻訳- パラメータ/返り値/注意点/落とし穴/DeepDive の説明文を日本語化
- 見出しやリンク文言(例:「さらに例を見る」)の日本語化
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * `message`: オブジェクトが Client Component に渡されてしまった場合に表示したいメッセージです。このメッセージは、そのオブジェクトが Client Component に渡されたときに投げられるエラーの一部として表示されます。 | ||
|
|
||
| * `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 されません。 |
There was a problem hiding this comment.
本文で taint を動詞としてそのまま使っていますが、既存の日本語ドキュメントでは「汚染 API (taint API)」のように「汚染」という訳語を併記しています(例: src/content/reference/rsc/use-server.md)。このページでも「汚染(taint)」などの表記に統一すると、用語が伝わりやすくなります。
There was a problem hiding this comment.
「汚染 (taint)」に合わせようとするのは早まってる気がするので、
今のところは修正する必要はないと思います
一応、セキュリティ用語として Taint の訳語は「汚染」が定着してるっぽいですが…
https://www.sompocybersecurity.com/column/glossary/taint-analysis
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| * `message`: オブジェクトが Client Component に渡されてしまった場合に表示したいメッセージです。このメッセージは、そのオブジェクトが Client Component に渡されたときに投げられるエラーの一部として表示されます。 | ||
|
|
||
| * `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 されません。 |
There was a problem hiding this comment.
「汚染 (taint)」に合わせようとするのは早まってる気がするので、
今のところは修正する必要はないと思います
一応、セキュリティ用語として Taint の訳語は「汚染」が定着してるっぽいですが…
https://www.sompocybersecurity.com/column/glossary/taint-analysis
smikitky
left a comment
There was a problem hiding this comment.
確認しました、一部読みやすさと表記統一のための修正をお願いします
| ``` | ||
|
|
||
| Now whenever anyone tries to pass this object to a Client Component, an error will be thrown with the passed in error message instead. | ||
| これにより、誰かがこのオブジェクトを Client Component に渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。 |
There was a problem hiding this comment.
| これにより、誰かがこのオブジェクトを Client Component に渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。 | |
| これにより、誰かがこのオブジェクトをクライアントコンポーネントに渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。 |
| #### 引数 {/*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 に渡されたときにスローされるエラーの一部として表示されます。 |
There was a problem hiding this comment.
| * `message`: オブジェクトが Client Component に渡されてしまった場合に表示したいメッセージです。このメッセージは、そのオブジェクトが Client Component に渡されたときにスローされるエラーの一部として表示されます。 | |
| * `message`: オブジェクトがクライアントコンポーネントに渡されようとした場合に表示したいメッセージ。このメッセージは、そのオブジェクトがクライアントコンポーネントに渡されようとした際にスローされるエラーの一部として表示されます。 |
ここは過去形にしないほうがいいかなと
| * `message`: オブジェクトが Client Component に渡されてしまった場合に表示したいメッセージです。このメッセージは、そのオブジェクトが Client Component に渡されたときにスローされるエラーの一部として表示されます。 | ||
|
|
||
| * `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 されません。 |
There was a problem hiding this comment.
| * `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回は訳語を入れておく感じにしましょう
| #### 注意点 {/*caveats*/} | ||
|
|
||
| - 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. | ||
| - taint されたオブジェクトを再作成またはクローンすると、機密データを含む可能性がある新しい taint されていないオブジェクトが作成されます。例えば、taint された `user` オブジェクトがある場合、`const userInfo = {name: user.name, ssn: user.ssn}` や `{...user}` は taint されていない新しいオブジェクトを作成します。`taintObjectReference` が保護するのは、オブジェクトが変更されずに Client Component へそのまま渡されてしまうような単純なミスだけです。 |
There was a problem hiding this comment.
| - 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` が保護するのは、オブジェクトが変更されずにクライアントコンポーネントへそのまま渡されてしまうような単純なミスだけです。 |
| <Pitfall> | ||
|
|
||
| **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. | ||
| **セキュリティを taint だけに頼らないでください**。オブジェクトを taint しても、派生しうるあらゆる値の漏えいを防げるわけではありません。例えば、taint されたオブジェクトをクローンすると、taint されていない新しいオブジェクトが作成されます。taint されたオブジェクトのデータを使うと(例えば `{secret: taintedObj.secret}`)、taint されていない新しい値やオブジェクトが作成されます。taint は保護層の 1 つです。セキュアなアプリには、複数の保護層、適切に設計された API、分離パターンが必要です。 |
There was a problem hiding this comment.
| **セキュリティを taint だけに頼らないでください**。オブジェクトを taint しても、派生しうるあらゆる値の漏えいを防げるわけではありません。例えば、taint されたオブジェクトをクローンすると、taint されていない新しいオブジェクトが作成されます。taint されたオブジェクトのデータを使うと(例えば `{secret: taintedObj.secret}`)、taint されていない新しい値やオブジェクトが作成されます。taint は保護層の 1 つです。セキュアなアプリには、複数の保護層、適切に設計された API、分離パターンが必要です。 | |
| **セキュリティを taint だけに頼らないでください**。オブジェクトを taint しても、そこから派生しうるあらゆる値の漏洩を防げるわけではありません。例えば、taint されたオブジェクトをクローンすると、taint されていない新しいオブジェクトが作成されます。taint されたオブジェクトのデータを使って(例えば `{secret: taintedObj.secret}`)、taint されていない新しい値やオブジェクトが作成できます。taint は保護層の 1 つです。セキュアなアプリには、複数の保護層、適切に設計された API、分離パターンが必要です。 |
| ### ユーザデータが意図せずクライアントに到達するのを防ぐ {/*prevent-user-data-from-unintentionally-reaching-the-client*/} | ||
|
|
||
| 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. | ||
| Client Component は、機密データを持つオブジェクトを決して受け取るべきではありません。理想的には、データ取得関数は現在のユーザに見せるべきではないデータを公開しないようにするべきです。しかしリファクタリング中にミスが起きることもあります。後続の処理でそのようなミスが起きた場合に備えて、データ API 内で user オブジェクトを "taint" できます。 |
There was a problem hiding this comment.
| Client Component は、機密データを持つオブジェクトを決して受け取るべきではありません。理想的には、データ取得関数は現在のユーザに見せるべきではないデータを公開しないようにするべきです。しかしリファクタリング中にミスが起きることもあります。後続の処理でそのようなミスが起きた場合に備えて、データ API 内で user オブジェクトを "taint" できます。 | |
| クライアントコンポーネントは、機密データを持つオブジェクトを決して受け取るべきではありません。理想的には、データ取得関数は現在のユーザに見せるべきではないデータを公開しないようにするべきです。しかしリファクタリング中にミスが起きることもあります。後続の処理でそのようなミスが起きた場合に備えて、データ API 内で user オブジェクトを "taint"(汚染)できます。 |
このfunctionは「データ取得の仕組み」のような気も少ししますが、このままで
| #### データ取得での漏えいを防ぐ {/*protecting-against-leaks-in-data-fetching*/} | ||
|
|
||
| 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: | ||
| 機密データにアクセスできる Server Components 環境を実行している場合、オブジェクトをそのまま渡さないように注意する必要があります。 |
There was a problem hiding this comment.
| 機密データにアクセスできる Server Components 環境を実行している場合、オブジェクトをそのまま渡さないように注意する必要があります。 | |
| 機密データにアクセスできるサーバコンポーネント環境を利用している場合、オブジェクトをそのまま渡さないように注意する必要があります。 |
| ``` | ||
|
|
||
| Now if anyone tries to pass the `user` object to a Client Component, an error will be thrown with the passed in error message. | ||
| これにより、誰かが `user` オブジェクトを Client Component に渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。 |
There was a problem hiding this comment.
| これにより、誰かが `user` オブジェクトを Client Component に渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。 | |
| これにより、誰かが `user` オブジェクトをクライアントコンポーネントに渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。 |
| ``` | ||
|
|
||
| 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: | ||
| 理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトが Client Component に渡されるのを防ぐために、user オブジェクトを "taint" できます。 |
There was a problem hiding this comment.
| 理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトが Client Component に渡されるのを防ぐために、user オブジェクトを "taint" できます。 | |
| 理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトがクライアントコンポーネントに渡されるのを防ぐために、user オブジェクトを "taint" できます。 |
experimental_taintObjectReference記事を翻訳しました。
実験バージョンなどの訳は、過去の日本語訳の記事を参考にしています。