Andrea Cosentino created CAMEL-28045:
----------------------------------------
Summary: camel-huaweicloud-frs: the client is published
unsynchronized, a WARN is logged per message, and frsClient is not a URI option
Key: CAMEL-28045
URL: https://issues.apache.org/jira/browse/CAMEL-28045
Project: Camel
Issue Type: Bug
Reporter: Andrea Cosentino
Found during an audit of the cloud components (camel-aws, camel-azure,
camel-google, camel-huawei) at commit 7c0644752e17. Every item below was
verified against the source.
h4. 1. The lazily created FrsClient is published without synchronization
{{FaceRecognitionProducer}} holds {{private FrsClient frsClient;}} as a plain
instance field on a producer shared by all concurrent exchanges, and
{{process()}} does {{if (frsClient == null) initializeSdkClient(...)}}. Two
threads can each build a full FrsClient, with two HTTP connection pools, and a
thread can observe a partially published client.
Proposed change: build the client in {{doStart()}} - it depends only on
endpoint options, nothing per-exchange.
h4. 2. initializeConfigurations runs on every exchange
It is called at the top of {{process()}}, so it re-resolves AK/SK, projectId
and the endpoint on every message although the result is used only the first
time, and it re-logs "SSL verification is ignored. This is unsafe in production
environment" once per message when {{ignoreSslVerification=true}}. A busy route
floods the log at message rate.
h4. 3. frsClient is not a @UriParam
{{FaceRecognitionEndpoint}} declares {{private FrsClient frsClient;}} with a
public getter and setter but no annotation, so it is absent from the catalog
json and from the generated {{FaceRecognitionEndpointConfigurer}}; binding
falls back to reflection, which is what breaks under Camel Quarkus and native.
The module's own test sets it through the URI ({{&frsClient=#frsClient}}). The
same shape is in OBSEndpoint, IAMEndpoint and DMSEndpoint.
h4. 4. required = true on options that have a documented alternative
{{region}} is required although its own description says the {{endpoint}}
option replaces it, and {{accessKey}}/{{secretKey}} are required although the
{{serviceKeys}} option supplies them. The catalog therefore reports a valid URI
as incomplete.
h4. 5. Smaller issues
All 11 FaceRecognitionProperties constants are read with
{{exchange.getProperty(...)}} and none carries {{@Metadata}}, so the component
declares no headers at all and the values cannot be set by an upstream
component.
{{FaceRecognitionProducer}} imports {{java.io.*}} and
{{FaceRecognitionComponent}} imports {{java.util.*}} (only Map is used).
Of the 24 test files, 9 are {{@Disabled}} "real" tests and the mocks use
{{FrsClientMock extends FrsClient}} with {{super(null)}}, so nothing about
client construction, credentials, region to endpoint lookup, proxy or
ignoreSslVerification is exercised.
The producer switch itself is correct: I compared all nine operation x source
branches and found no wrong constant, no wrong setter and no mismatched
message; {{ignoreSslVerification}} does carry {{security = "insecure:ssl"}},
and the proxy options are applied.
_Claude Code on behalf of oscerd_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)