Refs #406: Guard nested proof metadata control chars#551
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughHidden review stack artifactWalkthroughThis PR extends proof metadata control-character validation from checking only top-level string values to recursively validating nested ChangesMetadata Control-Character Validation
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0c87e17c-1a08-482c-a748-20a964bbcbe6
📒 Files selected for processing (2)
app/ledger/service.pytests/test_security.py
|
Reviewed PR #551 at Evidence checked:
Validation:
Assessment: no blocker found. The patch is narrowly scoped to proof metadata cleanup and adds regression coverage for the public-proof persistence boundary. |
|
Follow-up for CodeRabbit recursion concern:
Validation after the follow-up commit
|
|
Additional local validation after follow-up commit |
eliasx45
left a comment
There was a problem hiding this comment.
Reviewed current head c0e893726fa917b70768f40b593eb19ada50aa83 after the recursive/self-referential metadata follow-up.
No blocker found. The proof metadata cleaner now recursively rejects control characters in nested verifier-result values, list elements, and object keys before public proof JSON or submission verifier JSON is persisted. The follow-up also keeps that recursive pass inside the metadata-cleaning error boundary, so self-referential or too-deep verifier metadata is converted into a bounded LedgerError("verifier_result is too deeply nested") rather than escaping as an unhandled recursion failure. Safe nested metadata is still preserved in both Proof.public_json and Submission.verifier_result.
Validation run locally on this head:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_security.py::test_bounty_payment_proof_rejects_nested_control_character_metadata tests\test_security.py::test_bounty_payment_proof_rejects_recursive_metadata tests\test_security.py::test_bounty_payment_proof_preserves_safe_nested_metadata -q-> 5 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_security.py tests\test_ledger.py -q-> 75 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest -q-> 419 passed.\.venv\Scripts\python.exe -m ruff check app\ledger\service.py tests\test_security.py-> passed.\.venv\Scripts\python.exe -m ruff format --check app\ledger\service.py tests\test_security.py-> 2 files already formattedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m mypy app\ledger\service.py-> successPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe scripts\docs_smoke.py-> docs smoke okgit diff --check origin/main...HEAD-> clean
Hosted Quality/readiness and CodeRabbit are green. This looks mergeable from my reviewed slice.
barnacleagent-svg
left a comment
There was a problem hiding this comment.
Verdict: APPROVED
Scope: Guards nested proof metadata control chars with recursive _reject_metadata_control_chars function. Handles strings, dicts, lists recursively. Also adds RecursionError protection.
Checklist:
- Recursive validation covers all nesting levels
- Replaces flat iteration with proper recursive check
- Adds RecursionError catch for safety
- Tests cover nested scenarios
Conclusion: Well-implemented security hardening. Ready to merge.
Summary
Evidence
Validation
Refs #406
Summary by CodeRabbit
Bug Fixes
Tests