Add error-path tests for HybridDecrypter.Decrypt in the crypto package
Maintainer thường phản hồi trong vòng 2 ngày
@gangadhar-res đang làm issue này rồi.
Từ ngày 12/8/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu với Decrypt trong hybrid.go và TestHybridEncryptDecrypt hiện có, sau đó xem lại TestNewAESEncryptDecrypterInvalidKey và TestAESEncryptDecrypt để nắm được phong cách testify của package và cách thiết lập khóa testdata. Bổ sung coverage cho năm đường dẫn lỗi được liệt kê và chạy các test của package crypto; hoàn thành khi base64 không hợp lệ, độ dài sai định dạng, dữ liệu RSA bị can thiệp và dữ liệu AES-GCM bị can thiệp đều trả về lỗi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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!
- Ngôn ngữ chính
- Go
- Star
- 1.4k
- Fork
- 391
- Merge trung bình
- 4 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 58
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pipe-cd/pipecd
-
Applications at the repository root are not triggered by new commitsCó thể đã có người làm @Daksha1611 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
pipedv1 kubernetes plugins ignore trafficRouting.istio.host in K8S_TRAFFIC_ROUTINGCó thể đã có người làm @Dhirenderchoudhary đã nhận hôm nay. Đang mở
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 74/100
pipe-cd/pipecd#7626 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
pipectl transfer restore application drops backed-up labelsCó thể đã có người làm @bhavishyajain545 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
pipe-cd/pipecd#7622 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của pipe-cd/pipecd
Issue tương tự
-
IsTextFile reads the whole file into memory (OOM on large files in the file watcher)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
gtsteffaniak/filebrowser#3395 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort:s impact:low raised-by:worker risk:low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
medici-finance/assay#6496 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/bug require/reproduce require/severity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100