Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(oracle): apply the TLS settings to Oracle connections (#21603)
zchpeter3f67feca3246
diff --git a/backend/migrator/migration/3.24/0002##oracle_tls_off.sql b/backend/migrator/migration/3.24/0002##oracle_tls_off.sqlnew file mode 100644index 0000000000..614c7a494a--- /dev/null+++ b/backend/migrator/migration/3.24/0002##oracle_tls_off.sql@@ -0,0 +1,30 @@+-- Before 3.24, Oracle connections ignored the TLS section: they used TLS only+-- when SSL=TRUE was in the extra connection parameters. The driver now applies+-- the section, so turn TLS mode off on every Oracle data source: they keep+-- connecting as they did, and the instance form shows TLS as disabled. A CA+-- kept here would be trusted once TLS is turned on while the form showed+-- System trust, so the CA and client certificate go too, as when TLS is turned+-- off in the form. Deleting useSsl is protojson's form of false.+UPDATE instance+SET metadata = jsonb_set(+ metadata,+ '{dataSources}',+ (+ SELECT jsonb_agg(+ ds - ARRAY[+ 'useSsl',+ 'obfuscatedSslCa',+ 'obfuscatedSslCert',+ 'obfuscatedSslKey',+ 'obfuscatedSslCaPath',+ 'obfuscatedSslCertPath',+ 'obfuscatedSslKeyPath'+ ]+ ORDER BY ord+ )+ FROM jsonb_array_elements(metadata->'dataSources') WITH ORDINALITY AS t(ds, ord)+ )+)+WHERE metadata->>'engine' = 'ORACLE'+ AND jsonb_typeof(metadata->'dataSources') = 'array'+ AND metadata->'dataSources' <> '[]';diff --git a/backend/migrator/migration_test.go b/backend/migrator/migration_test.goindex 3f22ed8d12..ca5e5f2863 100644--- a/backend/migrator/migration_test.go+++ b/backend/migrator/migration_test.go@@ -46,3 +46,46 @@ func TestMigration3_24_1_MSSQLVerifyTLSOff(t *testing.T) {require.JSONEq(t, want, got, resourceID)}}++func TestMigration3_24_2_OracleTLSOff(t *testing.T) {+ ctx := context.Background()+ _, db := testcontainer.NewPgDatabase(t)+ _, err := db.ExecContext(ctx, `+ CREATE TABLE instance (+ resource_id TEXT PRIMARY KEY,+ metadata JSONB NOT NULL DEFAULT '{}'+ );+ INSERT INTO instance (resource_id, metadata) VALUES+ ('oracle-tls', '{"engine":"ORACLE","dataSources":[{"id":"admin","useSsl":true,"verifyTlsCertificate":true,"obfuscatedSslCa":"ca","obfuscatedSslCert":"cert","obfuscatedSslKey":"key"},{"id":"ro","type":"READ_ONLY","useSsl":true,"obfuscatedSslCaPath":"ca-path","obfuscatedSslCertPath":"cert-path","obfuscatedSslKeyPath":"key-path","extraConnectionParameters":{"SSL":"TRUE","WALLET":"/opt/oracle/wallet"}}]}'),+ ('oracle-tls-on-one', '{"engine":"ORACLE","dataSources":[{"id":"admin","useSsl":true},{"id":"ro","type":"READ_ONLY","verifyTlsCertificate":true,"obfuscatedSslCa":"ca"}]}'),+ ('oracle-tls-off-with-ca', '{"engine":"ORACLE","dataSources":[{"id":"admin","verifyTlsCertificate":true,"obfuscatedSslCa":"ca"}]}'),+ ('oracle-no-tls', '{"engine":"ORACLE","dataSources":[{"id":"admin","verifyTlsCertificate":true}]}'),+ ('oracle-no-data-sources', '{"engine":"ORACLE","dataSources":[]}'),+ ('oracle-without-data-sources', '{"engine":"ORACLE"}'),+ ('oracle-null-data-sources', '{"engine":"ORACLE","dataSources":null}'),+ ('postgres-tls', '{"engine":"POSTGRES","dataSources":[{"id":"admin","useSsl":true,"obfuscatedSslCa":"ca"}]}'),+ ('mssql-tls', '{"engine":"MSSQL","dataSources":[{"id":"admin","useSsl":true}]}');+ `)+ require.NoError(t, err)++ statement, err := migrator.MigrationFS.ReadFile("migration/3.24/0002##oracle_tls_off.sql")+ require.NoError(t, err)+ _, err = db.ExecContext(ctx, string(statement))+ require.NoError(t, err)++ for resourceID, want := range map[string]string{+ "oracle-tls": `{"engine":"ORACLE","dataSources":[{"id":"admin","verifyTlsCertificate":true},{"id":"ro","type":"READ_ONLY","extraConnectionParameters":{"SSL":"TRUE","WALLET":"/opt/oracle/wallet"}}]}`,+ "oracle-tls-on-one": `{"engine":"ORACLE","dataSources":[{"id":"admin"},{"id":"ro","type":"READ_ONLY","verifyTlsCertificate":true}]}`,+ "oracle-tls-off-with-ca": `{"engine":"ORACLE","dataSources":[{"id":"admin","verifyTlsCertificate":true}]}`,+ "oracle-no-tls": `{"engine":"ORACLE","dataSources":[{"id":"admin","verifyTlsCertificate":true}]}`,+ "oracle-no-data-sources": `{"engine":"ORACLE","dataSources":[]}`,+ "oracle-without-data-sources": `{"engine":"ORACLE"}`,+ "oracle-null-data-sources": `{"engine":"ORACLE","dataSources":null}`,+ "postgres-tls": `{"engine":"POSTGRES","dataSources":[{"id":"admin","useSsl":true,"obfuscatedSslCa":"ca"}]}`,+ "mssql-tls": `{"engine":"MSSQL","dataSources":[{"id":"admin","useSsl":true}]}`,+ } {+ var got string+ require.NoError(t, db.QueryRowContext(ctx, `SELECT metadata::text FROM instance WHERE resource_id = $1`, resourceID).Scan(&got))+ require.JSONEq(t, want, got, resourceID)+ }+}diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex a412202b61..8f04edd61c 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -10,8 +10,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.24.1"), *files[len(files)-1].version)- require.Equal(t, "migration/3.24/0001##mssql_verify_tls_off.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.24.2"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.24/0002##oracle_tls_off.sql", files[len(files)-1].path)}func TestVersionUnique(t *testing.T) {diff --git a/backend/plugin/db/oracle/oracle.go b/backend/plugin/db/oracle/oracle.goindex 7ed0fca184..b0197050db 100644--- a/backend/plugin/db/oracle/oracle.go+++ b/backend/plugin/db/oracle/oracle.go@@ -4,7 +4,9 @@ package oracleimport ("context""crypto/rand"+ "crypto/tls""database/sql"+ "database/sql/driver""fmt""log/slog""math/big"@@ -59,14 +61,16 @@ func (d *Driver) Open(ctx context.Context, _ storepb.Engine, config db.Connectioif err != nil {return nil, errors.Errorf("invalid port %q", config.DataSource.Port)}- options := connectionOptions(config.DataSource.GetSid(), config.DataSource.GetExtraConnectionParameters())- dsn := goora.BuildUrl(config.DataSource.Host, port, config.DataSource.GetServiceName(), config.DataSource.Username, config.Password, options)- db, err := sql.Open("oracle", dsn)+ tlsConfig, err := getTLSConfig(config.DataSource)if err != nil {- return nil, err+ return nil, errors.Wrap(err, "failed to build TLS configuration")}+ options := connectionOptions(config.DataSource.GetSid(), config.DataSource.GetExtraConnectionParameters(), tlsConfig != nil)+ dsn := goora.BuildUrl(config.DataSource.Host, port, config.DataSource.GetServiceName(), config.DataSource.Username, config.Password, options)+ db := sql.OpenDB(&connector{dsn: dsn, tlsConfig: tlsConfig})if config.ConnectionContext.DatabaseName != "" {if _, err := db.ExecContext(ctx, fmt.Sprintf("ALTER SESSION SET CURRENT_SCHEMA = \"%s\"", config.ConnectionContext.DatabaseName)); err != nil {+ _ = db.Close()return nil, errors.Wrapf(err, "failed to set current schema to %q", config.ConnectionContext.DatabaseName)}}@@ -77,8 +81,44 @@ func (d *Driver) Open(ctx context.Context, _ storepb.Engine, config db.Connectioreturn d, nil}+// getTLSConfig returns the TLS configuration for the data source's TLS section, or nil when TLS+// is off. It leaves the name check to crypto/tls instead of util.GetTLSConfig's verifier, which+// checks Hostname: go-ora sets ServerName to each server it dials, so a SERVER address or a+// listener redirect is checked against its own name.+func getTLSConfig(dataSource *storepb.DataSource) (*tls.Config, error) {+ config, err := util.GetTLSConfig(dataSource)+ if err != nil || config == nil {+ return config, err+ }+ config.InsecureSkipVerify = !dataSource.GetVerifyTlsCertificate()+ config.VerifyPeerCertificate = nil+ return config, nil+}++// connector opens each connection through go-ora's default driver, as sql.Open("oracle") does,+// with its own copy of the TLS configuration: go-ora sets ServerName on the configuration it is+// given, so connections opened in parallel can't share one.+type connector struct {+ dsn string+ tlsConfig *tls.Config+}++func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {+ oracleConnector, err := goora.GetDefaultDriver().OpenConnector(c.dsn)+ if err != nil {+ return nil, err+ }+ oracleConnector.(*goora.OracleConnector).WithTLSConfig(c.tlsConfig.Clone())+ return oracleConnector.Connect(ctx)+}++func (*connector) Driver() driver.Driver {+ return goora.GetDefaultDriver()+}+const (sidOption = "SID"+ sslOption = "SSL"dialTimeoutOption = "CONNECTION TIMEOUT"dialTimeoutOptionAlias = "CONNECT TIMEOUT"// defaultDialTimeoutSeconds bounds the wait for one address to accept a connection, DNS@@ -88,18 +128,23 @@ const ()// connectionOptions returns the go-ora URL options for a data source: the extra connection-// parameters as typed, plus the SID field and the default dial timeout unless an extra-// parameter sets the same option.+// parameters as typed, the SID field and the default dial timeout unless an extra parameter+// sets the same option, and SSL=TRUE when TLS is on.//// go-ora upper-cases option keys and reads CONNECT TIMEOUT as CONNECTION TIMEOUT. A Bytebase// key sent next to a user key for the same option would leave the winner to go-ora's map-// iteration order, so the user's key replaces it in any spelling.-func connectionOptions(sid string, extraParameters map[string]string) map[string]string {- options := make(map[string]string, len(extraParameters)+2)+// iteration order, so only one is sent: the user's key for SID and the dial timeout, and+// Bytebase's SSL, which the TLS section decides.+func connectionOptions(sid string, extraParameters map[string]string, useTLS bool) map[string]string {+ options := make(map[string]string, len(extraParameters)+3)userOptions := make(map[string]bool, len(extraParameters))for key, value := range extraParameters {+ option := strings.ToUpper(key)+ if useTLS && option == sslOption {+ continue+ }options[key] = value- userOptions[strings.ToUpper(key)] = true+ userOptions[option] = true}if sid != "" && !userOptions[sidOption] {options[sidOption] = sid@@ -107,6 +152,9 @@ func connectionOptions(sid string, extraParameters map[string]string) map[stringif !userOptions[dialTimeoutOption] && !userOptions[dialTimeoutOptionAlias] {options[dialTimeoutOption] = defaultDialTimeoutSeconds}+ if useTLS {+ options[sslOption] = "TRUE"+ }return options}diff --git a/backend/plugin/db/oracle/oracle_test.go b/backend/plugin/db/oracle/oracle_test.goindex 49e4703dff..1615a0af03 100644--- a/backend/plugin/db/oracle/oracle_test.go+++ b/backend/plugin/db/oracle/oracle_test.go@@ -1,8 +1,19 @@package oracleimport (+ "context"+ "crypto/ecdsa"+ "crypto/elliptic"+ "crypto/rand"+ "crypto/tls"+ "crypto/x509"+ "crypto/x509/pkix"+ "encoding/pem""fmt""maps"+ "math/big"+ "net"+ "strconv""strings""testing""time"@@ -12,6 +23,8 @@ import ("github.com/stretchr/testify/require""github.com/bytebase/bytebase/backend/common"+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"+ "github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/plugin/parser/base""github.com/bytebase/bytebase/backend/plugin/parser/plsql")@@ -115,6 +128,7 @@ func TestConnectionOptions(t *testing.T) {name stringsid stringextraParameters map[string]string+ useTLS boolwant map[string]string}{{@@ -197,12 +211,39 @@ func TestConnectionOptions(t *testing.T) {"prefetch_rows": "500",},},+ {+ name: "TLS mode TLS sets SSL",+ useTLS: true,+ want: map[string]string{"CONNECTION TIMEOUT": "10", "SSL": "TRUE"},+ },+ {+ name: "TLS mode TLS replaces an SSL key in any spelling",+ extraParameters: map[string]string{"ssl": "FALSE"},+ useTLS: true,+ want: map[string]string{"CONNECTION TIMEOUT": "10", "SSL": "TRUE"},+ },+ {+ name: "TLS mode TLS passes the other TLS keys through",+ extraParameters: map[string]string{"SSL VERIFY": "FALSE", "WALLET": "/opt/oracle/wallet"},+ useTLS: true,+ want: map[string]string{+ "CONNECTION TIMEOUT": "10",+ "SSL": "TRUE",+ "SSL VERIFY": "FALSE",+ "WALLET": "/opt/oracle/wallet",+ },+ },+ {+ name: "TLS mode Disabled passes an SSL key through",+ extraParameters: map[string]string{"ssl": "TRUE"},+ want: map[string]string{"CONNECTION TIMEOUT": "10", "ssl": "TRUE"},+ },}for _, test := range tests {t.Run(test.name, func(t *testing.T) {extraParameters := maps.Clone(test.extraParameters)- got := connectionOptions(test.sid, extraParameters)+ got := connectionOptions(test.sid, extraParameters, test.useTLS)require.Equal(t, test.want, got)require.Equal(t, test.extraParameters, extraParameters)})@@ -212,16 +253,16 @@ func TestConnectionOptions(t *testing.T) {// go-ora reads the options back from the URL, so these cases check what the driver ends up// with rather than what Bytebase sent.func TestConnectionOptionsAsReadByDriver(t *testing.T) {- parse := func(t *testing.T, sid string, extraParameters map[string]string) *configurations.ConnectionConfig {+ parse := func(t *testing.T, sid string, extraParameters map[string]string, useTLS bool) *configurations.ConnectionConfig {t.Helper()- dsn := goora.BuildUrl("primary.example.com", 1521, "ORCLPDB1", "bytebase", "secret", connectionOptions(sid, extraParameters))+ dsn := goora.BuildUrl("primary.example.com", 1521, "ORCLPDB1", "bytebase", "secret", connectionOptions(sid, extraParameters, useTLS))config, err := configurations.ParseConfig(dsn)require.NoError(t, err)return config}t.Run("default", func(t *testing.T) {- config := parse(t, "", nil)+ config := parse(t, "", nil, false)require.Equal(t, 10*time.Second, config.ConnectTimeout)// A read timeout would cut off long statements.require.Zero(t, config.Timeout)@@ -230,24 +271,24 @@ func TestConnectionOptionsAsReadByDriver(t *testing.T) {for _, key := range []string{"CONNECTION TIMEOUT", "connection timeout", "CONNECT TIMEOUT", "connect timeout", "Connect Timeout"} {t.Run("dial timeout as "+key, func(t *testing.T) {- config := parse(t, "", map[string]string{key: "5"})+ config := parse(t, "", map[string]string{key: "5"}, false)require.Equal(t, 5*time.Second, config.ConnectTimeout)require.Zero(t, config.Timeout)})}t.Run("dial timeout turned off", func(t *testing.T) {- config := parse(t, "", map[string]string{"connect timeout": "0"})+ config := parse(t, "", map[string]string{"connect timeout": "0"}, false)require.Zero(t, config.ConnectTimeout)})t.Run("SID field", func(t *testing.T) {- config := parse(t, "ORCL", nil)+ config := parse(t, "ORCL", nil, false)require.Equal(t, "ORCL", config.SID)})t.Run("SID key replaces the SID field", func(t *testing.T) {- config := parse(t, "ORCL", map[string]string{"sid": "STANDBY"})+ config := parse(t, "ORCL", map[string]string{"sid": "STANDBY"}, false)require.Equal(t, "STANDBY", config.SID)})@@ -257,7 +298,7 @@ func TestConnectionOptionsAsReadByDriver(t *testing.T) {"SSL": "true","SSL VERIFY": "false","AUTH TYPE": "TCPS",- })+ }, false)require.Equal(t, []configurations.ServerAddr{{Addr: "primary.example.com", Port: 1521},{Addr: "standby-1.example.com", Port: 2484},@@ -268,4 +309,290 @@ func TestConnectionOptionsAsReadByDriver(t *testing.T) {require.Equal(t, configurations.TCPS, config.AuthType)require.Equal(t, 10*time.Second, config.ConnectTimeout)})++ for _, key := range []string{"SSL", "ssl", "Ssl"} {+ t.Run("TLS mode TLS overrides "+key+"=FALSE", func(t *testing.T) {+ config := parse(t, "", map[string]string{key: "FALSE"}, true)+ require.True(t, config.SSL)+ })+ }++ t.Run("TLS mode Disabled reads SSL from extra parameters", func(t *testing.T) {+ config := parse(t, "", map[string]string{"ssl": "true"}, false)+ require.True(t, config.SSL)+ })+}++func TestOpenAppliesTLSSettings(t *testing.T) {+ pki := newTestPKI(t)+ serverConfig := &tls.Config{Certificates: []tls.Certificate{pki.server}}+ mutualConfig := &tls.Config{+ Certificates: []tls.Certificate{pki.server},+ ClientAuth: tls.RequireAndVerifyClientCert,+ ClientCAs: pki.caPool,+ }+ verified := func(port string) *storepb.DataSource {+ dataSource := tlsTestDataSource(port)+ dataSource.UseSsl = true+ dataSource.VerifyTlsCertificate = true+ dataSource.SslCa = pki.caPEM+ return dataSource+ }++ t.Run("TLS mode Disabled connects without TLS", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ ping(t, tlsTestDataSource(port))+ require.ErrorContains(t, nextHandshake(t, handshakes).err, "first record does not look like a TLS handshake")+ })++ t.Run("TLS mode TLS without verification", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ dataSource := tlsTestDataSource(port)+ dataSource.UseSsl = true+ ping(t, dataSource)+ require.NoError(t, nextHandshake(t, handshakes).err)+ })++ t.Run("Verify accepts the signing CA through a name in the certificate", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ ping(t, verified(port))+ require.NoError(t, nextHandshake(t, handshakes).err)+ })++ t.Run("Verify rejects a name the certificate doesn't list", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ dataSource := verified(port)+ dataSource.Host = "127.0.0.1"+ require.Contains(t, ping(t, dataSource), "x509: cannot validate certificate for 127.0.0.1")+ require.Error(t, nextHandshake(t, handshakes).err)+ })++ t.Run("Verify rejects an unrelated CA", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ dataSource := verified(port)+ dataSource.SslCa = newTestPKI(t).caPEM+ require.Contains(t, ping(t, dataSource), "x509: certificate signed by unknown authority")+ require.Error(t, nextHandshake(t, handshakes).err)+ })++ t.Run("Verify with system trust rejects a private CA", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ dataSource := verified(port)+ dataSource.SslCa = ""+ // The message comes from the platform's verifier, so it differs between macOS and Linux.+ require.Contains(t, ping(t, dataSource), "x509:")+ require.Error(t, nextHandshake(t, handshakes).err)+ })++ t.Run("Verify checks a SERVER address against its own name", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ // Hostname refuses connections, and the certificate doesn't name it.+ dataSource := verified(closedPort(t))+ dataSource.Host = "127.0.0.1"+ dataSource.ExtraConnectionParameters = map[string]string{"SERVER": "localhost:" + port}+ ping(t, dataSource)+ require.NoError(t, nextHandshake(t, handshakes).err)+ })++ t.Run("Mutual TLS presents the client certificate", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, mutualConfig)+ dataSource := verified(port)+ dataSource.SslCert = pki.clientCertPEM+ dataSource.SslKey = pki.clientKeyPEM+ ping(t, dataSource)+ result := nextHandshake(t, handshakes)+ require.NoError(t, result.err)+ require.Equal(t, "bytebase", result.peer)+ })++ t.Run("TLS mode TLS presents no client certificate", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, mutualConfig)+ ping(t, verified(port))+ require.ErrorContains(t, nextHandshake(t, handshakes).err, "client didn't provide a certificate")+ })++ t.Run("an SSL extra parameter can't turn TLS off", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ dataSource := tlsTestDataSource(port)+ dataSource.UseSsl = true+ dataSource.ExtraConnectionParameters = map[string]string{"ssl": "FALSE"}+ ping(t, dataSource)+ require.NoError(t, nextHandshake(t, handshakes).err)+ })++ t.Run("an SSL VERIFY extra parameter can't turn verification off", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ dataSource := verified(port)+ dataSource.Host = "127.0.0.1"+ dataSource.ExtraConnectionParameters = map[string]string{"SSL VERIFY": "FALSE"}+ require.Contains(t, ping(t, dataSource), "x509: cannot validate certificate for 127.0.0.1")+ require.Error(t, nextHandshake(t, handshakes).err)+ })++ t.Run("each connection gets its own copy of the TLS configuration", func(t *testing.T) {+ port, handshakes := startTCPSListener(t, serverConfig)+ portNumber, err := strconv.Atoi(port)+ require.NoError(t, err)+ config, err := getTLSConfig(verified(port))+ require.NoError(t, err)+ c := &connector{+ dsn: goora.BuildUrl("localhost", portNumber, "ORCLPDB1", "bytebase", "secret", connectionOptions("", nil, true)),+ tlsConfig: config,+ }+ _, err = c.Connect(context.Background())+ require.Error(t, err)+ require.NoError(t, nextHandshake(t, handshakes).err)+ // go-ora sets ServerName on the configuration it is handed, just before the handshake.+ require.Empty(t, config.ServerName)+ })+}++func closedPort(t *testing.T) string {+ t.Helper()+ listener, err := net.Listen("tcp", "127.0.0.1:0")+ require.NoError(t, err)+ _, port, err := net.SplitHostPort(listener.Addr().String())+ require.NoError(t, err)+ require.NoError(t, listener.Close())+ return port+}++// testPKI holds a CA, a server certificate it signs for localhost only, and a client+// certificate it signs.+type testPKI struct {+ caPEM string+ caPool *x509.CertPool+ server tls.Certificate+ clientCertPEM string+ clientKeyPEM string+}++func newTestPKI(t *testing.T) *testPKI {+ t.Helper()+ ca, caKey, caPEM, _ := issueCertificate(t, &x509.Certificate{+ Subject: pkix.Name{CommonName: "Bytebase Test CA"},+ IsCA: true,+ BasicConstraintsValid: true,+ KeyUsage: x509.KeyUsageCertSign,+ }, nil, nil)+ _, _, serverCertPEM, serverKeyPEM := issueCertificate(t, &x509.Certificate{+ Subject: pkix.Name{CommonName: "localhost"},+ DNSNames: []string{"localhost"},+ KeyUsage: x509.KeyUsageDigitalSignature,+ ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},+ }, ca, caKey)+ _, _, clientCertPEM, clientKeyPEM := issueCertificate(t, &x509.Certificate{+ Subject: pkix.Name{CommonName: "bytebase"},+ KeyUsage: x509.KeyUsageDigitalSignature,+ ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},+ }, ca, caKey)+ server, err := tls.X509KeyPair([]byte(serverCertPEM), []byte(serverKeyPEM))+ require.NoError(t, err)+ caPool := x509.NewCertPool()+ caPool.AddCert(ca)+ return &testPKI{+ caPEM: caPEM,+ caPool: caPool,+ server: server,+ clientCertPEM: clientCertPEM,+ clientKeyPEM: clientKeyPEM,+ }+}++// issueCertificate signs template with parentKey, or self-signs it when parent is nil. It+// returns the certificate, its key, and both in PEM.+func issueCertificate(t *testing.T, template, parent *x509.Certificate, parentKey *ecdsa.PrivateKey) (*x509.Certificate, *ecdsa.PrivateKey, string, string) {+ t.Helper()+ key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)+ require.NoError(t, err)+ template.SerialNumber, err = rand.Int(rand.Reader, big.NewInt(1<<62))+ require.NoError(t, err)+ template.NotBefore = time.Now().Add(-time.Hour)+ template.NotAfter = time.Now().Add(time.Hour)+ if parent == nil {+ parent, parentKey = template, key+ }+ der, err := x509.CreateCertificate(rand.Reader, template, parent, &key.PublicKey, parentKey)+ require.NoError(t, err)+ certificate, err := x509.ParseCertificate(der)+ require.NoError(t, err)+ keyDER, err := x509.MarshalPKCS8PrivateKey(key)+ require.NoError(t, err)+ certificatePEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: der})+ keyPEM := pem.EncodeToMemory(&pem.Block{Type: "PRIVATE KEY", Bytes: keyDER})+ return certificate, key, string(certificatePEM), string(keyPEM)+}++type handshake struct {+ err error+ // peer is the common name of the client certificate, if one was presented.+ peer string+}++// startTCPSListener stands in for an Oracle TCPS port. It reports each TLS handshake and then+// closes the connection, so the driver fails right after the handshake instead of signing in.+func startTCPSListener(t *testing.T, config *tls.Config) (string, <-chan handshake) {+ t.Helper()+ listener, err := net.Listen("tcp", "127.0.0.1:0")+ require.NoError(t, err)+ t.Cleanup(func() { _ = listener.Close() })+ handshakes := make(chan handshake, 32)+ go func() {+ for {+ conn, err := listener.Accept()+ if err != nil {+ return+ }+ go func() {+ tlsConn := tls.Server(conn, config)+ defer tlsConn.Close()+ _ = tlsConn.SetDeadline(time.Now().Add(10 * time.Second))+ result := handshake{err: tlsConn.Handshake()}+ if certificates := tlsConn.ConnectionState().PeerCertificates; len(certificates) > 0 {+ result.peer = certificates[0].Subject.CommonName+ }+ select {+ case handshakes <- result:+ default:+ }+ }()+ }+ }()+ _, port, err := net.SplitHostPort(listener.Addr().String())+ require.NoError(t, err)+ return port, handshakes+}++func nextHandshake(t *testing.T, handshakes <-chan handshake) handshake {+ t.Helper()+ select {+ case result := <-handshakes:+ return result+ case <-time.After(20 * time.Second):+ require.FailNow(t, "no connection reached the listener")+ return handshake{}+ }+}++func tlsTestDataSource(port string) *storepb.DataSource {+ return &storepb.DataSource{+ Host: "localhost",+ Port: port,+ Username: "bytebase",+ ServiceName: "ORCLPDB1",+ }+}++// ping opens the driver and returns the message of the ping error that startTCPSListener always+// causes.+func ping(t *testing.T, dataSource *storepb.DataSource) string {+ t.Helper()+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)+ defer cancel()+ driver, err := (&Driver{}).Open(ctx, storepb.Engine_ORACLE, db.ConnectionConfig{DataSource: dataSource, Password: "secret"})+ require.NoError(t, err)+ defer driver.Close(ctx)+ err = driver.Ping(ctx)+ require.Error(t, err)+ return err.Error()}diff --git a/docs/design/oracle-tls.md b/docs/design/oracle-tls.mdnew file mode 100644index 0000000000..1d9236b0d0--- /dev/null+++ b/docs/design/oracle-tls.md@@ -0,0 +1,209 @@+# Oracle TLS++Status: implemented in this PR · 2026-10-14 · [BYT-10315](https://linear.app/bytebase/issue/BYT-10315)++The instance form's TLS section (TLS mode, Verify server certificate, CA certificate, client+certificate and key) has never reached the Oracle driver. The driver gives go-ora only the Extra+Parameters, the SID and a dial timeout, so TLS mode TLS connects without TLS. **The TLS section+decides the connection: TLS mode TLS and Mutual TLS connect over TCPS with the section's+certificates, Verify server certificate checks the certificate chain and the name of the server+Bytebase connects to, and go-ora's own TLS keys in Extra Parameters give way to the section, with a+notice under each.** The upgrade turns TLS mode off and removes the certificates on existing Oracle+data sources, where they never applied, so they keep connecting.++## Problem++Verified on `main` at `53fb4815dc`:++- **TLS mode does nothing.** `Driver.Open` in `backend/plugin/db/oracle/oracle.go` builds the go-ora+ URL from the Extra Parameters, the SID and the dial timeout. It never reads `use_ssl`,+ `verify_tls_certificate`, `ssl_ca`, `ssl_cert` or `ssl_key`. The form shows the whole TLS section+ for Oracle (`instanceV1HasSSL`), so a user who turns TLS on and pastes a CA saves successfully and+ gets a connection without TLS. Against a TCPS port it fails with `EOF` or `connection reset by+ peer` (BYT-10206 lab, Bytebase 3.23.0).+- **Unused files can still fail the connection.** With TLS on, `dbfactory.GetDataSourceDriver`+ reads a CA or client certificate file path before it opens the driver, so a missing file fails a+ connection that would never use it.+- **A private CA or a client certificate needs a wallet.** `SSL=TRUE` in Extra Parameters connects+ over TCPS and checks the certificate against the system roots. Trusting any other CA, or sending+ a client certificate, takes `WALLET` too. A wallet is a directory on the Bytebase host, which+ Bytebase Cloud doesn't provide, and making one from a PEM CA takes Oracle's `orapki`.++Oracle is the only engine in `instanceV1HasSSL` whose driver reads none of the TLS section.++## Principle++> What the TLS section shows is what the connection does. An upgrade doesn't break a connection+> that works today: where the stored settings and the connection disagreed, the upgrade changes the+> settings to match the connection, and the form shows it.++## How go-ora reads the options++Bytebase links `github.com/sijms/go-ora/v2 v2.9.0`.++| Option | Effect |+|---|---|+| `SSL` | `TRUE`, `ENABLE` or `ENABLED`, in any case, connects over TCPS; any other value over TCP. Off by default. |+| `SSL VERIFY` | The same values. Checks the certificate chain and the server name. On by default. |+| `WALLET` | A wallet directory. go-ora opens `cwallet.sso`, or `ewallet.p12` with `WALLET PASSWORD`. With `SSL` on, it trusts the wallet's certificates and sends its client certificate. With Username set and Password empty, it signs in with the wallet's stored password. |++- **Keys.** go-ora upper-cases each key. When two keys name the same option, which value wins+ depends on map order.+- **A supplied TLS configuration.** `OracleConnector.WithTLSConfig` gives go-ora a `crypto/tls`+ configuration. go-ora then uses it for the handshake instead of `SSL VERIFY` and the wallet's+ certificates; `SSL` still decides whether there is a handshake. Before each handshake, go-ora sets+ the configuration's `ServerName` to the server it dialed: Hostname, an address from `SERVER` or+ `connStr`, or a listener's redirect target. go-ora's connector hands the same configuration to+ every connection.+- **Addresses that name a protocol.** An address in a `connStr` descriptor or a listener redirect+ that names `PROTOCOL=TCP` connects over TCP, whatever `SSL` says. go-ora reads the descriptor+ only from a key spelled `connStr`.++## Decisions++**D1 · Build the TLS configuration from the section and give go-ora a copy per connection.**+Bytebase builds it with `util.GetTLSConfig`, as MySQL and PostgreSQL do, and opens the database+through a connector that clones it for each connection. Rejected: go-ora's URL options alone. They+take certificates only from a wallet directory, which a pasted PEM isn't. Rejected: one shared+configuration through `WithTLSConfig`. go-ora writes `ServerName` on it at each connect, a data race+when the pool opens connections in parallel, and with `SERVER` addresses one connection can be+checked against another's name.++**D2 · TLS mode TLS and Mutual TLS set `SSL=TRUE`.** Mutual TLS also sends the section's client+certificate, which is the certificate `AUTH TYPE=TCPS` in Extra Parameters signs in with. An+address that names `PROTOCOL=TCP` is the exception go-ora keeps; see Not in this PR.++**D3 · Verify server certificate checks the chain and the dialed server's name.** The chain is+checked against the CA when one is set (pasted or file path), otherwise against the system roots.+The name is checked against the server go-ora dialed, as go-ora's own `SSL VERIFY` does, so a+standby in `SERVER` is checked against its own name. Rejected: `util.GetTLSConfig`'s verifier as+is. It checks Host, so a standby whose certificate names only itself fails. With Verify off, the+certificate isn't checked, and the connection is still encrypted.++**D4 · TLS mode Disabled keeps today's connection.** Extra Parameters apply as given, including+`SSL=TRUE` with a wallet.++**D5 · Under TLS mode TLS or Mutual TLS, the section replaces go-ora's own TLS keys.** An `SSL` key+in any spelling is replaced by `TRUE`. `SSL VERIFY` and the wallet's certificates aren't used,+because the section's configuration replaces them. A password stored in the wallet still signs in+when Password is empty. Rejected: the wallet wins over the section, which lets the form show a CA+that the connection doesn't use. Rejected: an error on the combination, since a wallet that only+stores the password is a valid setup.++**D6 · The form marks each Extra Parameter the section replaces.** On an Oracle data source with+TLS mode TLS or Mutual TLS, a warning line appears under each `SSL`, `SSL VERIFY` and `WALLET` row,+in any spelling and whatever its value. Saving isn't blocked. Rejected: warning only when the value+disagrees with the section. A matching key does nothing either, and the form would have to parse+values as go-ora does. Rejected: one note under TLS mode, away from the row it is about.++**D7 · The upgrade turns TLS mode off and removes the certificates on every Oracle data source.**+Migration `3.24.2` removes `useSsl`, the CA and the client certificate, as turning TLS off in the+form does, also where TLS mode is already off: the API has cleared certificates on save only since+3.17.1 (#20062), so older data sources can still hold a CA. All Oracle data sources connect today+as if TLS mode were Disabled, so honoring the stored value would fail every one whose port serves+plain TCP or whose certificate doesn't verify; the form turns Verify on whenever TLS is turned on.+Data sources whose Extra Parameters set `SSL=TRUE` keep their TLS connection under D4. Rejected:+honoring the stored value. It is secure, but syncs, queries and rollouts would stop until someone+edits each data source. Rejected: keeping the certificates. Turning TLS mode on would then trust a+kept CA while the form showed System trust.++## States++What Bytebase sends, by TLS section, with no Extra Parameters:++| TLS mode | Verify | CA | `SSL` | Certificates trusted | Client certificate | Certificate check |+|---|---|---|---|---|---|---|+| Disabled | any | any | unset | None | None | None; no TLS |+| TLS | Off | any | `TRUE` | Any | None | None |+| TLS | On | Pasted or file path | `TRUE` | The CA | None | Chain to the CA; dialed server's name |+| TLS | On | System trust | `TRUE` | System roots | None | Chain to the system roots; dialed server's name |+| Mutual TLS | As TLS | As TLS | `TRUE` | As TLS | The section's | As TLS |++Extra Parameters under TLS mode TLS or Mutual TLS:++| Key | Result | Form notice |+|---|---|---|+| `SSL` | Replaced by `TRUE` | Overridden by the TLS section. |+| `SSL VERIFY` | Not used; Verify server certificate decides | Overridden by the TLS section. |+| `WALLET` | Its certificates aren't used. A password stored in it still signs in when Password is empty, and go-ora still opens it, so a wallet it can't read fails the connection | Only its stored password is used. The TLS section supplies the certificates. |+| Any other key, such as `SERVER` or `AUTH TYPE` | Applies | None |++Under TLS mode Disabled, Extra Parameters apply as given, and the form shows no notice.++## Upgrade and breaking changes++| Before the upgrade | After |+|---|---|+| TLS mode TLS or Mutual TLS | TLS mode shows Disabled. The connection is unchanged: plain TCP, or TLS through Extra Parameters. |+| A stored CA or client certificate, in any TLS mode | Removed |+| TLS mode Disabled, no certificates | Unchanged |++These changes can break a setup:++1. **TLS mode TLS now uses TLS.** Set through the form, the API or Terraform, it connects over+ TCPS. A port that serves plain TCP, usually 1521, fails with `EOF` or `connection reset by+ peer`.+2. **Verify server certificate now verifies.** The certificate must chain to the CA, or to a system+ root under System trust, and name the server Bytebase connects to. Typical failures are a+ private CA with no CA pasted (`certificate signed by unknown authority`), a name the certificate+ doesn't list (`certificate is valid for …, not …`), and an IP address it doesn't list (`doesn't+ contain any IP SANs`).+3. **Terraform turns TLS mode back on.** The provider sends every data source on update, and+ `use_ssl` defaults to `false`. A configuration that sets `use_ssl = true` on an Oracle data+ source shows a diff after the upgrade, and the next `terraform apply` turns TLS mode on. The+ apply succeeds, because updating an instance doesn't test the connection. Syncs, queries and+ rollouts then fail if 1 or 2 applies. Configurations that omit the field are unaffected.+4. **go-ora's TLS keys give way under TLS mode TLS.** `SSL=FALSE` no longer turns TLS off,+ `SSL VERIFY` is ignored, and the wallet's certificates aren't used.++Release note draft:++> **Oracle: TLS settings now take effect.** TLS mode TLS connects over TCPS, Verify server+> certificate checks the server's certificate against your CA, or the system's trusted CAs, and the+> host name, and Mutual TLS sends your client certificate, so TLS no longer needs an Oracle wallet.+> The upgrade turns TLS mode off and removes the stored certificates on existing Oracle data+> sources, which never applied them, so they keep connecting as before; turn TLS on and add your CA+> to use it. With TLS mode on, `SSL`, `SSL VERIFY` and a wallet's certificates in Extra Parameters+> no longer apply. **Terraform:** if your configuration sets `use_ssl = true` on an Oracle data+> source, the next `terraform apply` turns TLS on. Make sure the port serves TCPS and the+> certificate verifies first, or set it to `false`.++## Scope++| File | Change |+|---|---|+| `backend/plugin/db/oracle/oracle.go` | `Open` builds the TLS configuration (D1 to D3) and opens through a connector that clones it per connection; `connectionOptions` sets `SSL=TRUE` and drops `SSL` keys under TLS mode TLS (D5) |+| `backend/migrator/migration/3.24/0002##oracle_tls_off.sql` | D7 |+| `frontend/src/components/instance/DataSourceForm.tsx`, `tls.ts` | D6 |+| `frontend/src/locales/*.json` | D6 notices |++Tests:++- `TestOpenAppliesTLSSettings` opens the driver against a TLS listener in the test that stands in+ for an Oracle TCPS port. Disabled doesn't start a handshake. TLS completes one, and with Verify on+ accepts the signing CA through `localhost` and rejects `127.0.0.1`, an unrelated CA and system+ trust. A `SERVER` address is checked against its own name. Mutual TLS presents the client+ certificate, and TLS mode TLS presents none. `SSL=FALSE` and `SSL VERIFY=FALSE` in Extra+ Parameters can't turn TLS or verification off. Connecting leaves the connector's configuration+ unchanged, so each connection gets its own copy. The listener ends each connection after the+ handshake, so these tests stop short of the Oracle protocol.+- `TestConnectionOptions` and `TestConnectionOptionsAsReadByDriver` cover the `SSL` key under both+ TLS modes.+- `TestMigration3_24_2_OracleTLSOff` runs D7 against PostgreSQL.+- `InstanceFormContext.test.tsx` covers D6: the notices on an Oracle data source with TLS mode TLS,+ none under Disabled or for another engine, and saving stays allowed.++## Not in this PR++- The Oracle connection page (`docs/get-started/connect/oracle.mdx` in bytebase/bytebase.com) says+ "Bytebase does not use the TLS settings for Oracle" in its field reference and "Leave the TLS+ section at Disabled" in the wallet steps. When this ships, describe the TLS section as the way to+ connect over TCPS with PEM certificates, keep the wallet steps for wallets, and add the new+ certificate errors to its troubleshooting table.+- A wallet as a CA source in the TLS section, so wallet users set TLS mode instead of `SSL=TRUE`.+- An address that names `PROTOCOL=TCP`, in a `connStr` Extra Parameter or a listener redirect,+ still connects over TCP under TLS mode TLS. Bytebase doesn't rewrite descriptors or refuse a+ redirect.+- go-ora's `BuildUrl` writes Extra Parameter keys and `SERVER` values into the URL unescaped, so a+ key such as `S%53L` or a `SERVER` value containing `&SSL=FALSE` can add a second `SSL`, and the+ connection may then skip TLS. Only someone who can already turn TLS mode off can write either.diff --git a/frontend/src/components/instance/DataSourceForm.tsx b/frontend/src/components/instance/DataSourceForm.tsxindex 1bf73392f5..5954639bc7 100644--- a/frontend/src/components/instance/DataSourceForm.tsx+++ b/frontend/src/components/instance/DataSourceForm.tsx@@ -1,6 +1,13 @@import { create } from "@bufbuild/protobuf";import { Info, Plus } from "lucide-react";-import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import {+ useCallback,+ useEffect,+ useId,+ useMemo,+ useRef,+ useState,+} from "react";import { useTranslation } from "react-i18next";import { LearnMoreLink } from "@/components/LearnMoreLink";import { Button } from "@/components/ui/button";@@ -61,6 +68,7 @@ import {getLocalTlsCaSource,getLocalTlsClientCertSource,getLocalTlsPosture,+ getOracleTlsParameterOverride,LOCAL_TLS_CLIENT_CERT_SOURCE_INLINE_PEM,LOCAL_TLS_CLIENT_CERT_SOURCE_NONE,LOCAL_TLS_POSTURE_DISABLED,@@ -210,6 +218,7 @@ export function DataSourceForm({);const [newParamKey, setNewParamKey] = useState("");const [newParamValue, setNewParamValue] = useState("");+ const extraParamNoticeId = useId();const [localTlsCaSource, setLocalTlsCaSource] = useState(getLocalTlsCaSource(dataSource));@@ -397,8 +406,17 @@ export function DataSourceForm({const extraConnectionParamsList = useMemo(() => {const params = dataSource.extraConnectionParameters || {};- return Object.entries(params).map(([key, value]) => ({ key, value }));- }, [dataSource.extraConnectionParameters]);+ const oracleTls = basicInfo.engine === Engine.ORACLE && dataSource.useSsl;+ return Object.entries(params).map(([key, value]) => ({+ key,+ value,+ tlsOverride: oracleTls ? getOracleTlsParameterOverride(key) : undefined,+ }));+ }, [+ basicInfo.engine,+ dataSource.extraConnectionParameters,+ dataSource.useSsl,+ ]);const changeSecretType = (secretType: DataSourceExternalSecret_SecretType@@ -2269,6 +2287,11 @@ export function DataSourceForm({className="min-w-0 flex-1"value={param.key}disabled={!allowEdit}+ aria-describedby={+ param.tlsOverride+ ? `${extraParamNoticeId}-${index}`+ : undefined+ }aria-label={t("instance.parameter-name-placeholder")}@@ -2311,6 +2334,20 @@ export function DataSourceForm({</Button>)}</FormControlRow>+ {param.tlsOverride && (+ <p+ id={`${extraParamNoticeId}-${index}`}+ className="text-xs leading-4 text-warning"+ >+ {param.tlsOverride === "wallet"+ ? t(+ "data-source.extra-params.wallet-overridden-by-tls"+ )+ : t(+ "data-source.extra-params.overridden-by-tls"+ )}+ </p>+ )}</FormField>))}</FormControlGroup>diff --git a/frontend/src/components/instance/InstanceFormContext.test.tsx b/frontend/src/components/instance/InstanceFormContext.test.tsxindex dbf446384d..142e8daa80 100644--- a/frontend/src/components/instance/InstanceFormContext.test.tsx+++ b/frontend/src/components/instance/InstanceFormContext.test.tsx@@ -1174,6 +1174,103 @@ describe("InstanceFormProvider", () => {});+ const tlsExtraParameters = {+ SSL: "FALSE",+ "ssl verify": "TRUE",+ WALLET: "/etc/oracle-wallet",+ SERVER: "standby.example.com:2484",+ };++ test.each<{+ name: string;+ engine: Engine;+ useSsl: boolean;+ notices: Partial<Record<string, string>>;+ }>([+ {+ name: "Oracle with TLS mode TLS",+ engine: Engine.ORACLE,+ useSsl: true,+ notices: {+ SSL: "data-source.extra-params.overridden-by-tls",+ "ssl verify": "data-source.extra-params.overridden-by-tls",+ WALLET: "data-source.extra-params.wallet-overridden-by-tls",+ },+ },+ {+ name: "Oracle with TLS mode Disabled",+ engine: Engine.ORACLE,+ useSsl: false,+ notices: {},+ },+ {+ name: "MySQL with TLS on",+ engine: Engine.MYSQL,+ useSsl: true,+ notices: {},+ },+ ])(+ "marks extra parameters the TLS section overrides: $name",+ async ({ engine, useSsl, notices }) => {+ mocks.hasSSL = true;+ mocks.hasExtraParameters = true;+ const { DataSourceForm } = await vi.importActual<+ typeof import("./DataSourceForm")+ >("./DataSourceForm");+ let context!: ReturnType<typeof useInstanceFormContext>;+ const Editor = () => {+ context = useInstanceFormContext();+ return (+ <DataSourceForm+ dataSource={context.adminDataSource}+ onDataSourceChange={(ds) => context.setDataSourceEditState((state) => ({+ ...state, dataSources: [ds],+ }))}+ optionsOnly+ />+ );+ };+ const harness = renderIntoContainer();+ const notice = (key: string) => {+ const input = Array.from(+ harness.container.querySelectorAll<HTMLInputElement>(+ 'input[aria-label="instance.parameter-name-placeholder"]'+ )+ ).find((element) => element.value === key);+ expect(input).toBeDefined();+ const ids = input?.getAttribute("aria-describedby")?.split(" ") ?? [];+ const texts = ids.map(+ (id) => harness.container.querySelector(`[id="${id}"]`)?.textContent+ );+ return texts.length > 0 ? texts.join(" ") : undefined;+ };+ try {+ await harness.render(+ <InstanceFormProvider><Editor /></InstanceFormProvider>+ );+ await act(async () => {+ context.setBasicInfo((previous) => ({ ...previous, engine }));+ context.setDataSourceEditState((state) => ({+ ...state,+ dataSources: [{+ ...context.adminDataSource,+ host: "db.example.com",+ serviceName: "ORCLPDB1",+ useSsl,+ extraConnectionParameters: tlsExtraParameters,+ }],+ }));+ });+ for (const key of Object.keys(tlsExtraParameters)) {+ expect(notice(key), key).toBe(notices[key]);+ }+ expect(context.checkDataSource([context.adminDataSource])).toBe(true);+ } finally {+ harness.unmount();+ }+ }+ );+test("places add parameter in the extra parameters form field", async () => {mocks.hasExtraParameters = true;const { DataSourceForm } = await vi.importActual<diff --git a/frontend/src/components/instance/tls.ts b/frontend/src/components/instance/tls.tsindex 92a5be164e..73c572ee23 100644--- a/frontend/src/components/instance/tls.ts+++ b/frontend/src/components/instance/tls.ts@@ -150,6 +150,25 @@ export const isLocalTlsClientIdentitySupported = (engine: Engine): boolean => {return engine !== Engine.MSSQL;};+export type OracleTlsParameterOverride = "setting" | "wallet";++// With TLS on, the Oracle driver sends its own SSL option and its own TLS+// configuration, so go-ora's SSL and SSL VERIFY keys and a wallet's+// certificates don't apply. go-ora upper-cases keys.+export const getOracleTlsParameterOverride = (+ key: string+): OracleTlsParameterOverride | undefined => {+ switch (key.toUpperCase()) {+ case "SSL":+ case "SSL VERIFY":+ return "setting";+ case "WALLET":+ return "wallet";+ default:+ return undefined;+ }+};+export const applyLocalTlsCaSource = (ds: DataSource,source: LocalTlsCaSourcediff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 4113f0c818..0375133666 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -648,7 +648,9 @@"direct-connection": "Direct Connection","extra-params": {"description": "Additional parameters for database connection string",- "self": "Extra Parameters"+ "overridden-by-tls": "Overridden by the TLS section.",+ "self": "Extra Parameters",+ "wallet-overridden-by-tls": "Only its stored password is used. The TLS section supplies the certificates."},"no-read-only-data-source": "No read-only data source","private-key-passphrase": "Private Key Passphrase",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 1c7496d9df..1c5f5138d8 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -648,7 +648,9 @@"direct-connection": "Conexión directa","extra-params": {"description": "Parámetros adicionales para la cadena de conexión de la base de datos",- "self": "Parámetros adicionales"+ "overridden-by-tls": "Anulado por la sección TLS.",+ "self": "Parámetros adicionales",+ "wallet-overridden-by-tls": "Solo se usa su contraseña almacenada. La sección TLS proporciona los certificados."},"no-read-only-data-source": "Sin fuente de datos de solo lectura","private-key-passphrase": "Frase de contraseña de clave privada",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 558a56c808..b0e874a845 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -648,7 +648,9 @@"direct-connection": "直接接続","extra-params": {"description": "データベース接続文字列の追加パラメーター",- "self": "追加のパラメーター"+ "overridden-by-tls": "TLS セクションの設定が優先されます。",+ "self": "追加のパラメーター",+ "wallet-overridden-by-tls": "保存されたパスワードのみ使用されます。証明書は TLS セクションのものが使われます。"},"no-read-only-data-source": "読み取り専用データソースがありません","private-key-passphrase": "秘密鍵のパスフレーズ",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 2838507c9f..604d5995e6 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -648,7 +648,9 @@"direct-connection": "Kết nối trực tiếp","extra-params": {"description": "Các tham số bổ sung cho chuỗi kết nối cơ sở dữ liệu",- "self": "Thông số bổ sung"+ "overridden-by-tls": "Bị ghi đè bởi phần TLS.",+ "self": "Thông số bổ sung",+ "wallet-overridden-by-tls": "Chỉ mật khẩu đã lưu của nó được sử dụng. Phần TLS cung cấp các chứng chỉ."},"no-read-only-data-source": "Không có nguồn dữ liệu chỉ đọc","private-key-passphrase": "Mật khẩu khóa riêng",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex ad54d29c6f..b5b70e8d03 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -648,7 +648,9 @@"direct-connection": "直接连接","extra-params": {"description": "数据库连接字符串的其他参数",- "self": "额外的参数"+ "overridden-by-tls": "已被 TLS 部分的设置覆盖。",+ "self": "额外的参数",+ "wallet-overridden-by-tls": "仅使用其中保存的密码,证书由 TLS 部分提供。"},"no-read-only-data-source": "没有只读数据源","private-key-passphrase": "私钥密码",