Skip to content

Conversation

@farost
Copy link
Member

@farost farost commented Aug 4, 2025

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 have https.

Implementation

Enhance address.rs to retrieve URI schemes from the stored addresses. Before creating a single server connection in Rust, validate the addresses based on the requirements described above.

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))
Copy link
Member Author

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)]
Copy link
Member Author

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)?;
Copy link
Member Author

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() {
Copy link
Member Author

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.

@farost farost merged commit 68e9a47 into typedb:master Aug 4, 2025
9 checks passed
@farost farost deleted the enforce-https-for-tls branch August 4, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants