Claus Ibsen created CAMEL-27708:
-----------------------------------

             Summary: camel-consul - the aclToken is sent as a query parameter, 
and received events are logged at INFO
                 Key: CAMEL-27708
                 URL: https://issues.apache.org/jira/browse/CAMEL-27708
             Project: Camel
          Issue Type: Bug
          Components: camel-consul
            Reporter: Claus Ibsen
             Fix For: 4.24.0


h4. 1. The aclToken is sent as a query parameter
{{AbstractConsulProducer.buildQueryOptions()}} copies the {{aclToken}} option 
into {{QueryOptions.token}}. The consul-client {{QueryOptions.toQuery()}} turns 
it into a {{?token=...}} query parameter, so the token is part of the request 
URL. This affects the catalog actions LIST_NODES, LIST_SERVICES, GET_SERVICE 
and GET_NODE, the health actions and the agent DEREGISTER action.
The token is already sent in the {{X-Consul-Token}} header: 
{{ConsulClientConfiguration.createConsulClient()}} calls 
{{Consul.Builder.withAclToken()}}, which adds an interceptor that sets the 
header on every request. A token in a URL ends up in proxy and access logs, and 
Consul has deprecated the {{token}} query parameter in favour of the header. 
When the user configures their own {{consulClient}}, the endpoint {{aclToken}} 
is still added to the URL of these actions, next to the token of that client.
Proposed change: do not put the token into the {{QueryOptions}} and rely on the 
header of the client. With a custom {{consulClient}}, the token configured on 
that client is used (document it, and add an upgrade guide entry).

h4. 2. Received events are logged at INFO
{{ConsulEventConsumer.EventWatcher.onEvent()}} logs every received event with 
{{info("{}", event)}}. The {{toString()}} of the event includes its payload, so 
the content of every event ends up in the log at INFO level.
Proposed change: log the event id and name at DEBUG, and the full event only at 
TRACE.

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to