setFips() / setEngine do not evict ciphers cache
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
> 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):
getCiphersmemoizes the cipher name list forever (cachedResult(() => filterDuplicateStrings(_getCiphers()))). WhensetEngine(id, flags)(also exported from this module) successfully loads an OpenSSL engine that registers additional ciphers, those new ciphers are not reflected in subsequentgetCiphers()results because the cache is never invalidated. Similarly, on BoringSSL builds the cache is force-populated during module initialization viaconditionalAlgorithms(the'ChaCha20-Poly1305'probe callsgetCiphers()), freezing the answer before any user code runs. The sibling_hashCachehelper in the same file explicitly clears on snapshot build / dynamic-link scenarios viaaddSerializeCallback;getCiphershas no such mechanism.
getHashesreturns a permanently-cached list from_getHashes()(viacachedResult). After a successfulsetEngine(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 ownconditionalAlgorithmsgates forcSHAKE*/SHA3-*/ChaCha20-Poly1305 (evaluated once at module-load, so already locked in) and any external callers usingcrypto.getHashes()— will not observe engine-provided hashes. Contrast with the siblinggetHashCache(line 81–91) which is explicitly designed to be refreshed.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
定位包含 cachedResult、setFips、setEngine、conditionalAlgorithms 以及第 81–91 行 getHashCache helper 的 crypto 模块文件。跟踪 getCiphers 和 getHashes 如何被缓存,以及现有的缓存刷新行为如何工作;完成标准是成功的 FIPS 或 engine 更改会反映在后续的算法列表结果中。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- security
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100