Skip to content
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

mysql: Opening a connection leads an error with a registered custom TLS configuration #965

Open
siketyan opened this issue Aug 6, 2023 · 0 comments · May be fixed by #966
Open

mysql: Opening a connection leads an error with a registered custom TLS configuration #965

siketyan opened this issue Aug 6, 2023 · 0 comments · May be fixed by #966

Comments

@siketyan
Copy link

siketyan commented Aug 6, 2023

Describe the Bug
MySQL database driver reads a CA certificate file from the path specified by x-tls-ca parameter, if tis parameter in the DSN is not true, false, or skip-verify. This helps establishing TLS connections to the database with the CA file. However, when the TLS configuration is already registered using mysql.RegisterTLSConfig, the driver overrides it, reading x-tls-ca parameter even if the file does not exist (and occurs an error).

Steps to Reproduce

  1. Register a tls.Config using mysql.RegisterTLSConfig
  2. Use migrate.New with the registered TLS configuration name (e.g. ...?tls=aws)
  3. An error occurs: open : no such file or directory

Expected Behavior
I think MySQL driver of migrate should ignore registering TLS config from the DSN if x-tls-ca is not provided. Checking the configuration is already registered is a better solution, but go-mysql-driver does not provide a method to check the configuration name is known or not.

Migrate Version
v4.16.2

Loaded Source Drivers
file

Loaded Database Drivers
mysql, stub

Go Version
go version go1.20.7 darwin/arm64

Stacktrace
N/A

Additional context
N/A

@siketyan siketyan changed the title mysql: Open(url string) should ignore unknown tls parameters if already registered mysql: Opening a connection leads an error with a registered custom TLS configuration Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant