> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Node.js v12+6 から Node.js v18 への移行の影響を受ける Auth0 Actions 項目について説明します。

# Node 12 および 16 から Node 18 への移行

Node.js 12 および 16 の長期サポート (LTS) は 2023 年に終了しました。これは、Node.js 開発チームがこれらのバージョンに対する重要なセキュリティ修正をバックポートしなくなったことを意味します。Node 12 または 16 のランタイムで実行すると、拡張機能コードがセキュリティ上の脆弱性にさらされる可能性があります。

Node 18 の拡張機能ランタイムは、拡張機能製品群全体で一般提供 (GA) されています。これには、Actions、Rules、Hooks、Database Scripts、カスタムソーシャル接続が含まれます。コード セキュリティのベストプラクティスに従うため、できるだけ早く Node 18 に更新することを強くお勧めします。

<div id="general-considerations">
  ## 一般的な考慮事項
</div>

<div id="migrate-rules-and-hooks-to-actions">
  ### Rules と Hooks を Actions に移行する
</div>

廃止された拡張機能ランタイムを使用している場合は、Rules と Hooks の実装を見直すこの機会に、(Node 18) Actions への移行をお勧めします。[Actions Limitations](/ja/docs/customize/actions/limitations) にアクセスして、どの Rules と Hooks を Actions に移行できるかを確認してください。Rules と Hooks を Actions に移行する方法の詳細については、[Migrate to Actions](/ja/docs/customize/actions/migrate) を参照してください。

<div id="marketplace-integrations">
  ### Marketplace の統合
</div>

<div id="social-connections-integrations">
  #### ソーシャル接続の統合
</div>

