secret-cipher.test.ts fails on Node 26 linked against OpenSSL 4.1

未关闭 适合新手
#1,937 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
nodejs, typescript
领域
backend

调研方向

失败的断言位于 apps/api/src/core/tests/secret-cipher.test.ts 的第 28-33 行和第 45-52 行。解密逻辑位于 apps/api/src/core/secret-cipher.ts,其中 decipher.final() 会抛出异常。在 Node 26 和 OpenSSL 4.1 环境下对该测试文件运行 pnpm exec vitest run,以查看新的 'bad decrypt' 消息。完成标准是测试在 OpenSSL 3.x 和 4.x 上都能通过,可以通过在 decryptSecret 中包装认证失败,或让两个错误字符串都能匹配来实现。

由索引模型根据 Issue 内容生成。

描述

Area: API Bug Difficulty: Low Priority: Low

apps/api/src/core/__tests__/secret-cipher.test.ts asserts the exact OpenSSL 3.x error string 'Unsupported state or unable to authenticate data' when AES-256-GCM decryption fails authentication in two tests:

  • decryptSecret > should throw when the key differs, which is what a rotated SECRET_KEY looks like (apps/api/src/core/__tests__/secret-cipher.test.ts:28-33)
  • decryptSecret > should throw when the ciphertext has been tampered with (apps/api/src/core/__tests__/secret-cipher.test.ts:45-52)

Under Node v26.13.1 linked against OpenSSL 4.1.0 (which satisfies root package.json "engines": { "node": "^24.22.1 || >=26.12.1" }), decipher.final() throws:

Error: error:1C800064:Provider routines::bad decrypt

instead of 'Unsupported state or unable to authenticate data', failing pnpm test:coverage.

Reproduction

On a host with Node v26.13.1 (process.versions.openssl === '4.1.0'), run:

pnpm exec vitest run apps/api/src/core/__tests__/secret-cipher.test.ts
Possible fix

Either normalize decipher.final() authentication failures in decryptSecret (apps/api/src/core/secret-cipher.ts) into an application error message independent of the underlying OpenSSL build, or match both OpenSSL 3.x and OpenSSL 4.x GCM authentication error messages in secret-cipher.test.ts.

主要语言
TypeScript
星标
119
派生
19
平均合并
1 天 18 小时
30 天内合并 PR
61

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DouglasNeuroInformatics/OpenDataCapture 的其他 Issue

查看 DouglasNeuroInformatics/OpenDataCapture 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。