Skip to content

fix(security): fail closed on malformed reviewer source bytes - #166

Merged
seonghobae merged 4 commits into
mainfrom
fix/reviewer-strict-utf8-evidence
Aug 11, 2026
Merged

fix(security): fail closed on malformed reviewer source bytes#166
seonghobae merged 4 commits into
mainfrom
fix/reviewer-strict-utf8-evidence

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #165.

RCA / remedy

Protected main decoded exact current-head GitHub contents bytes with decode("utf-8", errors="replace"). Malformed bytes were therefore silently normalized to U+FFFD and supplied to the reviewer as if they were exact source evidence.

The narrow repair makes changed-file text decoding strict UTF-8. A malformed current-head blob is retained as an empty changed-file context plus an explicit evidence_failures entry, so the reviewer cannot produce an approval from lossy reconstructed source while normal UTF-8 and unavailable/deleted-content handling remain unchanged.

Exact test-first proof

  • RED 09e2618126c12ecf7be294f2fd2d22cb957d94b8: reviewer-ci run 31494975898 checked out that exact head and failed only test_invalid_utf8_changed_file_is_not_normalized_into_review_evidence; actual source evidence was before�after instead of the required empty fail-closed context. 120 other reviewer tests passed. The RED head's application CI and central scan do not override the failing reviewer gate.
  • GREEN 4889ad1d0a8d513014e63a26820d305d4f4ae926: application ci 31495630113, reviewer-ci 31495630235, and protected-base eligible central Security Scan 31495630128 all completed success.
  • Exact GREEN reviewer proof: 121/121 tests pass; reviewer source totals 632 statements / 150 branches with 0 misses/partials = 100% line+branch coverage; docstring gate = 100%; real no-network CodeGraph sandbox smoke passes; authenticated distroless sandbox image scan reports 0 vulnerabilities.
  • Exact base remains protected main c85d710804139c0697d7ef8fa47d02b1389e6d84.
  • Fresh formal reviews: 0. Fresh review threads: 0. Green checks/scanners are not independent approval.

Evidence boundary

This repair protects reviewer source integrity only. It is not production/release/legal/acquisition evidence and does not relax the repository's live governance or independent-review requirements.

Summary by CodeRabbit

  • 버그 수정

    • UTF-8로 해석할 수 없는 변경 파일이 포함되어도 전체 매니페스트 생성이 중단되지 않습니다.
    • 문제가 있는 파일은 빈 콘텐츠로 처리되고 UTF-8 관련 증거 실패가 기록됩니다.
    • 잘못된 바이트가 대체 문자로 변환되지 않아 파일 콘텐츠가 정확하게 표시됩니다.
  • 테스트

    • 비 UTF-8 변경 파일 처리에 대한 회귀 테스트를 추가했습니다.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a4761ea-e400-4722-84e4-753bd0cf4393

📥 Commits

Reviewing files that changed from the base of the PR and between c85d710 and 4889ad1.

📒 Files selected for processing (2)
  • reviewer/noema_reviewer/github_io.py
  • reviewer/tests/test_github_io_utf8_boundary.py

📝 Walkthrough

Walkthrough

GitHub 변경 파일 콘텐츠의 UTF-8 디코딩을 엄격하게 처리합니다. 잘못된 바이트는 빈 콘텐츠와 증거 실패로 기록합니다. 다른 파일 처리는 계속합니다. 해당 동작을 검증하는 회귀 테스트를 추가합니다.

Changes

UTF-8 증거 처리

Layer / File(s) Summary
엄격한 디코딩과 파일별 실패 처리
reviewer/noema_reviewer/github_io.py, reviewer/tests/test_github_io_utf8_boundary.py
Base64 콘텐츠를 엄격히 UTF-8로 디코딩합니다. 디코딩 오류가 발생한 파일은 경로를 유지하고 빈 콘텐츠와 증거 실패를 기록합니다. 회귀 테스트는 U+FFFD가 생성되지 않는지 검증합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 잘못된 UTF-8 리뷰 소스 바이트를 fail closed로 처리하는 핵심 변경을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed 변경은 엄격한 UTF-8 디코딩, 명시적 evidence_failures 기록, 기존 정상·삭제 파일 처리를 포함하여 이슈 #165의 요구사항을 충족합니다.
Out of Scope Changes check ✅ Passed 변경은 GitHub 파일 디코딩 수정과 해당 회귀 테스트로 제한되며, 이슈 #165의 범위를 벗어난 변경이 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/reviewer-strict-utf8-evidence

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae merged commit fa62a30 into main Aug 11, 2026
16 checks passed
@seonghobae
seonghobae deleted the fix/reviewer-strict-utf8-evidence branch August 11, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security(reviewer): fail closed on invalid UTF-8 changed-file evidence

1 participant