|
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
|
|---|
|
|
| server/app/main.py |
|---|
| server/app/mcp_server.py |
|---|
| server/app/pending_changes.py |
|---|
| server/app/validation.py |
|---|
| server/tests/test_pending_changes.py |
|---|
| server/tests/test_pending_changes_fix.py 0 → 100644 |
|---|