[Management API](https://auth0.com/docs/api/management/v2) を使用すると、Node ランタイムのバージョン変更の影響を受ける可能性があるソーシャル接続の完全な一覧を特定できます。特に、カスタムのソーシャル接続として明示的に作成されたものや、Marketplace 経由で最初に追加されたものなど、影響を受ける可能性があるすべてのソーシャル接続では、`strategy` 属性の値が `oauth1` または `oauth2` のいずれかです。

その後、`GET` connections <Tooltip tip="Management API: お客様が管理タスクを実行できるようにする製品。" cta="用語集を表示" href="/ja/docs/glossary?term=Management+API">Management API</Tooltip> エンドポイントを使用して、特定のテナント内にある既存のカスタムのソーシャル接続をすべてページネーションしながら取得できます。たとえば、次のクエリオプションでは、最大 100 件のカスタムのソーシャル接続の名前と識別子を返します。

```http wrap lines theme={null}
/api/v2/connections?strategy=oauth1&strategy=oauth2&include_totals=true&fields=name&per_page=100
```

<Tooltip tip="Auth0 Dashboard: Auth0 のサービスを設定するための主要製品。" cta="用語集を表示" href="/ja/docs/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> では、Marketplace 経由で追加したカスタムのソーシャル接続のスクリプトは更新できません。Node 18 との互換性を確保するためにスクリプトの変更が必要な場合は、Management API を使用する必要があります。

<div id="migration-tasks">
  ## 移行作業
</div>

<div id="create-new-custom-actions">
  ### 新しいカスタム Actions を作成する
</div>

Auth0 Dashboard で Node 18 を使用して新しいカスタム Action を作成するには、次の手順に従います。

1. [Auth0 Dashboard > Actions > Library](https://manage.auth0.com/#/dashboard/actions/library) に移動します。
2. **Create Action > Build from scratch** を選択します。
3. **Runtime**\* フィールドで、**Node 18 (Recommended)** を選択します。
4. Node 18 でカスタム Actions を作成し、準備ができたらテストしてデプロイします。

<div id="upgrade-existing-custom-actions">
  ### 既存のカスタム Actions をアップグレードする
</div>

Node 12 または 16 で構築された既存のカスタム Actions は、それぞれ個別に Node 18 へアップグレードでき、以前のランタイムを使用する[以前のバージョンに戻す](/ja/docs/customize/actions/manage-versions#revert-actions)こともできます。Actions を Node 18 にアップグレードするには、必要な変更を加えた既存の実装の新しいバージョンを作成してデプロイし、ランタイムとして Node 18 を使用するよう設定します。

<div id="choose-node-18-for-other-extensibility-products">
  ### 他の拡張機能製品では Node 18 を選択する
</div>

残りの (Actions 以外の) 拡張機能で使用するランタイムは、テナントの Advanced 設定でグローバルに定義されます。この設定を変更すると、同時に次の機能に影響します。

* Rules
* Hooks
* カスタムデータベーススクリプト
* カスタムソーシャル接続スクリプト

Auth0 Dashboard でテナントの拡張機能ランタイム設定を変更するには、次の手順に従います。

1. **Dashboard > Settings > Advanced** に移動します。
2. **Extensibility** セクションまでスクロールします。
3. **Runtime** で **Node 18** を選択します。

これは複数の拡張機能に同時に影響するグローバル設定であるため、まず開発テナントでこの手順を実行し、該当するすべての拡張機能をテストしたうえで、開発環境で問題がないことを確認してから本番テナントに進むことを推奨します。

特に Custom DB scripts については、グローバルなランタイムバージョンを変更する前に、[このページで説明されている手順に従って](/ja/docs/authenticate/database-connections/custom-db/custom-database-connections-scripts/environment)、特定のランタイムバージョンに対してスクリプトを個別に検証できます。

<div id="known-breaking-changes">
  ## 既知の破壊的変更
</div>

<div id="magic-npm-modules">
  ### Magic npm モジュール
</div>

Node 12 の拡張機能ランタイムでは、拡張機能コード内で明示的に require しなくても、特定の `npm` モジュールを使用できました。Node 16 ランタイム以降、このような使用方法のサポートは次のモジュールで削除されました。

* \_
* async
* Auth0
* azure\_storage
* bcrypt
* crypto
* couchbase
* cql
* ip
* <Tooltip tip="JSON Web Token（JWT）: 2 者間でクレームを安全に表現するために使用される標準的な IDトークン 形式（多くの場合は アクセストークン の形式でもあります）。" cta="用語集を表示" href="/ja/docs/glossary?term=jwt">jwt</Tooltip>
* Knex
* mongo
* mysql
* mysql\_pool
* ObjectID
* pbkdf2
* pg
* postgres
* Pubnub
* q
* querystring
* sqlserver
* uuid
* xml2js
* xmldom
* xpath
* xtend

現在も Node 12 で拡張機能を実行している場合は、コードを直接 Node 18 に更新する際に、上記の変更を考慮してください。モジュールを使用する前に、明示的に require されていることを確認する必要があります。

Rules、カスタムデータベース接続、およびカスタムソーシャル接続では、[Node 18 で利用可能として一覧表示されている](https://auth0-extensions.github.io/canirequire/) バージョンのモジュールを明示的に require する必要があります。

Hooks と Actions では、モジュールを require する前に、目的のバージョンを明示的な依存関係として追加する必要があります。

<div id="can-i-require-module-versions-removed">
  ### Can I Require で削除されたモジュールバージョン
</div>

[Can I Require](https://auth0-extensions.github.io/canirequire/) で、Node 18 ランタイムにおける以下のモジュールの指定バージョンのサポートが削除されました。この変更は、Rules、カスタムデータベース接続スクリプト、カスタムソーシャル接続スクリプトに関連する拡張機能コードに影響します。

<Warning>
  Marketplace で提供されている次のカスタムソーシャル接続 ([Indeed](https://marketplace.auth0.com/integrations/indeed-social-connection)、[monday.com](https://marketplace.auth0.com/integrations/monday-com-monday-com-social-connection)、[Snapchat](https://marketplace.auth0.com/integrations/snapchat-social-connection)、[Tumblr](https://marketplace.auth0.com/integrations/tumblr-social-connection)) のユーザープロフィール取得スクリプトでは、Node 18 では利用できない `axios` モジュールのバージョン `0.22.0` が使用されていました。これらの接続のいずれかを使用している場合は、[Management API](https://auth0.com/docs/api/management/v2) を使用して、必要に応じてスクリプトを確認および更新してください。
</Warning>

| モジュール                                | バージョン                                                                                                                                                                                 |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| @analytics/google-analytics          | 0.4.0                                                                                                                                                                                 |
| @auth0/hapi                          | 13.5.1, 13.6.0                                                                                                                                                                        |
| @auth0/rule-utilities                | 0.1.0                                                                                                                                                                                 |
| @gitbeaker/node                      | 17.0.1                                                                                                                                                                                |
| @incognia/api                        | 1.0.0                                                                                                                                                                                 |
| @octokit/rest                        | 15.8.2                                                                                                                                                                                |
| @sentry/node                         | 5.6.2, 5.15.5, 6.2.0                                                                                                                                                                  |
| acorn                                | 1.2.2                                                                                                                                                                                 |
| airbrake                             | 1.0.2                                                                                                                                                                                 |
| airgram                              | 3.1.1                                                                                                                                                                                 |
| ajv                                  | 6.10.1                                                                                                                                                                                |
| amazon-dax-client                    | 1.2.2                                                                                                                                                                                 |
| amazon-mws-node                      | 1.0.3                                                                                                                                                                                 |
| analytics                            | 0.5.1                                                                                                                                                                                 |
| analytics-node                       | 2.0.1, 3.5.0                                                                                                                                                                          |
| applicationinsights                  | 0.15.8, 0.18.0, 1.5.0, 1.8.8                                                                                                                                                          |
| async                                | 1.0.0, 0.9.0, 2.1.2, 2.6.1                                                                                                                                                            |
| auth0                                | 2.4.0, 2.1.0, 2.0.0, 0.8.2, 2.6.0, 2.7.0, 2.8.0, 2.9.1, 2.13.0, 2.17.0, 2.17.1, 2.19.0, 2.23.0, 2.27.0, 2.27.1, 2.30.0, 2.31.0, 2.32.0, 2.34.2, 2.35.0, 2.36.1, 2.36.2, 2.39.0, 3.0.1 |
| auth0-authz-rules-api                | 4.0.0                                                                                                                                                                                 |
| auth0-ext-template-renderers         | 0.4.2                                                                                                                                                                                 |
| auth0-extension-express-tools        | 1.0.2, 1.1.5, 1.1.6, 2.0.0                                                                                                                                                            |
| auth0-extension-hapi-tools           | 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.3.0                                                                                                                                              |
| auth0-extension-tools                | 1.0.0, 1.2.1, 1.3.1, 1.3.2, 1.4.0                                                                                                                                                     |
| auth0-magic                          | 3.1.0                                                                                                                                                                                 |
| auth0-oauth2-express                 | 0.0.1, 0.0.3, 1.1.5                                                                                                                                                                   |
| auth0-source-control-extension-tools | 3.0.10, 3.0.9, 3.1.4, 3.4.0, 3.5.1, 4.0.3, 4.0.5, 4.0.6, 4.0.7, 4.1.1, 4.1.2, 4.1.3, 4.1.5, 4.1.7, 4.1.9                                                                              |
| aws-sdk                              | 2.2.30, 2.1.31, 2.1.13, 2.4.13, 2.5.3, 2.197.0, 2.291.0, 2.458.0, 2.593.0                                                                                                             |
| axios                                | 0.15.2, 0.18.0, 0.19.2, 0.21.1, 0.21.3, 0.22.0, 0.27.2                                                                                                                                |
| azure                                | 0.10.6                                                                                                                                                                                |
| azure-storage                        | 0.4.4, 0.4.1, 0.9.0                                                                                                                                                                   |
| babel                                | 5.4.7, 5.1.9                                                                                                                                                                          |
| bcrypt                               | 4.0.0                                                                                                                                                                                 |
| bluebird                             | 2.9.26, 3.4.6                                                                                                                                                                         |
| body-parser                          | 1.12.4                                                                                                                                                                                |
| boom                                 | 2.7.2                                                                                                                                                                                 |
| botbuilder                           | 0.9.0                                                                                                                                                                                 |
| bson                                 | 0.3.2, 4.4.0                                                                                                                                                                          |
| cookie-parser                        | 1.3.5                                                                                                                                                                                 |
| datadog-metrics                      | 0.8.2, 0.9.0, 0.9.2, 0.9.3                                                                                                                                                            |
| disposable-email-domains             | 1.0.14, 1.0.15, 1.0.56                                                                                                                                                                |
| dockerode                            | 2.1.4, 2.0.3                                                                                                                                                                          |
| dotenv                               | 0.4.0, 2.0.0                                                                                                                                                                          |
| easy-pbkdf2                          | 0.0.2                                                                                                                                                                                 |
| ejs                                  | 2.3.1                                                                                                                                                                                 |
| engine.io-client                     | 1.5.1                                                                                                                                                                                 |
| express                              | 4.12.4, 4.14.0, 4.16.3                                                                                                                                                                |
| express-jwt                          | 3.1.0, 5.1.0                                                                                                                                                                          |
| faunadb                              | 2.11.1, 4.1.1                                                                                                                                                                         |
| filter-object                        | 2.1.0                                                                                                                                                                                 |
| firebase                             | 7.12.0                                                                                                                                                                                |
| firebase-admin                       | 4.0.4, 5.0.0, 6.0.0, 8.0.0, 8.12.1                                                                                                                                                    |
| form-data                            | 0.2.0                                                                                                                                                                                 |
| getstream                            | 3.4.1                                                                                                                                                                                 |
| gitlab                               | 1.7.0                                                                                                                                                                                 |
| google-auth-library                  | 1.0.0                                                                                                                                                                                 |
| google-libphonenumber                | 2.0.7, 3.2.8, 3.2.10                                                                                                                                                                  |
| googleapis                           | 2.1.6, 34.0.0                                                                                                                                                                         |
| got                                  | 3.2.0, 9.2.1, 10.7.0, 11.3.0, 11.5.2                                                                                                                                                  |
| hapi                                 | 13.5.0                                                                                                                                                                                |
| hapi-auth-jwt2                       | 7.0.1                                                                                                                                                                                 |
| hapi-swagger                         | 7.4.0                                                                                                                                                                                 |
| hoek                                 | 2.14.0                                                                                                                                                                                |
| http-proxy                           | 1.11.1                                                                                                                                                                                |
| ibm\_db                              | 2.6.4                                                                                                                                                                                 |
| ip                                   | 0.3.2, 0.0.1                                                                                                                                                                          |
| ipaddr.js                            | 1.0.1                                                                                                                                                                                 |
| joi                                  | 6.10.1                                                                                                                                                                                |
| jose                                 | 3.19.0                                                                                                                                                                                |
| jsforce                              | 1.6.0                                                                                                                                                                                 |
| jsonwebtoken                         | 5.7.0, 5.0.1, 5.0.0, 7.1.9, 8.5.0                                                                                                                                                     |
| jwks-rsa                             | 1.0.0, 1.1.1, 1.6.0                                                                                                                                                                   |
| ldapjs                               | 1.0.0                                                                                                                                                                                 |
| lodash                               | 3.10.1, 3.9.3, 2.4.1, 4.8.2, 4.17.10, 4.17.19                                                                                                                                         |
| lru-cache                            | 2.6.4                                                                                                                                                                                 |
| mixpanel                             | 0.4.0                                                                                                                                                                                 |
| mkdirp                               | 0.5.1                                                                                                                                                                                 |
| moment                               | 2.10.3, 2.11.2                                                                                                                                                                        |
| mongodb                              | 2.0.48, 2.0.33, 2.0.27, 2.2.11, 3.1.4, 4.1.0, 3.6.10, 3.5.11                                                                                                                          |
| mongoose                             | 4.1.6                                                                                                                                                                                 |
| morgan                               | 1.5.3                                                                                                                                                                                 |
| mysql                                | 2.7.0, 2.6.2, 2.0.0-alpha8, 2.15.0                                                                                                                                                    |
| mysql2                               | 1.5.3                                                                                                                                                                                 |
| nano                                 | 6.2.0                                                                                                                                                                                 |
| neo4j-driver                         | 1.7.1                                                                                                                                                                                 |
| node-fetch                           | 2.6.0                                                                                                                                                                                 |
| node-jose                            | 0.9.2                                                                                                                                                                                 |
| node-rdkafka                         | 2.10.1                                                                                                                                                                                |
| nodemailer                           | 2.5.0                                                                                                                                                                                 |
| nsp                                  | 2.4.0                                                                                                                                                                                 |
| oauth                                | 0.9.12                                                                                                                                                                                |
| passport-wsfed-saml2                 | 2.11.4                                                                                                                                                                                |
| pg                                   | 4.5.7, 4.3.0, 4.1.1, 6.1.2, 7.17.1                                                                                                                                                    |
| postmark                             | 1.3.1                                                                                                                                                                                 |
| q                                    | 1.0.1                                                                                                                                                                                 |
| qs                                   | 3.1.0                                                                                                                                                                                 |
| ramda                                | 0.18.0, 0.23.0                                                                                                                                                                        |
| range\_check                         | 0.0.1                                                                                                                                                                                 |
| raw-body                             | 2.1.0                                                                                                                                                                                 |
| react                                | 15.3.2                                                                                                                                                                                |
| redis                                | 0.12.1                                                                                                                                                                                |
| request                              | 2.56.0, 2.55.0, 2.27.0, 2.67.0, 2.73.0, 2.75.0, 2.81.0, 2.83.0, 2.88.0                                                                                                                |
| rethinkdb                            | 2.1.1, 2.0.0-1, 2.0.0                                                                                                                                                                 |
| rollbar                              | 0.6.2, 2.12.2                                                                                                                                                                         |
| semver                               | 4.3.4                                                                                                                                                                                 |
| sendgrid                             | 1.8.0, 3.0.7                                                                                                                                                                          |
| sequelize                            | 3.1.1                                                                                                                                                                                 |
| soap                                 | 0.23.0                                                                                                                                                                                |
| socket.io                            | 1.3.5                                                                                                                                                                                 |
| socket.io-client                     | 1.3.5                                                                                                                                                                                 |
| splunk-bunyan-logger                 | 0.9.1                                                                                                                                                                                 |
| ssh2                                 | 0.4.13                                                                                                                                                                                |
| stamplay                             | 1.0.6, 1.0.5, 1.0.3                                                                                                                                                                   |
| stripe                               | 3.3.4, 4.14.0, 4.24.0, 7.1.0, 7.4.0, 8.52.0                                                                                                                                           |
| sumo-logger                          | 1.5.5                                                                                                                                                                                 |
| superagent                           | 1.2.0, 3.8.3, 4.1.0                                                                                                                                                                   |
| tedious                              | 6.6.2, 1.11.0, 0.1.4, 8.3.1, 9.2.1                                                                                                                                                    |
| tough-cookie                         | 1.2.0                                                                                                                                                                                 |
| twilio                               | 2.2.1, 3.6.0, 3.57.0                                                                                                                                                                  |
| twit                                 | 1.1.20                                                                                                                                                                                |
| uuid                                 | 2.0.3, 2.0.1, 3.1.0, 3.3.2, 7.0.3, 8.0.0                                                                                                                                              |
| vso-node-api                         | 3.1.1                                                                                                                                                                                 |
| watson-developer-cloud               | 2.0.1                                                                                                                                                                                 |
| winston                              | 1.0.0, 0.8.1, 3.1.0                                                                                                                                                                   |
| xml2js                               | 0.4.8, 0.2.8                                                                                                                                                                          |
| xmlbuilder                           | 2.6.4                                                                                                                                                                                 |
| xmldom                               | 0.1.19, 0.1.13                                                                                                                                                                        |
| xpath                                | 0.0.5                                                                                                                                                                                 |
| xtend                                | 1.0.3                                                                                                                                                                                 |

<div id="secure-renegotiation-required-by-default-for-tls-connections">
  ### TLS 接続ではデフォルトでセキュアな再ネゴシエーションが必要
</div>

Node.js 18 では、基盤となる OpenSSL 依存関係にこの要件が導入されたため、TLS 接続ではデフォルトでセキュアな再ネゴシエーション (RFC 5746) が必要です。

拡張機能コードで外部ネットワークへの呼び出しを行う場合、接続先サーバーはセキュアな再ネゴシエーションをサポートしている必要があります。サポートしていないと、リクエストは失敗し、次のようなエラーが発生します。

```text wrap lines theme={null}
Error: write EPROTO C0BAF076:error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:../deps/openssl/openssl/ssl/statem/extensions.c:922:
```

このセキュリティ関連の変更を踏まえ、すべての対象サーバーが安全な再ネゴシエーションをサポートするよう更新されていることを確認することを推奨します。対象のサーバーがお客様の管理下にないサードパーティ製サーバーである場合は、以前の動作を明示的に有効にすることを検討できます。

たとえば、`axios` ライブラリでは、次のコードスニペットはレガシー動作を明示的に有効にする方法を示しています。

```javascript lines theme={null}
const axios = require('axios');
const https = require('https');
const crypto = require('crypto');

axios.get(
  'https://[LEGACY_SERVER]', 
  {
    httpsAgent: new https.Agent(
      {
        secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT
      }
    )
  })
```
