Andrea Cosentino created CAMEL-24499:
----------------------------------------

             Summary: camel-spring-boot - actuator health and route detail 
views emit more than the configured exposure level
                 Key: CAMEL-24499
                 URL: https://issues.apache.org/jira/browse/CAMEL-24499
             Project: Camel
          Issue Type: Improvement
          Components: camel-spring-boot
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


Two independent spots in the actuator output emit more detail than the 
surrounding code intends.

*1. Health details always include a full stack trace*

{code:java}
result.getError().ifPresent(error -> {
    if (error.getMessage() != null) {
        builder.withDetail("error.message", error.getMessage());
    }
    final StringWriter stackTraceWriter = new StringWriter();
    try (final PrintWriter pw = new PrintWriter(stackTraceWriter, true)) {
        error.printStackTrace(pw);
        data.put("error.stacktrace", stackTraceWriter.toString());
    }
});
{code}

(CamelHealthHelper:69)

The block sits outside the {{exposureLevel.equals("full")}} branch a few lines 
above, so the stack trace is added at the {{default}} exposure level too. 
Spring Boot's own indicators expose exception class and message, not the trace.

*2. Route detail view drops the properties filter (regression from CAMEL-20993)*

{{RouteEndpointInfo}} annotates its properties map:

{code:java}
@JsonIgnoreProperties(value = {"route.start.exception"})
private final Map<String, Object> properties;
{code}

but {{RouteDetailsEndpointInfo}}, which extends it, re-declares the field 
without the annotation:

{code:java}
public static class RouteDetailsEndpointInfo extends RouteEndpointInfo {
    @JsonProperty("details")
    private RouteDetails routeDetails;
    private final Map<String, Object> properties;
{code}

(CamelRoutesEndpoint:279)

Both the annotation and the shadowing field were introduced in the same commit 
under CAMEL-20993, so the filter was clearly intended - the subclass field 
simply escapes it, and the detail operation serialises the property the base 
view filters.

*Proposal*

- Restrict {{error.stacktrace}} to the {{full}} exposure level, or replace it 
with exception class + message and keep the full trace in the server log.
- Remove the shadowing {{properties}} field and getter from 
{{RouteDetailsEndpointInfo}} and reuse the annotated base-class property.
- Add a test asserting a route with a start exception does not surface it 
through the detail operation.

----
_This issue was drafted by Claude Code on behalf of Andrea Cosentino._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to