Skip to content

Fix/41627 mssql ssl handshake failure#41882

Open
Po11uxx wants to merge 2 commits into
appsmithorg:releasefrom
Po11uxx:fix/41627-mssql-ssl-handshake-failure
Open

Fix/41627 mssql ssl handshake failure#41882
Po11uxx wants to merge 2 commits into
appsmithorg:releasefrom
Po11uxx:fix/41627-mssql-ssl-handshake-failure

Conversation

@Po11uxx

@Po11uxx Po11uxx commented Jun 8, 2026

Copy link
Copy Markdown

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags=""

🔍 Cypress test results

Caution

If you modify the content in this section, you are likely to disrupt the CI result for your PR.

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added configurable connection timeout for MSSQL datasources with 60-second default
  • Bug Fixes

    • Improved SSL configuration handling to gracefully default when settings are incomplete
    • Enhanced connection timeout validation with clearer error messaging

Po11uxx and others added 2 commits May 13, 2026 17:06
MSSQL connections failed with SSL handshake errors when connecting to
servers that do not require encryption. The root cause was that the SSL
mode defaulted to NO_VERIFY (encrypt=true), forcing a TLS handshake.

Changes:
- Set default SSL mode to DISABLE (encrypt=false) in form.json
- Handle missing SSL config gracefully by defaulting to encrypt=false
  instead of throwing an exception

Users who need SSL can still explicitly select "Enabled with no verify".

Fixes appsmithorg#41627

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The MSSQL plugin now supports configurable connection timeout with validation during datasource setup and Hikari pool creation. SSL mode defaults gracefully to encrypt=false when configuration is absent, replacing exception-throwing behavior. Both features are schema-validated and comprehensively tested.

Changes

MSSQL Connection Timeout and SSL Mode Configuration

Layer / File(s) Summary
Connection timeout contract and validation
MssqlPlugin.java, MssqlErrorMessages.java, form.json
Introduces DEFAULT_CONNECTION_TIMEOUT_SECONDS constant, getConnectionTimeoutSeconds() helper to parse timeout from datasource properties, datasource validation that rejects negative timeouts via new error message constant, and form schema with numeric timeout field defaulting to 60 seconds.
Connection pool timeout integration
MssqlPlugin.java
Appends loginTimeout parameter to JDBC URL and sets Hikari connectionTimeout (in milliseconds) during connection pool creation using the validated timeout value.
SSL mode default behavior adjustment
MssqlPlugin.java, form.json
Removes exception-throwing from addSslOptionsToUrlBuilder when SSL configuration is absent; now appends encrypt=false; and returns gracefully. SSL mode form default changed from NO_VERIFY to DISABLE.
Connection timeout and SSL defaults test coverage
MssqlPluginTest.java
Seven new JUnit test methods validating default timeout application (60 seconds), custom timeout values, negative timeout validation rejection, zero timeout acceptance, and SSL defaulting to encrypt=false across null connection/ssl/authType conditions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested labels

ok-to-test

Suggested reviewers

  • sharat87
  • vivek-appsmith

Poem

🔌 Connection pooled and timeouts tamed,
encrypt=false when SSL's unnamed,
Validation stands guard on negative fears,
Defaults and custom values for years.
Tests assure all paths are bright

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it contains only the template structure with no actual implementation details, motivation, context, or issue link filled in. Fill in the description with: issue link/number, TL;DR if needed, motivation and context for the SSL and timeout changes, and answer the DevRel/Marketing communication question.
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: fixing MSSQL SSL handshake failures by modifying default SSL configuration and connection timeout handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/server/appsmith-plugins/mssqlPlugin/src/main/resources/form.json (1)

51-65: ⚡ Quick win

Connection timeout configuration looks correct.

The form properly configures a hidden key field with "connectionTimeout" and a visible NUMBER value field with default 60. This matches the backend constant.

However, note that the backend's getConnectionTimeoutSeconds method relies on this being at index 0, creating a fragile dependency. See comment in MssqlPlugin.java for details.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/server/appsmith-plugins/mssqlPlugin/src/main/resources/form.json` around
lines 51 - 65, The backend relies on datasourceConfiguration.properties[0] for
the connection timeout which is fragile; update the getConnectionTimeoutSeconds
method to search datasourceConfiguration.properties for an entry whose key
equals "connectionTimeout" (or use a helper that maps properties by key) and
parse its value as a number with a fallback to the current default (60), instead
of directly reading index 0; ensure the code handles missing/null values and
non-numeric values gracefully.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java`:
- Around line 658-672: The getConnectionTimeoutSeconds method currently reads
properties.get(0), which is fragile; change it to search the
datasourceConfiguration.getProperties() list for a Property whose key equals
"connectionTimeout" (use Property.getKey()), then if found and its getValue() is
non-null try to parse its trimmed string value to an int and return it,
otherwise fall back to DEFAULT_CONNECTION_TIMEOUT_SECONDS; keep the existing
NumberFormatException handling and default behavior.

---

Nitpick comments:
In `@app/server/appsmith-plugins/mssqlPlugin/src/main/resources/form.json`:
- Around line 51-65: The backend relies on datasourceConfiguration.properties[0]
for the connection timeout which is fragile; update the
getConnectionTimeoutSeconds method to search datasourceConfiguration.properties
for an entry whose key equals "connectionTimeout" (or use a helper that maps
properties by key) and parse its value as a number with a fallback to the
current default (60), instead of directly reading index 0; ensure the code
handles missing/null values and non-numeric values gracefully.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 30cbb488-2f7a-40f0-be7a-68fd35a36193

📥 Commits

Reviewing files that changed from the base of the PR and between 3afa599 and d6d9771.

📒 Files selected for processing (4)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/exceptions/MssqlErrorMessages.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/form.json
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlPluginTest.java

Comment on lines +658 to +672
static int getConnectionTimeoutSeconds(DatasourceConfiguration datasourceConfiguration) {
List<Property> properties = datasourceConfiguration.getProperties();
if (properties != null && !properties.isEmpty()) {
Property timeoutProperty = properties.get(0);
if (timeoutProperty != null && timeoutProperty.getValue() != null) {
try {
return Integer.parseInt(
String.valueOf(timeoutProperty.getValue()).trim());
} catch (NumberFormatException e) {
// fall through to default
}
}
}
return DEFAULT_CONNECTION_TIMEOUT_SECONDS;
}

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.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Hard-coded property index is fragile and error-prone.

The method assumes the connection timeout is always at properties.get(0), but this creates a brittle coupling to the form configuration. If properties are reordered or new properties are added, this will silently fail or read the wrong value.

Instead, search for the property by its key "connectionTimeout" to make the code resilient to configuration changes.

🔍 Proposed fix to search by key
 static int getConnectionTimeoutSeconds(DatasourceConfiguration datasourceConfiguration) {
     List<Property> properties = datasourceConfiguration.getProperties();
-    if (properties != null && !properties.isEmpty()) {
-        Property timeoutProperty = properties.get(0);
-        if (timeoutProperty != null && timeoutProperty.getValue() != null) {
+    if (properties != null) {
+        Property timeoutProperty = properties.stream()
+                .filter(p -> "connectionTimeout".equals(p.getKey()))
+                .findFirst()
+                .orElse(null);
+        if (timeoutProperty != null && timeoutProperty.getValue() != null) {
             try {
                 return Integer.parseInt(
                         String.valueOf(timeoutProperty.getValue()).trim());
             } catch (NumberFormatException e) {
                 // fall through to default
             }
         }
     }
     return DEFAULT_CONNECTION_TIMEOUT_SECONDS;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java`
around lines 658 - 672, The getConnectionTimeoutSeconds method currently reads
properties.get(0), which is fragile; change it to search the
datasourceConfiguration.getProperties() list for a Property whose key equals
"connectionTimeout" (use Property.getKey()), then if found and its getValue() is
non-null try to parse its trimmed string value to an int and return it,
otherwise fall back to DEFAULT_CONNECTION_TIMEOUT_SECONDS; keep the existing
NumberFormatException handling and default behavior.

@github-actions

Copy link
Copy Markdown

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions Bot added the Stale label Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant