-
Notifications
You must be signed in to change notification settings - Fork 38
Enforce explicit https addresses for TLS connections #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| password = "password" | ||
| credentials = Credentials(username, password) | ||
| return TypeDB.driver(address=f"{host}:{port}", credentials=credentials, driver_options=DriverOptions()) | ||
| return TypeDB.driver(address=f"{host}:{port}", credentials=credentials, driver_options=DriverOptions(is_tls_enabled=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests started failing without this flag. Which is good.
| error::ConnectionError, | ||
| }; | ||
|
|
||
| #[derive(Clone, Hash, PartialEq, Eq)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've actually just stolen a part of my code from the cluster branch.
| driver_lang: &str, | ||
| driver_version: &str, | ||
| ) -> crate::Result<(Self, Vec<DatabaseInfo>)> { | ||
| Self::validate_tls(&address, &driver_options)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We validate each connection (if there can be multiple) separately, which is correct.
| fn validate_tls(address: &Address, driver_options: &DriverOptions) -> crate::Result { | ||
| match driver_options.is_tls_enabled() { | ||
| true => { | ||
| if driver_options.tls_config().is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not happen, but the model allows it, so why not.
Usage and product changes
Drivers return explicit error messages when connection addresses and TLS options are mismatched. TLS connections require addresses to have
https. Non-TLS connections require addresses not to havehttps.Implementation
Enhance
address.rsto retrieve URI schemes from the stored addresses. Before creating a single server connection in Rust, validate the addresses based on the requirements described above.