fix: harden authentication flows

This commit is contained in:
2026-11-19 06:20:38 +00:00
parent 9c4dad9ae3
commit 16a325d5b8
9 changed files with 171 additions and 37 deletions
+3
View File
@@ -65,6 +65,9 @@ func (e *aesEncryption) Decrypt(dec string) (string, error) {
}
nonceSize := gcm.NonceSize()
if len(ciphertext) < nonceSize+gcm.Overhead() {
return "", fmt.Errorf("ciphertext is too short")
}
nonce, ciphertext := ciphertext[:nonceSize], ciphertext[nonceSize:]
plaintext, err := gcm.Open(nil, nonce, ciphertext, nil)