Skip to content

Fix panic due to invalid length ciphertext#144

Merged
bincyber merged 1 commit into
masterfrom
fix/panic-ciphertext
May 16, 2026
Merged

Fix panic due to invalid length ciphertext#144
bincyber merged 1 commit into
masterfrom
fix/panic-ciphertext

Conversation

@bincyber
Copy link
Copy Markdown
Owner

crypto/cipher.AEAD.Open() panics when the nonce length is not NonceSize (12 bytes). bytes.Buffer.Next returns min(n, available), so a truncated ciphertext supplied via EncryptedBytes.Scan or UnmarshalJSON produces a short nonce and crashes the goroutine.

This PR adds explicit minimum-length checks and post-slice length assertions in both the kms and aesgcm providers' Decrypt() paths.

Go version has also been bumped to 1.26

@bincyber bincyber force-pushed the fix/panic-ciphertext branch from b9e245e to 84f4f22 Compare May 16, 2026 05:50
@bincyber bincyber merged commit ff933b2 into master May 16, 2026
4 checks passed
@bincyber bincyber deleted the fix/panic-ciphertext branch May 16, 2026 05:53
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