Andrea Cosentino created CAMEL-28035:
----------------------------------------

             Summary: camel-aws2-textract: the health check calls a billed API, 
and the async operations cannot set a notification channel or a request token
                 Key: CAMEL-28035
                 URL: https://issues.apache.org/jira/browse/CAMEL-28035
             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 calls DetectDocumentText on every probe
{{Textract2ProducerHealthCheck}} always calls 
{{textractClient.detectDocumentText(...)}}. It is billed per page (the pricing 
page gives $0.0015 per page for the first million in us-west-2), so every 
readiness probe is a paid call. An endpoint configured for analyzeExpense or 
for the async start*/get* pair, under a role granting only those actions, 
reports DOWN with AccessDenied: the check deliberately tolerates 
InvalidParameterException and UnsupportedDocumentException but not 
AccessDeniedException, so the "wrong operation" case is exactly the one it 
fails on.
Proposed change: probe with a free call, or with the configured operation's own 
permission.

h4. 2. The async start* operations cannot set NotificationChannel, 
OutputConfig, JobTag or ClientRequestToken
None of these names appears anywhere in src/main/java. Without 
NotificationChannel the only way to learn that a Textract job finished is to 
poll get* in a loop, which is what the adoc example does with a hardcoded delay 
of 10000. aws2-polly's equivalent async operation does support snsTopicArn, so 
this is also an intra-family inconsistency. A missing ClientRequestToken 
additionally means a redelivered exchange starts a duplicate, billed job.

h4. 3. The paging token is never written back
{{Textract2Producer}} reads {{CamelAwsTextractNextToken}} into the request but 
no branch sets it from the response, so a paging route has to dig into the body 
POJO. aws2-polly has a shared {{setNextToken(message, result.nextToken())}} 
that also removes the header on the last page.

h4. 4. Missing operations
{{TextractClient}} 2.57.7 also offers {{analyzeID}}, {{startLendingAnalysis}}, 
{{getLendingAnalysis}} and {{getLendingAnalysisSummary}} (verified against the 
jar). analyzeID (passports, driving licences) is the one commonly wanted next 
to analyzeExpense, and no branch exists so it is unreachable even in POJO mode.

h4. 5. Smaller issues
{{Textract2Producer}} imports 
{{software.amazon.awssdk.services.textract.model.*}}, against the project's 
explicit-import rule.
The health check builds its probe bytes with {{"test".getBytes()}}, the 
platform default charset (SonarCloud java:S1943).
pojoRequest is supported and tested but never mentioned in the adoc, while 
comprehend and polly both have a POJO section.
{{@Metadata(required = true)}} plus a field initializer on {{operation}} is 
contradictory.

_Claude Code on behalf of oscerd_



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

Reply via email to