Skip to content

fix(crypto): harden crypto slots — OAEP padding, cancellation token, input validation - #482

Merged
polterguy merged 4 commits into
masterfrom
fix/crypto-hardening
Dec 6, 2026
Merged

polterguy merged 4 commits into
masterfrom
fix/crypto-hardening

Conversation

@polterguy

Copy link
Copy Markdown
Owner

Summary

Security hardening for the crypto slots, from the manual BouncyCastle usage audit.

Changes

  • RSA encryption now uses OAEP(SHA-256) instead of PKCS#1 v1.5 — closes the Bleichenbacher/Manger chosen-ciphertext padding-oracle class. Decryption failures now surface as a clean HyperlambdaException, and a regression test proves legacy v1.5 ciphertexts are rejected. Note: wire-format breaking for externally stored v1.5 ciphertexts; no committed .hl code uses these slots.
  • crypto.hash file mode now observes the execution token — ComputeHashAsync receives the signaler's cancellation token, so long file hashes respect deadlines like the DB adapters do.
  • Malformed key/signature/password values now throw clean errors — non-string nodes previously coerced to null and surfaced as ungraceful crypto errors; they now throw a HyperlambdaException (3 new regression tests).

Verification

  • magic.lambda.crypto.tests: 109/109 passing.

Replaces PKCS#1 v1.5 with OAEP(SHA-256), closing the Bleichenbacher/Manger
chosen-ciphertext padding-oracle class. Legacy v1.5 ciphertexts are now refused with
a clean HyperlambdaException. Wire-format breaking for externally stored v1.5
ciphertexts; no committed .hl code uses these slots.
Passes the execution token to ComputeHashAsync so a long file hash observes
the deadline, matching the DB adapters.
Non-string key, signature, and password nodes previously coerced to null and
surfaced as ungraceful crypto errors. They now throw a clean HyperlambdaException.
@sonarqubecloud

sonarqubecloud Bot commented Dec 6, 2026

Copy link
Copy Markdown

@polterguy
polterguy merged commit c0c37dd into master Dec 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant