mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-16 02:35:12 +00:00
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:
@@ -211,3 +211,35 @@ FirstInstance:
|
||||
|
||||
Log:
|
||||
Level: info
|
||||
|
||||
HTTPClient:
|
||||
# Sets the limit of the response body size in bytes, which will be processed by the HTTP client.
|
||||
# If the response body exceeds this limit, the client will return an error.
|
||||
# The default value is 20MB.
|
||||
MaxBodySize: 20971520 # ZITADEL_HTTPCLIENT_MAXBODYSIZE
|
||||
# Sets the timeout for the HTTP client.
|
||||
Timeout: 30s # ZITADEL_HTTPCLIENT_TIMEOUT
|
||||
# Sets the number of allowed redirects for the HTTP client.
|
||||
MaxRedirects: 5 # ZITADEL_HTTPCLIENT_MAXREDIRECTS
|
||||
# Specifies if the HTTP client should follow redirects from HTTPS to HTTP.
|
||||
AllowHTTPSDowngrade: false # ZITADEL_HTTPCLIENT_ALLOWHTTPSDOWNGRADE
|
||||
# Specifies the list of IP addresses or CIDR ranges that are not allowed to be called by the HTTP client.
|
||||
# Note that hosts / domains are matched best-case and wildcards are not supported.
|
||||
# CRITICAL SECURITY NOTE: Domain rules (like "localhost") protect application-layer string matches.
|
||||
# Underneath, the network dialer relies exclusively on the CIDR ranges below to block resolved IPs and prevent DNS Rebinding.
|
||||
# Do not remove the CIDR subnets even if a domain mapping exists.
|
||||
DenyList: # ZITADEL_HTTPCLIENT_DENYLIST (comma separated list)
|
||||
- localhost
|
||||
- "0.0.0.0/8" # Unspecified IPv4 address range / Local network routing trick protection
|
||||
- "10.0.0.0/8" # Class A private networks
|
||||
- "100.64.0.0/10" # Carrier-Grade NAT space
|
||||
- "127.0.0.0/8" # Loopback addresses (IPv4)
|
||||
- "169.254.0.0/16" # Link-local subnets (Covers Cloud Metadata Endpoints like AWS/GCP 169.254.169.254)
|
||||
- "172.16.0.0/12" # Class B private networks
|
||||
- "192.168.0.0/16" # Class C private networks
|
||||
- "198.18.0.0/15" # Benchmark/inter-network communication testing
|
||||
- "::/128" # Unspecified IPv6 address
|
||||
- "::1/128" # IPv6 loopback address
|
||||
- "::ffff:0:0/96" # IPv4-mapped IPv6 addresses (Prevents IPv6 encapsulation bypasses)
|
||||
- "fc00::/7" # Unique local addresses / IPv6 equivalent to private IPv4 subnets
|
||||
- "fe80::/10" # Link-local addresses / IPv6 equivalent to cloud metadata subnets
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -22,6 +21,7 @@ import (
|
||||
admin_handler "github.com/zitadel/zitadel/internal/admin/repository/eventsourcing/handler"
|
||||
admin_view "github.com/zitadel/zitadel/internal/admin/repository/eventsourcing/view"
|
||||
internal_authz "github.com/zitadel/zitadel/internal/api/authz"
|
||||
"github.com/zitadel/zitadel/internal/api/http"
|
||||
"github.com/zitadel/zitadel/internal/api/oidc"
|
||||
"github.com/zitadel/zitadel/internal/api/ui/login"
|
||||
auth_es "github.com/zitadel/zitadel/internal/auth/repository/eventsourcing"
|
||||
@@ -34,7 +34,6 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/config/systemdefaults"
|
||||
crypto_db "github.com/zitadel/zitadel/internal/crypto/database"
|
||||
"github.com/zitadel/zitadel/internal/database"
|
||||
"github.com/zitadel/zitadel/internal/denylist"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
old_es "github.com/zitadel/zitadel/internal/eventstore/repository/sql"
|
||||
@@ -109,6 +108,7 @@ type ProjectionsConfig struct {
|
||||
WebAuthNName string
|
||||
DefaultInstance command.InstanceSetup
|
||||
AssetStorage static_config.AssetStorageConfig
|
||||
HTTPClient http.ClientConfig
|
||||
}
|
||||
|
||||
func migrateProjectionsFlags(cmd *cobra.Command) {
|
||||
@@ -187,6 +187,9 @@ func projections(
|
||||
DisplayName: config.WebAuthNName,
|
||||
ExternalSecure: config.ExternalSecure,
|
||||
}
|
||||
|
||||
httpClient := config.HTTPClient.NewClient()
|
||||
|
||||
commands, err := command.StartCommands(ctx,
|
||||
es,
|
||||
cacheConnectors,
|
||||
@@ -206,7 +209,7 @@ func projections(
|
||||
keys.SAML,
|
||||
keys.Target,
|
||||
keys.OIDC,
|
||||
&http.Client{},
|
||||
httpClient,
|
||||
func(ctx context.Context, permission, orgID, resourceID string) (err error) {
|
||||
return internal_authz.CheckPermission(ctx, authZRepo, config.SystemAuthZ.RolePermissionMappings, config.InternalAuthZ.RolePermissionMappings, permission, orgID, resourceID)
|
||||
},
|
||||
@@ -216,7 +219,7 @@ func projections(
|
||||
config.OIDC.DefaultRefreshTokenIdleExpiration,
|
||||
config.DefaultInstance.SecretGenerators,
|
||||
config.Login.DefaultPaths,
|
||||
[]denylist.AddressChecker{},
|
||||
config.HTTPClient.DenyList,
|
||||
)
|
||||
logging.OnError(ctx, err).Fatal("unable to start commands")
|
||||
|
||||
@@ -246,6 +249,7 @@ func projections(
|
||||
keys.SMTP,
|
||||
keys.SMS,
|
||||
nil,
|
||||
httpClient,
|
||||
)
|
||||
|
||||
config.Auth.Spooler.Client = client
|
||||
|
||||
Reference in New Issue
Block a user