Colm O hEigeartaigh created CXF-9284:
----------------------------------------
Summary: Schema validation is silently disabled when the service
schema cannot be built
Key: CXF-9284
URL: https://issues.apache.org/jira/browse/CXF-9284
Project: CXF
Issue Type: Improvement
Reporter: Colm O hEigeartaigh
Assignee: Colm O hEigeartaigh
Fix For: 4.3.0
*Summary:*
When schema validation is enabled, {{EndpointReferenceUtils.getSchema()}}
compiles the service’s schemas on first use and caches the result. If
compilation fails for any reason (an invalid or unresolvable import, an import
blocked by {{{}allowedSchemes{}}}, or a temporary network error fetching a
remote import), it logs the failure, caches a {{null}} schema and marks the
service as checked, so it never tries again. The validation interceptors
({{{}AbstractInDatabindingInterceptor{}}},
{{{}AbstractOutDatabindingInterceptor{}}}, {{{}SoapOutInterceptor{}}},
{{{}SoapHeaderInterceptor{}}}, {{{}WebFaultOutInterceptor{}}},
{{{}MessageModeOutInterceptor{}}}) then pass that {{null}} to the reader or
writer, so no validation is performed. The endpoint accepts every message
although validation is configured, and the only sign is a single log line.
This fails open: deployments relying on schema validation to reject malformed
input lose that protection without noticing. And because the failure is cached,
a temporary error on the first request disables validation until the
application restarts.
*Proposed changes (4.3.0):*
# Fail closed by default: when schema validation is enabled but the schema
can’t be built, reject messages with a {{Fault}} instead of skipping validation.
# Add an opt-out setting that restores the old behaviour (log and continue
without validation), for deployments that knowingly run with a schema that
doesn’t compile.
# Stop caching failures that may be temporary: retry the build after a delay,
with backoff, so a network error on the first request doesn’t disable
validation (or, with the new default, reject every message) until the
application restarts.
# Document the change and the opt-out setting in the 4.3.0 migration notes.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)