Skip to content

Translate "experimental_taintObjectReference"#925

Open
SSakutaro wants to merge 4 commits into
reactjs:mainfrom
SSakutaro:tr/experimental_taintObjectReference
Open

Translate "experimental_taintObjectReference"#925
SSakutaro wants to merge 4 commits into
reactjs:mainfrom
SSakutaro:tr/experimental_taintObjectReference

Conversation

@SSakutaro
Copy link
Copy Markdown
Contributor

experimental_taintObjectReference記事を翻訳しました。
実験バージョンなどの訳は、過去の日本語訳の記事を参考にしています。

Copilot AI review requested due to automatic review settings April 26, 2026 09:51
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
legacy-ja-reactjs-org Ignored Ignored Preview Apr 26, 2026 10:18am

Request Review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 26, 2026

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/content/reference/react/experimental_taintObjectReference.md Outdated
Comment thread src/content/reference/react/experimental_taintObjectReference.md Outdated
Comment thread src/content/reference/react/experimental_taintObjectReference.md Outdated
* `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 されません。
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本文で taint を動詞としてそのまま使っていますが、既存の日本語ドキュメントでは「汚染 API (taint API)」のように「汚染」という訳語を併記しています(例: src/content/reference/rsc/use-server.md)。このページでも「汚染(taint)」などの表記に統一すると、用語が伝わりやすくなります。

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「汚染 (taint)」に合わせようとするのは早まってる気がするので、
今のところは修正する必要はないと思います

一応、セキュリティ用語として Taint の訳語は「汚染」が定着してるっぽいですが…

https://www.sompocybersecurity.com/column/glossary/taint-analysis

Comment thread src/content/reference/react/experimental_taintObjectReference.md
Comment thread src/content/reference/react/experimental_taintObjectReference.md Outdated
Comment thread src/content/reference/react/experimental_taintObjectReference.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@honey32 honey32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます!
良いと思います!

@smikitky こちら確認お願いします!

* `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 されません。
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「汚染 (taint)」に合わせようとするのは早まってる気がするので、
今のところは修正する必要はないと思います

一応、セキュリティ用語として Taint の訳語は「汚染」が定着してるっぽいですが…

https://www.sompocybersecurity.com/column/glossary/taint-analysis

Comment thread src/content/reference/react/experimental_taintObjectReference.md
Comment thread src/content/reference/react/experimental_taintObjectReference.md
@smikitky smikitky self-requested a review June 1, 2026 05:43
Copy link
Copy Markdown
Member

@smikitky smikitky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確認しました、一部読みやすさと表記統一のための修正をお願いします

```

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 に渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
これにより、誰かがこのオブジェクトを 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 に渡されたときにスローされるエラーの一部として表示されます。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `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 されません。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `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 へそのまま渡されてしまうような単純なミスだけです。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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、分離パターンが必要です。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**セキュリティを 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" できます。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 環境を実行している場合、オブジェクトをそのまま渡さないように注意する必要があります。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
機密データにアクセスできる 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 に渡そうとすると、指定したエラーメッセージを含むエラーがスローされます。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
これにより、誰かが `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" できます。
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトが Client Component に渡されるのを防ぐために、user オブジェクトを "taint" できます。
理想的には、`getUser` は現在のユーザに見せるべきではないデータを公開しないようにするべきです。後続の処理で `user` オブジェクトがクライアントコンポーネントに渡されるのを防ぐために、user オブジェクトを "taint" できます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants