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

Đang mở Phù hợp với người mới
#1,937 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nodejs, typescript
Lĩnh vực
backend

Hướng nghiên cứu

Các assertion đang lỗi nằm trong apps/api/src/core/tests/secret-cipher.test.ts ở dòng 28-33 và 45-52. Logic giải mã nằm trong apps/api/src/core/secret-cipher.ts, nơi decipher.final() ném ra lỗi. Chạy pnpm exec vitest run trên file test với Node 26 và OpenSSL 4.1 để xem thông báo 'bad decrypt' mới. Hoàn thành khi test vượt qua trên cả OpenSSL 3.x và 4.x, bằng cách bọc lỗi xác thực trong decryptSecret hoặc khớp cả hai chuỗi thông báo lỗi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
119
Fork
19
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
61

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DouglasNeuroInformatics/OpenDataCapture

Tất cả issue của DouglasNeuroInformatics/OpenDataCapture

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.