Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

fix(ingest): reject truncated XML documents

Rudy Celekliee0217c88beb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6646495d..bff6d769 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ All notable changes to Open Ontologies are documented here.
### Fixed
+- Reject truncated XML data documents instead of reporting an incomplete prefix as a successful ingestion.
+
- Keep the last active ontology intact when parsing a replacement source, cache, or refresh fails; publish successful replacements in one graph transaction.
- Bound wildcard repository filtering to pattern/filename pairs so repeated stars cannot stall `onto_repo_list`.
- Sanitize quotes and ASCII control bytes in mapped IRI components so valid structured data does not fail RDF ingestion.
diff --git a/src/ingest.rs b/src/ingest.rs
index 0dd38959..c3f82790 100644
--- a/src/ingest.rs
+++ b/src/ingest.rs
@@ -245,7 +245,16 @@ impl DataIngester {
}
depth -= 1;
}
- Ok(Event::Eof) => break,
+ Ok(Event::Eof) => {
+ // quick-xml accepts EOF with unclosed elements. Do not
+ // report a completed prefix as a successful ingestion.
+ if depth != 0 {
+ anyhow::bail!(
+ "XML parse error: unexpected EOF with {depth} unclosed elements"
+ );
+ }
+ break;
+ }
Err(e) => return Err(anyhow::anyhow!("XML parse error: {e}")),
_ => {}
}