fix(mcp): harden stdio opens, commits and user-supplied ranges

- Check per call that synapse.db exists and is on this binary's schema, so
  the stdio server never migrates or re-stamps the app's live database.
- Keep the transaction open (rolled back on drop) when COMMIT fails.
- Reject dates outside years 1000-9999 and oversized cursors (overflow).
- core: export SCHEMA_VERSION.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-26 16:22:14 +01:00
1 parent 0253cd4180
commit 4195374c23
5 files changed
+115 -4

No files matched your search

+25
View File
@@ -620,3 +620,28 @@ fn resources_render_pages() {
let out = read(&g, |g| tools::page_resource(g, "Dune"));
assert!(out.contains("- Arrakis is a desert planet\n"), "{out}");
}
#[test]
fn extreme_dates_and_cursors_are_rejected() {
let (_d, g) = fixture();
let e = read_err(&g, |g| {
tools::timeline(
g,
&RangeParams {
from: None,
to: Some("-262143-01-03".into()),
},
)
});
assert!(e.contains("bad date"), "{e}");
let e = read_err(&g, |g| {
tools::list_pages(
g,
&ListPagesParams {
cursor: Some(usize::MAX.to_string()),
..Default::default()
},
)
});
assert!(e.contains("bad cursor"), "{e}");
}