Repository navigation
Conversation
PR validation — ✅ 3 passing
AI Session Checks — ⏭️ bypassed by labelAI Coding Session Check BypassedThis PR carries the Learn more about Chainloop Trace. Security Checks — ✅ 5 passing✅
|
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
Scans not applied (3)
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
iac-scan |
no IaC files changed |
Security context
✅ Nothing this change touches has a recorded security-fix history.
View in Chainloop ↗ · How this works ↗
Powered by Chainloop and Chainloop Trace
|
Thanks for the contribution, could you please sign make sure the commits are signed? |
b3705b1 to
23c286c
Compare
|
Thanks! The commit is now signed (SSH signature, shows as Verified). The content and the DCO sign-off are unchanged. |
|
Sorry, there seems to be some conflicts, could you resolve them please, thanks! |
Fixes chainloop-dev#3600 Signed-off-by: Khanh Dinh Nguyen <77538987+beiryu@users.noreply.github.com>
23c286c to
4fda84e
Compare
A row too short to hold the magic prefix is a truncated or tampered value; report it like any other value that does not decrypt to the prefix, as the tampered-row integration test expects. Signed-off-by: Khanh Dinh Nguyen <77538987+beiryu@users.noreply.github.com>
|
@migmartri sorry, I had to push one more commit after your approval (b30a8ac), so the approval was dismissed.
The commit now returns |
Fixes #3600
decryptinapp/controlplane/pkg/biz/attestationstate.gochecked the salt and IV lengths but not the length of the remaining data before comparing it with the magic prefix. A stored value of 32 to 44 bytes passed the earlier checks and then caused a slice-out-of-range panic.This change adds a
len(ciphertext) < len(magic)check before the comparison, so a truncated or corrupted value now returns an error.This does not cover the second point in the issue (moving to an authenticated cipher such as AES-GCM). That needs a format change and a migration path for existing rows, so it is left for a separate change.
Testing
TestDecryptShortInputinattestationstate_test.go. It callsdecryptwith inputs of salt + IV only, one byte after the IV, and one byte short of the magic prefix. It checks that there is no panic and that an error is returned.TestEncryptDecryptRoundTripto check that normal encrypt and decrypt still work.The decrypt function could panic on a truncated database value. I wanted it to return an error, so one bad row does not crash the request.