Skip to content

CAMEL-24157: camel-aws2 - Fix medium-severity findings from July 2026 review#24864

Merged
davsclaus merged 5 commits into
mainfrom
fix/CAMEL-24157
Jul 17, 2026
Merged

CAMEL-24157: camel-aws2 - Fix medium-severity findings from July 2026 review#24864
davsclaus merged 5 commits into
mainfrom
fix/CAMEL-24157

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

Fixes 12 medium-severity findings from the July 2026 deep code review of camel-aws2 components (S3, SQS, SNS, DDB), covering the "quick wins" and "medium effort" groups from the CAMEL-24157 umbrella.

Claude Code on behalf of davsclaus

camel-aws2-sns (3 fixes)

  • Fix dead-code queueArn validationisNotEmpty(isNotEmpty(queueArn)) always returned true, making the validation unreachable. Fixed to single isNotEmpty() and updated stale error message.
  • Require kmsMasterKeyId when SSE enabledserverSideEncryptionEnabled=true without kmsMasterKeyId silently created unencrypted topics. Now throws IllegalArgumentException.
  • Fix health check — guarded Region.of(null) NPE when region relies on SDK defaults; replaced listSubscriptions() (requires broad IAM) with getTopicAttributes() (matches producer permissions).

camel-aws2-ddb (3 fixes)

  • Fix empty JSON array mapping — empty arrays mapped to empty StringSet (DynamoDB rejects). Now maps to empty List (L type). Also fixed list element type check to use Number (matching prior CAMEL-24156 fix).
  • Add consistentRead to ScanCommand — Scan was the only read command missing .consistentRead(determineConsistentRead()).
  • Fix table-creation retry guardase.getMessage().contains("ResourceNotFoundException") never matched SDK v2 messages. Changed to catch (ResourceNotFoundException) by type.

camel-aws2-sqs (1 fix)

  • Defer FIFO messageGroupIdStrategy check — Constructor threw for FIFO queues without messageGroupIdStrategy, blocking purgeQueue/deleteQueue/listQueues operations that don't need it. Moved check to processSingleMessage/sendBatchMessage.

camel-aws2-s3 (5 fixes)

  • Fix ListObjectsV2 pagination fallback — Fallback used object key as continuationToken (V1 leftover); now uses startAfter which is the correct V2 equivalent. Fixes S3-compatible stores (MinIO, Ceph).
  • Apply SSE-C on read operationsgetObject, getObjectRange, and consumer fileName path were missing SSE-C headers (write operations had them). SSE-C encrypted objects returned HTTP 400 on read.
  • Fix removePrefixOnMove regexString.replaceFirst() treated prefix as regex causing PatternSyntaxException on prefixes with . + *. Failure also skipped deleteAfterRead → endless reprocessing. Changed to substring().
  • Fix presigner credentialsgetOrCreatePresigner() only supported basic + default credentials; now handles session credentials, profile credentials, and null region.
  • Deprecate dead maxConnections option@UriParam existed with getter/setter but was never wired to the S3 HTTP client.

Test plan

  • camel-aws2-sns module compiles
  • camel-aws2-ddb module compiles and all 62 unit tests pass
  • camel-aws2-sqs module compiles
  • camel-aws2-s3 module compiles

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

davsclaus and others added 4 commits July 17, 2026 17:41
…validation, and health check

Fix subscribeSNStoSQS queueArn validation that was dead code due to
nested isNotEmpty(isNotEmpty()) always returning true. Also update stale
error message. Require kmsMasterKeyId when serverSideEncryptionEnabled
is true instead of silently creating unencrypted topics. Fix health
check NPE when region is unset and replace listSubscriptions (requires
broad IAM) with getTopicAttributes (matches producer permissions).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…tRead, and table-creation retry

Map empty JSON arrays to DynamoDB List type (L) instead of empty
StringSet which DynamoDB rejects. Use Number type check for list
elements to match prior CAMEL-24156 fix on scalar values. Add missing
consistentRead to ScanCommand matching GetItem/Query/ExecuteStatement.
Fix table-creation wait loop to catch ResourceNotFoundException by
type instead of unreliable string matching against SDK v2 messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
… to send operations

