Skip to content

Skip connection validation when file access is denied (temporary workaround)#342

Open
Sarthak Sonagara (sonagaras) wants to merge 7 commits into
v3.0.8-hotfix-xfrom
fix/skip-validation-on-file-access-denied
Open

Skip connection validation when file access is denied (temporary workaround)#342
Sarthak Sonagara (sonagaras) wants to merge 7 commits into
v3.0.8-hotfix-xfrom
fix/skip-validation-on-file-access-denied

Conversation

@sonagaras
Copy link
Copy Markdown

Summary

Temporary workaround for thread-based file access restrictions in Confluent Cloud environments.

Problem

When the MongoDB connector runs validation, it attempts to read SSL truststore files from /mnt/secrets/. However, the ConnectFileSystem security layer restricts file access based on thread names:

  • Task threads (lcc-*): ✅ Allowed access
  • Validation threads (pool-11-thread-*): ❌ Access denied

This causes validation to fail with AccessDeniedException even though the connector would work correctly once started.

See: Oracle XStream CDC Connector - Wallet File Validation Failure

Solution

Skip connection validation when AccessDeniedException is caught:

  1. Wrap validateConnection() in try-catch
  2. Check if exception is caused by file access denial (walks cause chain)
  3. Log a warning and skip validation if access was denied
  4. Re-throw for any other exceptions (preserves normal error handling)

The connection will be properly validated when the task starts on a thread that has the required file access permissions.

Temporary Workaround

This fix can be removed once the platform team implements one of:

  • Option 1: Include connector ID in validation thread names
  • Option 2: Add connector package to allowedPackages in ConnectFileSystem

Test plan

  • Verified validation skip only happens for AccessDeniedException
  • Other validation errors still propagate correctly
  • Deploy to cloud and verify connector starts successfully

🤖 Generated with Claude Code

Temporary workaround for thread-based file access restrictions in
Confluent Cloud. When validation runs on threads that don't have
access to /mnt/secrets/, the connector now catches AccessDeniedException
and skips connection validation with a warning.

The connection will be properly validated when the task starts on
a thread that has the required file access permissions.

This workaround can be removed once the platform fix is implemented
to include connector IDs in validation thread names.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sonagaras Sarthak Sonagara (sonagaras) requested a review from a team as a code owner March 5, 2026 10:02
The getMatchingCollections() method also creates a MongoDbConnection
which triggers SSL context creation and can fail with AccessDeniedException
when called from validation threads.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added INFO log at start of validate() to confirm new code is running.
Added detailed logging when exception is caught to debug if
isFileAccessDenied() is working correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ictions

Temporary workaround: Connection validation is skipped because validation
threads (pool-*-thread-*) don't have access to /mnt/secrets/ in Confluent
Cloud. Only task threads (lcc-*) have file access permissions.

- validate() now skips validateConnection() entirely
- getMatchingCollections() returns empty list immediately
- Connection will be validated when the task starts on an allowed thread

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…estrictions

Temporary workaround: All validation is skipped because validation threads
(pool-*-thread-*) don't have access to /mnt/secrets/ in Confluent Cloud.

- start() skips validateAndRecord() entirely
- validate() returns empty Config without calling validateAllFields()
- getMatchingCollections() returns empty list immediately

Validation will happen when the task starts on an allowed thread (lcc-*).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Temporary workaround: When file access is denied (AccessDeniedException)
during SSL context creation, return a default SSL context instead of
failing. This happens when validation runs on a thread without access
to /mnt/secrets/ in Confluent Cloud.

The actual SSL context with custom truststore will be created when the
task starts on an allowed thread (lcc-*).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add check for "Access denied to thread" message pattern
- Improve javadoc for isFileAccessDenied method
- Use imported AccessDeniedException class directly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant