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

Aperta Adatta ai principianti
#1,937 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
nodejs, typescript
Ambito
backend

Direzione di ricerca

Le asserzioni che falliscono si trovano in apps/api/src/core/tests/secret-cipher.test.ts, alle righe 28-33 e 45-52. La logica di decifratura si trova in apps/api/src/core/secret-cipher.ts, dove decipher.final() genera un'eccezione. Esegui pnpm exec vitest run sul file di test con Node 26 e OpenSSL 4.1 per vedere il nuovo messaggio 'bad decrypt'. È completato quando il test passa sia con OpenSSL 3.x sia con 4.x, avvolgendo il fallimento di autenticazione in decryptSecret oppure facendo corrispondere entrambe le stringhe di errore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
119
Fork
19
Merge medio
1g 18h
PR unite (30g)
61

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DouglasNeuroInformatics/OpenDataCapture

Tutte le issue di DouglasNeuroInformatics/OpenDataCapture

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.