FIDES-1887 - Add sslmode to MySQL DB integration#6048
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6048 +/- ##
==========================================
+ Coverage 86.88% 86.89% +0.01%
==========================================
Files 419 419
Lines 25968 25978 +10
Branches 2828 2828
==========================================
+ Hits 22561 22574 +13
+ Misses 2788 2785 -3
Partials 619 619 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…nto wades/add-sslmode Changelog merge conflict resolved
galvana
left a comment
There was a problem hiding this comment.
Overall this looks good! Just recommending the use of an enum of sslmode and adding the missing tests we discussed offline
| sslmode: Optional[str] = Field( | ||
| None, # TODO: support for verify-ca and verify-full | ||
| title="SSL Mode", | ||
| description="The SSL mode to use for the connection. Valid values are 'required', 'preferred', and 'disabled'.", | ||
| pattern=r"required|preferred|disabled", | ||
| ) |
There was a problem hiding this comment.
We could use an enum for this
class SSLMode(str, Enum):
preferred = "preferred"
required = "required"
disabled = "disabled"
Then we could just do this
| sslmode: Optional[str] = Field( | |
| None, # TODO: support for verify-ca and verify-full | |
| title="SSL Mode", | |
| description="The SSL mode to use for the connection. Valid values are 'required', 'preferred', and 'disabled'.", | |
| pattern=r"required|preferred|disabled", | |
| ) | |
| sslmode: Optional[SSLMode] = Field( | |
| None, # TODO: support for verify-ca and verify-full | |
| title="SSL Mode", | |
| description="The SSL mode to use for the connection. Valid values are 'required', 'preferred', and 'disabled'." | |
| ) |
There was a problem hiding this comment.
@galvana could I define that ENUM in connection_secrets_mysql.py?
| "title": "SSL Mode", | ||
| "description": "The SSL mode to use for the connection. Valid values are 'required', 'preferred', and 'disabled'.", | ||
| "type": "string", | ||
| "pattern": "required|preferred|disabled", |
There was a problem hiding this comment.
You might need to remove this line if we go with the enum approach
| def test_mysql_connector_build_uri_without_secrets( | ||
| connection_config_mysql, db: Session | ||
| ): | ||
| connection_config_mysql.secrets = None | ||
| connection_config_mysql.save(db) | ||
| with pytest.raises(ValueError): | ||
| MySQLConnector(configuration=connection_config_mysql) |
There was a problem hiding this comment.
Replace this with the direct get_connect_args() tests to get that increase in code coverage
| title="SSH required", | ||
| description="Indicates whether an SSH tunnel is required for the connection. Enable this option if your MySQL server is behind a firewall and requires SSH tunneling for remote connections.", | ||
| ) | ||
| sslmode: Optional[MySQLSslMode] = Field( |
| ) | ||
|
|
||
|
|
||
| class MySQLSslMode(str, Enum): |
There was a problem hiding this comment.
nit: we should upper case all acronyms
Note: When using acronyms in CapWords, capitalize all the letters of the acronym. Thus HTTPServerError is better than HttpServerError.
https://peps.python.org/pep-0008/#descriptive-naming-styles
| class MySQLSslMode(str, Enum): | |
| class MySQLSSLMode(str, Enum): |
fides
|
||||||||||||||||||||||||||||
| Project |
fides
|
| Branch Review |
main
|
| Run status |
|
| Run duration | 00m 51s |
| Commit |
|
| Committer | wadesdev |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
5
|
| View all changes introduced in this branch ↗︎ | |
Closes FIDES-1887
Description Of Changes
Adds sslmode field for MySQL; does not permit passing certificates through for verify-ca and verify-full
Code Changes
connect_argsargument for SSLSteps to Confirm
ssl: requiredfield, providingrequiredin sslmode field should result in a successful connection. Otherwise, connection will be unsuccessful.Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works