Merge commit from fork

* Add DenyLists parsing

* Remove unneeded returned error

* Plug global denylist into Command

* app creation: apply denylist to backchannel logout URI

* Inject denylist to backchannel logout worker

* webhook config: validate against blocked URLs

* Add notificationsWebhook denylist target

* command: Add SMTP endpoint validation against blocklist

* command: Add SMS endpoint validation against blocklist

* Validate webhook endpoint against denylist on channel notification

* Remove unused tests

* handle deprecated denylists

* remove unintended denylist entry in deprecated list

* use single http client

* fix tests

* update comments

* fixes

* cleanup

* address comments

* fix merge

---------

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Marco A.
2026-06-15 15:36:14 +02:00
committed by GitHub
co-authored by Livio Spring
parent d184e976fc
commit 8e82ec1cb9
97 changed files with 1834 additions and 285 deletions
+4 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/base64"
"errors"
"net/http"
"net/url"
"github.com/zitadel/zitadel/internal/crypto"
@@ -34,6 +35,7 @@ type Provider struct {
isAutoCreation bool
isAutoUpdate bool
encryptionAlg crypto.EncryptionAlgorithm
httpClient *http.Client
}
type ProviderOpts func(provider *Provider)
@@ -68,7 +70,7 @@ func WithAutoUpdate() ProviderOpts {
}
// New creates a JWT provider
func New(name, issuer, jwtEndpoint, keysEndpoint, headerName, audience string, encryptionAlg crypto.EncryptionAlgorithm, options ...ProviderOpts) (*Provider, error) {
func New(name, issuer, jwtEndpoint, keysEndpoint, headerName, audience string, encryptionAlg crypto.EncryptionAlgorithm, httpClient *http.Client, options ...ProviderOpts) (*Provider, error) {
provider := &Provider{
name: name,
issuer: issuer,
@@ -77,6 +79,7 @@ func New(name, issuer, jwtEndpoint, keysEndpoint, headerName, audience string, e
headerName: headerName,
audience: audience,
encryptionAlg: encryptionAlg,
httpClient: httpClient,
}
for _, option := range options {
option(provider)
+3
View File
@@ -3,6 +3,7 @@ package jwt
import (
"context"
"errors"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
@@ -114,6 +115,7 @@ func TestProvider_BeginAuth(t *testing.T) {
tt.fields.headerName,
tt.fields.audience,
tt.fields.encryptionAlg(t),
http.DefaultClient,
)
require.NoError(t, err)
@@ -221,6 +223,7 @@ func TestProvider_Options(t *testing.T) {
tt.fields.headerName,
tt.fields.audience,
tt.fields.encryptionAlg(t),
http.DefaultClient,
tt.fields.opts...,
)
require.NoError(t, err)
+1 -1
View File
@@ -87,7 +87,7 @@ func (s *Session) validateToken(ctx context.Context, token string) (*oidc.IDToke
}
logging.Debug("begin signature validation")
keySet := rp.NewRemoteKeySet(http.DefaultClient, s.Provider.keysEndpoint)
keySet := rp.NewRemoteKeySet(s.httpClient, s.keysEndpoint)
if err = oidc.CheckSignature(ctx, token, payload, claims, nil, keySet); err != nil {
return nil, fmt.Errorf("%w: invalid signature: %v", ErrInvalidToken, err)
}
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
"net/http"
"testing"
"time"
@@ -378,6 +379,7 @@ func TestSession_FetchUser(t *testing.T) {
tt.fields.headerName,
tt.fields.audience,
tt.fields.encryptionAlg(t),
http.DefaultClient,
)
require.NoError(t, err)