Skip to content

fix(encryptor): reject ciphertext shorter than nonce - #1387

Open
payamkhansalamati wants to merge 1 commit into
semaphoreio:mainfrom
payamkhansalamati:fix/encryptor-short-ciphertext
Open

payamkhansalamati wants to merge 1 commit into
semaphoreio:mainfrom
payamkhansalamati:fix/encryptor-short-ciphertext

Conversation

@payamkhansalamati

@payamkhansalamati payamkhansalamati commented Nov 4, 2026 •

Copy link
Copy Markdown

📝 Description

Validate ciphertext length before slicing the nonce in AESGCMEncryptor.Decrypt, returning an error instead of panicking. Valid decryption and GCM authentication handling remain unchanged.

Seven regression cases cover nil, empty, short nonce, nonce-size boundaries, and truncated payloads using runtime sizes.

Fixes #1305

Validation

  • Reproduced four panic cases before the fix; all seven regression cases pass afterward.
  • Native tests, lint, vet, formatting, module checks, and diff checks passed.
  • Production container build, all 17 container tests, and container lint passed.
  • All four Docker security policies passed with Trivy 0.76.1 at the project's CRITICAL threshold.

Container builds used temporary local network settings for apt/Go downloads. The security suite ran natively against the exported image. No repository configuration changed.

CI rerun passed: 17 tests passed.

I've listened to Semaphore Uncut and would welcome being included among Semaphore's contributors if this contribution is accepted.

✅ Checklist

  • I have tested this change
  • This change requires documentation update (not required)

@payamkhansalamati
payamkhansalamati marked this pull request as ready for review November 5, 2026 12:08
@payamkhansalamati

payamkhansalamati commented Nov 15, 2026 •

Copy link
Copy Markdown
Author

@DamjanBecirovic @adbatista @dexyk @loadez

Hi all,

The tests pass, but the Semaphore pipeline fails during checkout with git@github.com: Permission denied (publickey). Could you check Semaphore’s GitHub repository access and rerun the pipeline on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Handle short ciphertext in AES-GCM Decrypt instead of panicking

1 participant