π Description
internal/cryptox/aesgcm.go implements KeyFromB64, EncryptAESGCM, and DecryptAESGCM β the routines that protect stored GitHub OAuth tokens at rest β yet there is no aesgcm_test.go. This security-critical code is completely untested.
π‘ Why it matters: The token-encryption primitives guard credentials at rest; a silent regression here could expose tokens or make them undecryptable.
π§© Requirements and context
- Test round-trip:
Decrypt(Encrypt(x)) == x for various plaintext sizes including empty.
- Test
KeyFromB64 rejects non-32-byte keys and invalid base64.
- Test that two encryptions of the same plaintext differ (random nonce) but both decrypt.
- Test tamper detection: flipping a ciphertext byte makes decryption fail (GCM auth).
- Test decryption of a too-short blob returns an error, not a panic.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
π οΈ Suggested execution
1. Fork the repo and create a branch
git checkout -b test/cryptox-aesgcm
2. Implement changes
- Write/modify the relevant source: none (tests only); add GoDoc if gaps found
- Write comprehensive tests:
internal/cryptox/aesgcm_test.go
- Add documentation: brief package GoDoc on
aesgcm.go
- Include GoDoc comments where behavior is clarified
- Validate security assumptions: confirm nonce uniqueness and AEAD tamper detection
3. Test and commit
go test ./internal/cryptox/... -race
- Cover edge cases: empty plaintext, short blob, wrong key, tampered ciphertext
- Include test output and security notes in the PR description.
Example commit message
test(cryptox): cover AES-256-GCM encrypt/decrypt and key parsing
β
Acceptance criteria
π Security notes
Verifies AEAD integrity and nonce randomness; tests must not hardcode real production keys.
π Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
π Description
internal/cryptox/aesgcm.goimplementsKeyFromB64,EncryptAESGCM, andDecryptAESGCMβ the routines that protect stored GitHub OAuth tokens at rest β yet there is noaesgcm_test.go. This security-critical code is completely untested.π§© Requirements and context
Decrypt(Encrypt(x)) == xfor various plaintext sizes including empty.KeyFromB64rejects non-32-byte keys and invalid base64.Non-functional requirements
π οΈ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
internal/cryptox/aesgcm_test.goaesgcm.go3. Test and commit
go test ./internal/cryptox/... -raceExample commit message
β Acceptance criteria
internal/cryptoxβ₯ 95%π Security notes
Verifies AEAD integrity and nonce randomness; tests must not hardcode real production keys.
π Guidelines