Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions wren-ui/src/apollo/server/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,16 @@ const dataSource = {
DataSourceName.MYSQL,
connectionInfo,
);
const { host, port, database, user, password } =
const { host, port, database, user, password, ssl } =
decryptedConnectionInfo as MYSQL_CONNECTION_INFO;
return { host, port, database, user, password };
return {
host,
port,
database,
user,
password,
sslMode: ssl ? 'ENABLED' : 'DISABLED',
};
Comment on lines +128 to +135
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the sslMode field format with backend expectations

The SSL handling logic is clean and follows a clear boolean-to-string mapping. However, the MySQL implementation uses a different approach compared to other databases (PostgreSQL uses URL parameters, ClickHouse uses URL parameters, Trino uses protocol switching).

Please verify that the sslMode field with 'ENABLED'/'DISABLED' values matches what the MySQL backend/driver expects for SSL configuration.


🏁 Script executed:

#!/bin/bash
# Description: Search for sslMode usage patterns in the codebase to verify the expected format
# Expected: Find references to sslMode field usage in MySQL-related code

echo "Searching for sslMode usage patterns..."
rg -A 3 -B 3 "sslMode" --type ts --type js

echo -e "\nSearching for MySQL SSL configuration patterns..."
rg -A 5 -B 5 "ENABLED|DISABLED" --type ts --type js | grep -i -A 5 -B 5 "mysql\|ssl"

echo -e "\nSearching for MySQL connection configuration..."
rg -A 10 "mysql.*connection" --type ts --type js -i

Length of output: 11966


Fix MySQL sslMode mapping to valid Connector/J values

The MySQL Connector/J driver uses the sslMode property (not useSSL) and only accepts specific string values (e.g. DISABLED, PREFERRED, REQUIRED, VERIFY_CA, VERIFY_IDENTITY). The current code maps ssl to "ENABLED"/"DISABLED", but "ENABLED" is not a supported mode. Please update this to one of the valid modes—typically REQUIRED when SSL must be on—and verify against your backend’s expectations:

• File: wren-ui/src/apollo/server/dataSource.ts
Change around line 130:

- sslMode: ssl ? 'ENABLED' : 'DISABLED',
+ sslMode: ssl ? 'REQUIRED' : 'DISABLED', // use a valid Connector/J sslMode value

See MySQL Connector/J docs for the full list of sslMode options and adjust as needed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
host,
port,
database,
user,
password,
sslMode: ssl ? 'ENABLED' : 'DISABLED',
};
return {
host,
port,
database,
user,
password,
sslMode: ssl ? 'REQUIRED' : 'DISABLED', // use a valid Connector/J sslMode value
};
🤖 Prompt for AI Agents
In wren-ui/src/apollo/server/dataSource.ts around lines 128 to 135, the sslMode
field is currently set to 'ENABLED' or 'DISABLED', but MySQL Connector/J expects
specific sslMode values such as 'DISABLED', 'PREFERRED', 'REQUIRED',
'VERIFY_CA', or 'VERIFY_IDENTITY'. Replace the 'ENABLED' string with 'REQUIRED'
when ssl is true to match valid Connector/J options, and keep 'DISABLED' when
ssl is false. Verify this change aligns with backend SSL requirements.

},
} as IDataSourceConnectionInfo<
MYSQL_CONNECTION_INFO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface MYSQL_CONNECTION_INFO {
user: string;
password: string;
database: string;
ssl: boolean;
}

export interface ORACLE_CONNECTION_INFO {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Form, Input } from 'antd';
import { Form, Input, Switch } from 'antd';
import { ERROR_TEXTS } from '@/utils/error';
import { FORM_MODE } from '@/utils/enum';
import { hostValidator } from '@/utils/validator';
Expand Down Expand Up @@ -89,6 +89,9 @@ export default function MySQLProperties(props: Props) {
>
<Input placeholder="MySQL database name" disabled={isEditMode} />
</Form.Item>
<Form.Item label="Use SSL" name="ssl" valuePropName="checked">
<Switch />
</Form.Item>
</>
);
}