SparqlFederationGuard may miss SERVICE inside EXISTS, aggregates, and ORDER BY on the admin endpoint
Problem
SparqlFederationGuard collects SERVICE endpoints with a plain ElementWalker that only overrides visit(ElementService) and visit(ElementSubQuery) (openmetadata-service/src/main/java/org/openmetadata/service/rdf/federation/SparqlFederationGuard.java:151-175). ElementWalker does not descend into expressions, so a SERVICE clause nested in FILTER EXISTS / NOT EXISTS, BIND, projection expressions, aggregates, GROUP BY/HAVING, or ORDER BY expressions is plausibly invisible to the guard — the same gap the agent endpoint's AgentSparqlQueryInspector had to close explicitly (#33384). The guard's test suite (SparqlFederationGuardTest) has no EXISTS/aggregate/ORDER BY cases either.
Scope
- Admin-only surface (
GET/POST /v1/rdf/sparql,/v1/rdf/sparql/updateareauthorizeAdmin); the agent endpoint (#33384) is not affected — its inspector covers these positions and is tested for them. - Not runtime-verified: confirmed by code inspection only. A reproducer would be
SELECT ?s WHERE { ?s ?p ?o FILTER EXISTS { SERVICE <https://example.org/sparql> { ?s ?p ?o } } }throughSparqlFederationGuard.serviceEndpoints/enforce.
Suggested fix
Extend the guard's traversal to expression positions (mirroring AgentSparqlQueryInspector's explicit recursion into subqueries, EXISTS/NOT EXISTS, aggregates, and ORDER BY), plus regression tests for each position.