Add error-path tests for HybridDecrypter.Decrypt in the crypto package
Los mantenedores suelen responder en 2 días
@gangadhar-res ya está trabajando en esto.
Desde el 12/8/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
Línea de trabajo
Comienza con Decrypt de hybrid.go y el TestHybridEncryptDecrypt existente; después revisa TestNewAESEncryptDecrypterInvalidKey y TestAESEncryptDecrypt para conocer el estilo testify del paquete y la configuración de las claves de testdata. Añade cobertura para las cinco rutas de error indicadas y ejecuta las pruebas del paquete crypto; se considera terminado cuando el base64 no válido, las longitudes malformadas, la manipulación de RSA y la manipulación de AES-GCM devuelven errores.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What would you like to be added:
I'd like to add unit tests for the error paths in HybridDecrypter.Decrypt(). Right now the only test we have (TestHybridEncryptDecrypt) just tests the happy path — encrypt something valid, decrypt it back, make sure it matches. But the Decrypt function has around 5 different ways it can fail, and none of them are tested.
My plan is to add a table-driven test that covers:
- Passing in garbage that isn't valid base64
- Passing in data that's too short to even read the RSA length header
- Passing in data where the declared RSA length is bigger than what's actually there
- Tampering with the RSA ciphertext portion so RSA OAEP decryption fails
- Tampering with the AES-GCM ciphertext portion so the authentication check fails — this is the one that worries me most because if someone accidentally breaks that GCM auth check, tampered secrets would just pass through silently
I've already looked at how the rest of the crypto package does tests (TestNewAESEncryptDecrypterInvalidKey, TestAESEncryptDecrypt, etc.) and I'll match that same style — testify/require and testify/assert, same-package tests, reading keys from testdata/.
Why is this needed:
I was reading through hybrid.go and noticed the Decrypt function has quite a few places where it can return errors, but none of them have tests. The one that really stood out to me is the AES-GCM authentication check on line 143 (aed.Open). That's the function that verifies the ciphertext hasn't been tampered with. If someone accidentally broke that check in a refactor, we might not catch it because the only test just tests valid data.
Since this crypto code is what powers PipeCD's sealed secrets feature, I think it's worth having these tests in place. Better to catch a regression early than to have tampered secrets slip through.
If this approach aligns with what you had in mind, I can go ahead and put together the implementation. If you'd prefer a different structure or have additional cases you want covered, just let me know.... happy to adjust!
- Lenguaje dominante
- Go
- Estrellas
- 1.4k
- Forks
- 391
- Merge medio
- 4 d 1 h
- PR fusionados (30 d)
- 58
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pipe-cd/pipecd
-
Applications at the repository root are not triggered by new commitsPosiblemente ocupada @Daksha1611 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
pipedv1 kubernetes plugins ignore trafficRouting.istio.host in K8S_TRAFFIC_ROUTINGPosiblemente ocupada @Dhirenderchoudhary la tomó hoy. Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 74/100
pipe-cd/pipecd#7626 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
pipectl transfer restore application drops backed-up labelsPosiblemente ocupada @bhavishyajain545 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
pipe-cd/pipecd#7622 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 2 días
Todos los issues de pipe-cd/pipecd
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
docker-compose: postgres healthcheck should probe TCP (pg_isready -h localhost)Posiblemente ocupada @zezo-mohamed22 la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
OneBusAway/watchdog#305 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
self-care self-care:agent-discoverability
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
githubnext/gh-cao#20928 ·
Los mantenedores suelen responder en 1 día
-
automation documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
SocialGouv/iterion#3287 ·
Los mantenedores suelen responder en 1 día