Andrea Cosentino created CAMEL-28028:
----------------------------------------

             Summary: camel-aws2-ses: the producer health check reports UP 
after an AWS service error, and its probe needs a separate permission
                 Key: CAMEL-28028
                 URL: https://issues.apache.org/jira/browse/CAMEL-28028
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
            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 health check is UP when SES returns a service error
{{Ses2ProducerHealthCheck.doCall}}: the {{catch (AwsServiceException e)}} block 
calls {{builder.down()}} but, unlike the {{catch (Exception e)}} block right 
below it and unlike every sibling module, it does not {{return}}. Execution 
falls through to {{builder.up()}} at the end of the method, which sets the 
state back to UP. Throttling, an unreachable endpoint and rejected credentials 
are therefore all reported as healthy; only a non-AWS exception reports DOWN. 
The block also skips the SERVICE_STATUS_CODE and SERVICE_ERROR_CODE details 
that cw, ecs and eks add.
Proposed change: return after {{builder.down()}}, and add the two details like 
the siblings.

h4. 2. The probe calls GetSendStatistics
The check always calls {{client.getSendStatistics()}}. 
{{ses:GetSendStatistics}} is a different IAM action from 
{{ses:SendEmail}}/{{ses:SendRawEmail}}, so a route that is correctly configured 
to send mail under a least-privilege policy is reported DOWN with AccessDenied 
(today masked by item 1). The siblings probe with a cheap list/describe that 
matches what they do.
Proposed change: probe with an operation the component itself performs, or 
document the extra permission.

h4. 3. No test covers the AwsServiceException path
{{Ses2ProducerHealthCheckStaticCredsTest}} and 
{{Ses2ProducerHealthCheckProfileCredsTest}} only cover credential-resolution 
failures, which land in the generic catch that does return. That is why item 1 
survived. A test with a mock client throwing an AwsServiceException and 
asserting State.DOWN would pin it.

h4. 4. Smaller issues
{{Ses2Producer}} imports {{software.amazon.awssdk.services.ses.model.*}}, 
against the project's explicit-import rule.
The component is on the SES v1 API ({{SesClient}}); SESv2 ({{SesV2Client}}) is 
where AWS adds list management, bulk/templated sending and EmailContent with 
attachments. Worth a separate decision.

_Claude Code on behalf of oscerd_



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

Reply via email to