Repository: dexidp/dex
Pull request #3414 (2024-03-12 04:41:48)

build(deps): bump github.com/go-sql-driver/mysql from 1.7.1 to 1.8.0
Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.7.1 to 1.8.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/go-sql-driver/mysql/releases">github.com/go-sql-driver/mysql's releases</a>.</em></p>
<blockquote>
<h2>v1.8.0</h2>
<h2>What's Changed</h2>
<h2>Major changes</h2>
<ul>
<li>
<p>Use <code>SET NAMES charset COLLATE collation</code>. by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1437">go-sql-driver/mysql#1437</a></p>
<ul>
<li>Older go-mysql-driver used <code>collation_id</code> in the handshake packet. But it caused collation mismatch in some situation.</li>
<li>If you don't specify charset nor collation, go-mysql-driver sends <code>SET NAMES utf8mb4</code> for new connection. This uses server's default collation for utf8mb4.</li>
<li>If you specify charset, go-mysql-driver sends <code>SET NAMES &lt;charset&gt;</code>. This uses the server's default collation for <code>&lt;charset&gt;</code>.</li>
<li>If you specify collation and/or charset, go-mysql-driver sends <code>SET NAMES charset COLLATE collation</code>.</li>
</ul>
</li>
<li>
<p>PathEscape dbname in DSN. by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1432">go-sql-driver/mysql#1432</a></p>
<ul>
<li>This is backward incompatible in rare case. Check your DSN.</li>
</ul>
</li>
<li>
<p>Drop Go 1.13-17 support by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1420">go-sql-driver/mysql#1420</a></p>
<ul>
<li>Use Go 1.18+</li>
</ul>
</li>
<li>
<p>Parse numbers on text protocol too by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1452">go-sql-driver/mysql#1452</a></p>
<ul>
<li>When text protocol is used, go-mysql-driver passed bare <code>[]byte</code> to database/sql for avoid unnecessary allocation and conversion.</li>
<li>If user specified <code>*any</code> to <code>Scan()</code>, database/sql passed the <code>[]byte</code> into the target variabe.</li>
<li>This confused users because most user doesn't know when text/binary protocol used.</li>
<li>go-mysql-driver 1.8 converts integer/float values into int64/double even in text protocol. This doesn't increase allocation compared to <code>[]byte</code> and conversion cost is negilible.</li>
</ul>
</li>
<li>
<p>New options start using the Functional Option Pattern to avoid increasing technical debt in the Config object. Future version may introduce Functional Option for existing options, but not for now.</p>
<ul>
<li>Make TimeTruncate functional option by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1552">go-sql-driver/mysql#1552</a></li>
<li>Add BeforeConnect callback to configuration object by <a href="https://github.com/ItalyPaleAle"><code>@​ItalyPaleAle</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1469">go-sql-driver/mysql#1469</a></li>
</ul>
</li>
</ul>
<h3>Other changes</h3>
<ul>
<li>
<p>Adding DeregisterDialContext to prevent memory leaks with dialers we don't need anymore by <a href="https://github.com/jypelle"><code>@​jypelle</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1422">go-sql-driver/mysql#1422</a></p>
</li>
<li>
<p>Make logger configurable per connection by <a href="https://github.com/frozenbonito"><code>@​frozenbonito</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1408">go-sql-driver/mysql#1408</a></p>
</li>
<li>
<p>Fix ColumnType.DatabaseTypeName for mediumint unsigned by <a href="https://github.com/evanelias"><code>@​evanelias</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1428">go-sql-driver/mysql#1428</a></p>
</li>
<li>
<p>Add connection attributes by <a href="https://github.com/Daemonxiao"><code>@​Daemonxiao</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1389">go-sql-driver/mysql#1389</a></p>
</li>
<li>
<p>Stop <code>ColumnTypeScanType()</code> from returning <code>sql.RawBytes</code> by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1424">go-sql-driver/mysql#1424</a></p>
</li>
<li>
<p>Exec() now provides access to status of multiple statements. by <a href="https://github.com/mherr-google"><code>@​mherr-google</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1309">go-sql-driver/mysql#1309</a></p>
</li>
<li>
<p>Allow to change (or disable) the default driver name for registration by <a href="https://github.com/dolmen"><code>@​dolmen</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1499">go-sql-driver/mysql#1499</a></p>
</li>
<li>
<p>Add default connection attribute '_server_host' by <a href="https://github.com/oblitorum"><code>@​oblitorum</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1506">go-sql-driver/mysql#1506</a></p>
</li>
<li>
<p>QueryUnescape DSN ConnectionAttribute value by <a href="https://github.com/zhangyangyu"><code>@​zhangyangyu</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1470">go-sql-driver/mysql#1470</a></p>
</li>
<li>
<p>Add client_ed25519 authentication by <a href="https://github.com/Gusted"><code>@​Gusted</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1518">go-sql-driver/mysql#1518</a></p>
</li>
<li>
<p>Reduced allocation on connection.go by <a href="https://github.com/EPuncker"><code>@​EPuncker</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1421">go-sql-driver/mysql#1421</a></p>
</li>
<li>
<p>Avoid panic in TestRowsColumnTypes by <a href="https://github.com/wayyoungboy"><code>@​wayyoungboy</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1426">go-sql-driver/mysql#1426</a></p>
</li>
<li>
<p>Add benchmark to receive massive rows. by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1415">go-sql-driver/mysql#1415</a></p>
</li>
<li>
<p>README: Update multistatement by <a href="https://github.com/methane"><code>@​methane</code></a> in <a href="https://redirect.github.com/go-sql-driver/mysql/pull/1431">go-sql-driver/mysql#1431</a></p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/go-sql-driver/mysql/commit/33b7747a9144946e50399904d3f27ecc0f96c2b6"><code>33b7747</code></a> Add BeforeConnect callback to configuration object (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1469">#1469</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/6964272ffd13a41ad66383cd2ea738fded75ad06"><code>6964272</code></a> Make TimeTruncate functional option (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1552">#1552</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/097fe6e3ad83bbd7c84debe810aec4c4a533bcaa"><code>097fe6e</code></a> Update workflows (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1547">#1547</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/f019727e4706bf9c4f60579382f6e72b94bd0305"><code>f019727</code></a> add TiDB support in README.md (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1333">#1333</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/743e263bab87912dfb61789f36c21d9685887c76"><code>743e263</code></a> Introduce <code>timeTruncate</code> parameter for <code>time.Time</code> arguments (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1541">#1541</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/c48c0e7da17e8fc06133e431ce7c10e7a3e94f06"><code>c48c0e7</code></a> Fix unsigned int overflow (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1530">#1530</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/0004702b931d3429afb3e16df444ed80be24d1f4"><code>0004702</code></a> Parallelize test (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1525">#1525</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/d4517c5d905ccd3cc1e750f592edfa88d774d908"><code>d4517c5</code></a> Support ENUM and SET type in DatabaseTypeName() (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1520">#1520</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/2cdf62442f2edb873d1270897d994fc83b78f118"><code>2cdf624</code></a> Fix sql.RawBytes corruption issue (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1523">#1523</a>)</li>
<li><a href="https://github.com/go-sql-driver/mysql/commit/fc589cbaba22032382488393c72b9b3b5366917c"><code>fc589cb</code></a> Add client_ed25519 authentication (<a href="https://redirect.github.com/go-sql-driver/mysql/issues/1518">#1518</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/go-sql-driver/mysql/compare/v1.7.1...v1.8.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/go-sql-driver/mysql&package-manager=go_modules&previous-version=1.7.1&new-version=1.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/connector/oidc/oidc.go b/connector/oidc/oidc.go
index e9486354..c2918006 100644
--- a/connector/oidc/oidc.go
+++ b/connector/oidc/oidc.go
@@ -76,7 +76,7 @@ type Config struct {
 	UserNameKey string `json:"userNameKey"`
 
 	// PromptType will be used fot the prompt parameter (when offline_access, by default prompt=consent)
-	PromptType string `json:"promptType"`
+	PromptType *string `json:"promptType"`
 
 	// OverrideClaimMapping will be used to override the options defined in claimMappings.
 	// i.e. if there are 'email' and `preferred_email` claims available, by default Dex will always use the `email` claim independent of the ClaimMapping.EmailKey.
@@ -242,8 +242,9 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
 	}
 
 	// PromptType should be "consent" by default, if not set
-	if c.PromptType == "" {
-		c.PromptType = "consent"
+	promptType := "consent"
+	if c.PromptType != nil {
+		promptType = *c.PromptType
 	}
 
 	clientID := c.ClientID
@@ -268,7 +269,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
 		allowedGroups:             c.AllowedGroups,
 		acrValues:                 c.AcrValues,
 		getUserInfo:               c.GetUserInfo,
-		promptType:                c.PromptType,
+		promptType:                promptType,
 		userIDKey:                 c.UserIDKey,
 		userNameKey:               c.UserNameKey,
 		overrideClaimMapping:      c.OverrideClaimMapping,
diff --git a/go.mod b/go.mod
index 2ceef014..fc597359 100644
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
 	github.com/ghodss/yaml v1.0.0
 	github.com/go-jose/go-jose/v4 v4.0.1
 	github.com/go-ldap/ldap/v3 v3.4.6
-	github.com/go-sql-driver/mysql v1.7.1
+	github.com/go-sql-driver/mysql v1.8.0
 	github.com/gorilla/handlers v1.5.2
 	github.com/gorilla/mux v1.8.1
 	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
@@ -45,6 +45,7 @@ require (
 	ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 // indirect
 	cloud.google.com/go/compute v1.23.4 // indirect
 	cloud.google.com/go/compute/metadata v0.2.3 // indirect
+	filippo.io/edwards25519 v1.1.0 // indirect
 	github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
 	github.com/Masterminds/goutils v1.1.1 // indirect
 	github.com/Masterminds/semver/v3 v3.2.0 // indirect
diff --git a/go.sum b/go.sum
index 68fdcadd..0ed1dd85 100644
--- a/go.sum
+++ b/go.sum
@@ -7,6 +7,8 @@ cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGB
 cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
 entgo.io/ent v0.13.1 h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=
 entgo.io/ent v0.13.1/go.mod h1:qCEmo+biw3ccBn9OyL4ZK5dfpwg++l1Gxwac5B1206A=
+filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
+filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
 github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM=
 github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY=
 github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
@@ -76,8 +78,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
 github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
 github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
 github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
-github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
-github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
+github.com/go-sql-driver/mysql v1.8.0 h1:UtktXaU2Nb64z/pLiGIxY4431SJ4/dR5cjMmlVHgnT4=
+github.com/go-sql-driver/mysql v1.8.0/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
 github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
 github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=


Test patch:
diff --git a/connector/oidc/oidc_test.go b/connector/oidc/oidc_test.go
index fef2a1a5..e621a55f 100644
--- a/connector/oidc/oidc_test.go
+++ b/connector/oidc/oidc_test.go
@@ -19,6 +19,7 @@ import (
 
 	"github.com/go-jose/go-jose/v4"
 	"github.com/sirupsen/logrus"
+	"github.com/stretchr/testify/require"
 
 	"github.com/dexidp/dex/connector"
 )
@@ -584,6 +585,40 @@ func TestTokenIdentity(t *testing.T) {
 	}
 }
 
+func TestPromptType(t *testing.T) {
+	pointer := func(s string) *string {
+		return &s
+	}
+
+	tests := []struct {
+		name       string
+		promptType *string
+		res        string
+	}{
+		{name: "none", promptType: pointer("none"), res: "none"},
+		{name: "provided empty string", promptType: pointer(""), res: ""},
+		{name: "login", promptType: pointer("login"), res: "login"},
+		{name: "consent", promptType: pointer("consent"), res: "consent"},
+		{name: "default value", promptType: nil, res: "consent"},
+	}
+
+	testServer, err := setupServer(nil, true)
+	require.NoError(t, err)
+
+	for _, tc := range tests {
+		t.Run(tc.name, func(t *testing.T) {
+			conn, err := newConnector(Config{
+				Issuer:     testServer.URL,
+				Scopes:     []string{"openid", "groups"},
+				PromptType: tc.promptType,
+			})
+			require.NoError(t, err)
+
+			require.Equal(t, tc.res, conn.promptType)
+		})
+	}
+}
+
 func TestProviderOverride(t *testing.T) {
 	testServer, err := setupServer(map[string]any{
 		"sub":  "subvalue",