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

Update to go 1.23 #3311

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions auth/client/iam/openid4vp.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/nuts-foundation/nuts-node/vcr/credential"
"github.com/nuts-foundation/nuts-node/vdr/didsubject"
"github.com/piprate/json-gold/ld"
"golang.org/x/exp/maps"
"maps"
"net/http"
"net/url"
"slices"
Expand Down Expand Up @@ -278,7 +278,11 @@ func (c *OpenID4VPClient) RequestRFC021AccessToken(ctx context.Context, clientID
subjectDIDs = subjectDIDs[:j]

if len(subjectDIDs) == 0 {
return nil, fmt.Errorf("did method mismatch, requested: %v, available: %v", metadata.DIDMethodsSupported, maps.Keys(allMethods))
availableMethods := make([]string, 0, len(allMethods))
for key := range maps.Keys(allMethods) {
availableMethods = append(availableMethods, key)
}
return nil, fmt.Errorf("did method mismatch, requested: %v, available: %v", metadata.DIDMethodsSupported, availableMethods)
}

// each additional credential can be used by each DID
Expand Down
23 changes: 23 additions & 0 deletions e2e-tests/oauth-flow/rfc021/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
This test can be executed against multiple SQL databases.
It's executed (by running `./run-test.sh`) on all supported databases (postgres, sqlite, mysql, sqlserver) by default.
To perform the test on a specific database, run `./do-test.sh <database>` where `<database>` is one of the supported databases (postgres, sqlite, mysql, sqlserver).

### sqlserver
By default, the container generates a new certificate at startup.
Currently, this generated certificate may contain a negative serial number which is against the RFC.
Since GO 1.23, the negative serials numbers no longer pass validation. This can be disabled using `GODEBUG=x509negativeserial=1`. (In go 1.23 the default flag changed from 1 to 0.)
As a workaround we mount our own certificate. https://github.com/microsoft/mssql-docker/issues/895

Add the following config to the `sqlserver.yml`
```yaml
services:
db:
volumes:
- "./sqlserver.conf:/var/opt/mssql/mssql.conf"
- "./sqlserver.key:/etc/ssl/mssql.key:ro" # technically this should be mounted under /etc/ssl/private, but that results in permission issues
- "./sqlserver.pem:/etc/ssl/certs/mssql.pem:ro"
```

### certificate renewal
First check the latest version if this (and other issues) have been fixed
If not, regen certificates using
```bash
openssl req -x509 -nodes -newkey rsa:2048 -subj '/CN=mssql' -addext "subjectAltName = DNS:mssql" -keyout sqlserver.key -out sqlserver.pem -days 365
```
5 changes: 5 additions & 0 deletions e2e-tests/oauth-flow/rfc021/sqlserver.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[network]
tlscert = /etc/ssl/certs/mssql.pem
tlskey = /etc/ssl/mssql.key
tlsprotocols = 1.2
forceencryption = 1
28 changes: 28 additions & 0 deletions e2e-tests/oauth-flow/rfc021/sqlserver.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDcxUCdwcDdSXeA
TXQDJQvaBBX01H6rqh7TlZjnVGoUsZFBp39ucLJqJLZWnkJfeWXaxVTAvqnkCEu2
z8gKIBkmJTqdQa079Xio910/w++KfFKJ7BKB4d8b6PblyvaKd25mw0INngJO2Yvb
BJmpo6oV4q2/zYS2KdWA61Yq9qC0qSV2QYKo5DBvdgwn/zUggW6wd/Qn96RyiPKi
yLbeuainzR5q6jzUV+gkTOcNJmhYBmkX2zNe+c/OQzZPf4nx+8QVlel6UuH16oEd
KxmutFWeReQtxbFduCGE64Ld+jXDp3B5am2jZzP0X4VoeUYIvnxgwgxTF3vkEHRC
eWxHADQdAgMBAAECggEALknZY3pVYtBdkvQqZ+JjmsGSjPPk3z9bGUfbeF1VpKMa
bqac7F4KuoCaDo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PDW2HbMsaQ9P5ziCvsmWUlpwbekYIamvYT33rplHfXfj6QagwkZqzleLTZ/
KiXnd1p/dUPocO6Fmnn7yFg=
-----END PRIVATE KEY-----
19 changes: 19 additions & 0 deletions e2e-tests/oauth-flow/rfc021/sqlserver.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDEzCCAfugAwIBAgIUCDOJnObAY/b4IfVy1mn6uKNozYwwDQYJKoZIhvcNAQEL
BQAwEDEOMAwGA1UEAwwFbXNzcWwwHhcNMjQwOTE3MDgwMjQxWhcNMjUwOTE3MDgw
MjQxWjAQMQ4wDAYDVQQDDAVtc3NxbDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBANzFQJ3BwN1Jd4BNdAMlC9oEFfTUfquqHtOVmOdUahSxkUGnf25wsmok
tlaeQl95ZdrFVMC+qeQIS7bPyAogGSYlOp1BrTv1eKj3XT/D74p8UonsEoHh3xvo
9uXK9op3bmbDQg2eAk7Zi9sEmamjqhXirb/NhLYp1YDrVir2oLSpJXZBgqjkMG92
DCf/NSCBbrB39Cf3pHKI8qLItt65qKfNHmrqPNRX6CRM5w0maFgGaRfbM175z85D
Nk9/ifH7xBWV6XpS4fXqgR0rGa60VZ5F5C3FsV24IYTrgt36NcOncHlqbaNnM/Rf
hWh5Rgi+fGDCDFMXe+QQdEJ5bEcANB0CAwEAAaNlMGMwHQYDVR0OBBYEFM5MAIuM
gB+Y3+n5+E6KNCydTiteMB8GA1UdIwQYMBaAFM5MAIuMgB+Y3+n5+E6KNCydTite
MA8GA1UdEwEB/wQFMAMBAf8wEAYDVR0RBAkwB4IFbXNzcWwwDQYJKoZIhvcNAQEL
BQADggEBACc6Le8yXeBZKPBL50D7zKZtbyLJ17tHUt8Z3I6XqMPyJ+HLUjeH9xqw
+JlmDRF0h24ZQVKhP7zc67CmNRyZoYmFLjWy9w+LGaWVsr2EMG2n4n7Ubojv+lAI
OrZ+dh3jTl9OiIOxJg/5bTd/OJ5J0ac+Uy8HvoQmryliol1yicFlN1hDHQzaTfBB
+p7hBsxZRTG6zssbNNjrCO/ocAy+axX/1dp830FUCNemJ0IJOLoVdm/UX/YN/Lws
wr/jzO9K504BIbahrggHNnCRJLr+zhM0rzJxorAUk4JN1rjW/ycYreAyOZpiV/QR
WLPBukk7keWM7KQyzYyxOlbYmo8BYm4=
-----END CERTIFICATE-----
6 changes: 5 additions & 1 deletion e2e-tests/oauth-flow/rfc021/sqlserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
NUTS_STORAGE_SQL_CONNECTION: sqlserver://sa:MyStrong(!)Password@db:1433?database=node_b
db:
# image: mcr.microsoft.com/azure-sql-edge:latest <-- "The sqlcmd utility is not included in the ARM64 version of the SQL Edge container" - https://github.com/microsoft/mssql-docker/issues/734
# image mcr.microsoft.com/mssql/server:2022-latest <-- They broke the sqlcmd path - https://github.com/microsoft/mssql-docker/issues/892
# image: mcr.microsoft.com/mssql/server:2022-latest # <-- They broke the sqlcmd path - https://github.com/microsoft/mssql-docker/issues/892
image: mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04
restart: always
ports:
Expand All @@ -22,6 +22,10 @@ services:
MSSQL_USER: SA
MSSQL_SA_PASSWORD: MyStrong(!)Password
ACCEPT_EULA: Y
volumes:
- "./sqlserver.conf:/var/opt/mssql/mssql.conf"
- "./sqlserver.key:/etc/ssl/mssql.key:ro"
- "./sqlserver.pem:/etc/ssl/certs/mssql.pem:ro"
healthcheck:
test:
["CMD", "/opt/mssql-tools/bin/sqlcmd", "-U", "sa", "-P", "MyStrong(!)Password", "-Q", "SELECT 1"]
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nuts-foundation/nuts-node

go 1.22
go 1.23

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0
Expand Down Expand Up @@ -199,5 +199,3 @@ require (
modernc.org/sqlite v1.32.0 // indirect
rsc.io/qr v0.2.0 // indirect
)

require golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8
Loading