fix(server): prevent poisoned pending-changes (validate before write, full rollback, delete tool)
- create(): reject secret-pattern payloads and unsafe doc targets BEFORE writing the pending JSON; rejected requests leave no file
- apply(): on validation failure, remove the change's own pending JSON (full rollback, doc + inventory-item paths)
- PendingChangeRepository.delete(): pending/corrupt records deletable, applied records refused
- list()/get()/apply(): tolerate corrupt JSON files (status=corrupt) instead of crashing
- validation.py: reusable scan_text_for_secrets() (behavior of repo-wide scan unchanged)
- MCP: new delete_pending_change tool; update_doc cleans up its pending JSON on failure
- REST: DELETE /changes/{id} (404/409), POST /changes returns 400 on rejection
- tests: test_pending_changes_fix.py (9 cases); updated rollback expectation in test_pending_changes.py
1 parent c9d9ed0 commit c77bcb1a5459cc983027f65a0522e67309a22716
@gmikcon gmikcon authored on 24 Sep
Showing 6 changed files
View
server/app/main.py
View
server/app/mcp_server.py
View
server/app/pending_changes.py
View
server/app/validation.py
View
server/tests/test_pending_changes.py
View
server/tests/test_pending_changes_fix.py 0 → 100644