[
https://issues.apache.org/jira/browse/CAMEL-27708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27708:
--------------------------------
Description:
h4. 1. The aclToken is sent as a query parameter
{{ConsulClientConfiguration.createConsulClient()}} configures the client with
{{Consul.Builder.withAclToken(aclToken)}}. In consul-client 1.12.2 this adds an
okhttp interceptor that appends {{?token=...}} (or {{&token=...}}) to the URL
of every request; it does not set the {{X-Consul-Token}} header
({{withTokenAuth()}} does). In addition,
{{AbstractConsulProducer.buildQueryOptions()}} copies the {{aclToken}} option
into {{QueryOptions.token}}, which {{QueryOptions.toQuery()}} also turns into a
{{token}} query parameter, so the catalog actions LIST_NODES, LIST_SERVICES,
GET_SERVICE and GET_NODE, the health actions and the agent DEREGISTER action
send it twice in the URL.
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: create the client with {{withTokenAuth(aclToken)}} (the
{{X-Consul-Token}} header) and do not put the token into the {{QueryOptions}}.
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_
was:
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_
> 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
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> h4. 1. The aclToken is sent as a query parameter
> {{ConsulClientConfiguration.createConsulClient()}} configures the client with
> {{Consul.Builder.withAclToken(aclToken)}}. In consul-client 1.12.2 this adds
> an okhttp interceptor that appends {{?token=...}} (or {{&token=...}}) to the
> URL of every request; it does not set the {{X-Consul-Token}} header
> ({{withTokenAuth()}} does). In addition,
> {{AbstractConsulProducer.buildQueryOptions()}} copies the {{aclToken}} option
> into {{QueryOptions.token}}, which {{QueryOptions.toQuery()}} also turns into
> a {{token}} query parameter, so the catalog actions LIST_NODES,
> LIST_SERVICES, GET_SERVICE and GET_NODE, the health actions and the agent
> DEREGISTER action send it twice in the URL.
> 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: create the client with {{withTokenAuth(aclToken)}} (the
> {{X-Consul-Token}} header) and do not put the token into the
> {{QueryOptions}}. 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)