fix(security): reject malformed deployment evidence bytes - #121
Open
seonghobae wants to merge 7 commits into
Open
fix(security): reject malformed deployment evidence bytes#121seonghobae wants to merge 7 commits into
seonghobae wants to merge 7 commits into
Conversation
📝 WalkthroughWalkthrough배포 증거 CLI가 입력 파일과 Wrangler 출력의 UTF-8을 엄격하게 검증합니다. JSON 파싱은 검증된 텍스트를 사용합니다. SHA-256은 원시 바이트를 해시합니다. 정상 및 잘못된 UTF-8 입력 테스트를 추가합니다. Changes배포 증거 UTF-8 처리
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Aug 10, 2026
seonghobae
marked this pull request as ready for review
August 11, 2026 02:05
13 tasks
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/deployment-evidence.mjs`:
- Around line 364-374: Update the evidence-reading flow around readJson and
sha256 to read each file once and reuse the same Buffer for all operations.
Return the Buffer from the shared read helper, perform fatal UTF-8 decoding and
JSON parsing from it, and calculate the SHA-256 digest from that identical
Buffer instead of reopening the path.
In `@test/deployment-evidence-utf8.test.ts`:
- Around line 113-178: Extend the valid CLI fixture test around
runDeploymentEvidence to write a UTF-8 BOM-containing release-evidence.json
Buffer, compute its SHA-256 digest from the original raw Buffer, and assert the
output’s source.releaseEvidenceSha256 matches that digest. Keep the existing
success and output-existence assertions.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eea7882d-fb0f-4dac-96db-c5e10767344b
📒 Files selected for processing (2)
scripts/deployment-evidence.mjstest/deployment-evidence-utf8.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Test-first repair for #120. Production deployment receipt inputs must preserve exact retained-byte identity, reject malformed UTF-8, and bind semantic parsing plus SHA-256 receipts to one stable no-follow descriptor snapshot.
Exact current identity
mainc85d710804139c0697d7ef8fa47d02b1389e6d84;fix/deployment-evidence-fatal-utf8;e33b3abae531ad8491ff3827d798dfa262a0af00;a3cb35011999e1645ed827fdfc741aaa64ad7dc9;f77c03bf0c09013defe88e162d9f43b0f10a0fbd;b60221981ce8faceecb12f576e1b78d8d0aab24c;4731c7e89fb6159848961b118eaab67adc7afcb8;370070ac65f5b3453a39b6a77bf7264bbc966121;main, merge base exactly the live protected head;scripts/deployment-evidence.mjs,test/deployment-evidence-utf8.test.ts.RCA -> distinct boundaries -> GREEN
Three integrity defects were isolated independently:
The current implementation performs bounded regular-file validation, requires real integer
O_RDONLYandO_NOFOLLOW, opens one descriptor, checks descriptor identity/size before and after reading, decodes parsed inputs with fatal UTF-8, and computes release/smoke/KPI SHA-256 values from the same retainedBufferused for semantics. A pathname replacement after the descriptor snapshot cannot change the already-open evidence bytes.The regression suite covers malformed UTF-8, raw-byte digest identity, parse/hash mutation, path-to-symlink replacement, and stable-descriptor pathname replacement while retaining valid deployment/release/KPI/smoke behavior.
Exact current-head proof
For unchanged current head
370070ac65f5b3453a39b6a77bf7264bbc966121:ci31452932940: terminal success;reviewer-ci31452932920: terminal success;Security Scan31452932935: terminal success;COMMENTEDon predecessor7bd0e828fabf618c86d53de969b6f925401e7750, not a qualifyingAPPROVEDreview;Authority boundary
This repair authenticates retained deployment-evidence bytes and file identity only. It does not prove a real production deployment, immutable release publication, production environment governance, real 30-day KPI provenance, owner/legal rights, revenue, transfer evidence, or acquisition readiness. Technical GREEN does not substitute for live governance or qualifying independent non-author approval; #27/#29 remain separate merge-authority gates.
Related: #5, #27, #29, #40, #112, #114, #118, #120