nodejs / nodejs/node

setFips() / setEngine do not evict ciphers cache

オープン
#62,982 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

crypto
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

> require('crypto').getCiphers().length
130
> require('crypto').setFips(true)
undefined
> require('crypto').getCiphers().length
130

but

> require('crypto').setFips(true)
undefined
> require('crypto').getCiphers().length
0

Also (unverified):

getCiphers memoizes the cipher name list forever (cachedResult(() => filterDuplicateStrings(_getCiphers()))). When setEngine(id, flags) (also exported from this module) successfully loads an OpenSSL engine that registers additional ciphers, those new ciphers are not reflected in subsequent getCiphers() results because the cache is never invalidated. Similarly, on BoringSSL builds the cache is force-populated during module initialization via conditionalAlgorithms (the 'ChaCha20-Poly1305' probe calls getCiphers()), freezing the answer before any user code runs. The sibling _hashCache helper in the same file explicitly clears on snapshot build / dynamic-link scenarios via addSerializeCallback; getCiphers has no such mechanism.

getHashes returns a permanently-cached list from _getHashes() (via cachedResult). After a successful setEngine(id, flags) call (exported from this same module) loads an OpenSSL engine that registers new digest algorithms, getHashes() will continue to return the pre-engine snapshot. Downstream consumers — including this file's own conditionalAlgorithms gates for cSHAKE*/SHA3-*/ChaCha20-Poly1305 (evaluated once at module-load, so already locked in) and any external callers using crypto.getHashes() — will not observe engine-provided hashes. Contrast with the sibling getHashCache (line 81–91) which is explicitly designed to be refreshed.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

cachedResult、setFips、setEngine、conditionalAlgorithms、および 81–91 行目の getHashCache ヘルパーを含む crypto モジュールのファイルを特定します。getCiphers と getHashes がどのようにキャッシュされるか、また既存のキャッシュ更新動作がどのように機能するかを追跡します。完了条件は、成功した FIPS または engine の変更が、その後のアルゴリズム一覧の結果に反映されることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
security
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。