Release v0.8.2 — Security & resilience hardening#10
Merged
senseibelbi merged 2 commits intomainfrom Apr 16, 2026
Merged
Conversation
…draft audit chain, and add ontology drift scaffold Security & resilience hardening based on ToxMCP Audit Reviewed v2: - Phase 1 (AOP-01): TemplateCatalog.render_safe() with escaped literals, validated URIs, and separated trusted structural fragments. All adapters migrated from unsafe .format() interpolation. - Phase 2 (AOP-02): Per-endpoint circuit breaker + exponential backoff with jitter in SparqlClient._dispatch(). - Phase 3 (AOP-03/AOP-04): Mandatory checksums, checksum_algorithm field, ElectronicSignature support, and hardened verify_audit_chain(). - Phase 4 (AOP-05): Configurable CurieResolver, AOP_CURIE_RESOLVER, and OntologyMigrator scaffold for version-driven migrations. README updated with v0.8.2 changelog. 231 unit tests passing.
- Fix circuit breaker defaults: success_threshold=1 to match half_open_max_calls=1. - Reset success_count when transitioning OPEN -> HALF_OPEN. - Exclude SparqlQueryError (4xx) from circuit breaker failure counting. - Strengthen URI validation to reject SPARQL-breaking characters. - Escape newline, carriage return, and tab in SPARQL literal rendering. - Remove dangling inchikey parameter from map_chemical_to_aops. - Make backoff test deterministic with monkeypatched sleep and random.uniform. - All 231 unit tests passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR bumps the AOP MCP server to v0.8.2 and implements security / resilience hardening based on the ToxMCP Audit Reviewed v2 findings.
Key changes
Hardened SPARQL query construction (AOP-01)
TemplateCatalog.render_safe()with categorized parameter binding: escaped string literals, scheme-validated URIs, cast integers, and explicitly separated trusted structural fragments.aop_wiki.py,aop_db.py) away from unsafetemplate.format(**params)interpolation.map_chemical_to_aopsby constructing the URI safely in Python withurllib.parse.quote.Resilience controls for SPARQL endpoints (AOP-02)
CircuitBreakerwith CLOSED / OPEN / HALF_OPEN states.SparqlClient._dispatch().SparqlQueryError) are surfaced immediately and do not count as circuit-breaker failures.Strengthened draft audit chain (AOP-03 / AOP-04)
VersionMetadatanow enforceschecksumandprevious_checksumas required fields.checksum_algorithm(defaultsha256-v1) so the verification algorithm is explicit.ElectronicSignaturesupport withauthored/reviewed/approved/rejectedsemantics.verify_audit_chain()to reject unsupported algorithms, empty checksums, and broken chains.Ontology drift protection scaffold (AOP-05)
_iri_to_curie()logic with configurableCurieResolverand a sharedAOP_CURIE_RESOLVER.OntologyMigratorframework with BFS pathfinding and term-mapping support insrc/semantic/migration.py.Follow-up fixes (post-review)
Addressed all Copilot code-review comments:
success_threshold=1).success_counton OPEN → HALF_OPEN transitions.SparqlQueryErrorfrom circuit-breaker failure counting.<>"{}|^and whitespace).\n,\r,\tin SPARQL literal rendering.inchikeyparameter frommap_chemical_to_aops(was accepted but never used in the query template).asyncio.sleepandrandom.uniform.Verification
tools/list,search_aops,get_aop)Version bump
pyproject.toml:0.8.1→0.8.2src/server/version.py:0.8.1→0.8.2