Move the messageGroupIdStrategy validation from the constructor to
processSingleMessage and sendBatchMessage where it is actually needed.
This allows purgeQueue, deleteQueue, listQueues, and deleteMessage
operations to work on FIFO queues without requiring a messageGroupIdStrategy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…, presigner, and deprecate maxConnections

Fix ListObjectsV2 pagination fallback to use startAfter instead of
continuationToken when nextContinuationToken is absent (S3-compatible
stores). Apply SSE-C customer key headers on getObject, getObjectRange,
and consumer fileName path (read operations were missing SSE-C unlike
write operations). Fix removePrefixOnMove to use substring instead of
regex replaceFirst which caused PatternSyntaxException on prefixes with
special characters and skipped deleteAfterRead on failure. Fix presigner
to support session credentials, profile credentials, and null region.
Deprecate maxConnections option that was never wired to the S3 client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus davsclaus added the bug Something isn't working label Jul 17, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code review on behalf of gnodet

All 12 medium-severity findings reviewed. Every fix is correct.

Highlights

Component Fix Verdict
SNS isNotEmpty(isNotEmpty(queueArn)) — double-wrap always returned true, making validation dead code. Fixed to single call + corrected error message ✅ Good catch — subtle bug
SNS SSE without kmsMasterKeyId now throws instead of silently creating unencrypted topic ✅ Correct fail-fast
SNS health Null-guard on Region.of(); getTopicAttributes() replaces listSubscriptions() (narrower IAM scope) ✅ Correct
DDB Empty array → L type (List) instead of SS (StringSet) — DynamoDB rejects empty sets ✅ Correct
DDB catch (ResourceNotFoundException) by type instead of ase.getMessage().contains(...) ✅ Correct for SDK v2
DDB consistentRead added to ScanCommand — was the only read command missing it
SQS FIFO messageGroupIdStrategy check deferred to send-time — unblocks purge/delete/list ops ✅ Correct scope reduction
S3 V2 pagination fallback uses startAfter instead of continuationToken with object key ✅ Correct — key is not a continuation token; fixes MinIO/Ceph
S3 SSE-C headers on getObject, getObjectRange, and consumer fileName path ✅ Correct — read ops were missing them
S3 replaceFirstsubstring for prefix removal — prevents PatternSyntaxException on prefixes with .+* ✅ Also adds null/startsWith guards
S3 Presigner now supports session/profile credentials + null region
S3 maxConnections deprecated (dead option, never wired)

Minor notes

  • DDB transformer overlap with PR #24863: Both PRs modify Ddb2JsonDataTypeTransformer.java with the Number instance check. #24863 also changes the Integer/DoubleNumber check above this line. Whoever merges second will need a trivial rebase.

  • SSE-C code duplication: The SSE-C header block is repeated 3 times (consumer fileName path, producer getObject, producer getObjectRange). A private helper like applySSECustomerKey(GetObjectRequest.Builder) would reduce duplication. Not blocking — just a future cleanup opportunity.

LGTM 👍

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

… deprecation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-aws/camel-aws2-ddb
  • components/camel-aws/camel-aws2-s3
  • components/camel-aws/camel-aws2-sns
  • components/camel-aws/camel-aws2-sqs
  • dsl/camel-endpointdsl

🔬 Scalpel shadow comparison — Scalpel: 15 tested, 27 compile-only — current: 13 all tested

Maveniverse Scalpel detected 42 affected modules (current approach: 13).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 15 modules (6 direct + 9 downstream), skip tests for 27 (generated code, meta-modules)

Modules Scalpel would test (15)
  • camel-aws2-ddb
  • camel-aws2-eventbridge
  • camel-aws2-s3
  • camel-aws2-sns
  • camel-aws2-sqs
  • camel-catalog
  • camel-endpointdsl
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (27)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (42 modules)
  • Camel :: AWS2 DDB
  • Camel :: AWS2 Eventbridge
  • Camel :: AWS2 S3
  • Camel :: AWS2 SNS
  • Camel :: AWS2 SQS
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.22.0 milestone Jul 17, 2026
@davsclaus davsclaus self-assigned this Jul 17, 2026
@davsclaus
davsclaus merged commit 4f887ea into main Jul 17, 2026
5 checks passed
@davsclaus
davsclaus deleted the fix/CAMEL-24157 branch July 17, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants