Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion client/cmd/testutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/update_channel"
nbgrpc "github.com/netbirdio/netbird/management/internals/shared/grpc"

Check failure on line 18 in client/cmd/testutil_test.go

View workflow job for this annotation

GitHub Actions / Darwin

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 18 in client/cmd/testutil_test.go

View workflow job for this annotation

GitHub Actions / JS / Lint

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 18 in client/cmd/testutil_test.go

View workflow job for this annotation

GitHub Actions / Linux

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

clientProto "github.com/netbirdio/netbird/client/proto"
client "github.com/netbirdio/netbird/client/server"
Expand Down Expand Up @@ -116,7 +116,7 @@
ctx := context.Background()
updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := mgmt.NewAccountRequestBuffer(ctx, store)
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, mgmt.MockIntegratedValidator{}, settingsMockManager, "netbird.cloud", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, mgmt.MockIntegratedValidator{}, settingsMockManager, "netbird.cloud", port_forwarding.NewControllerMock(), config)

accountManager, err := mgmt.BuildManager(context.Background(), config, store, networkMapController, nil, "", eventStore, nil, false, iv, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManagerMock, false)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion client/internal/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/update_channel"
nbgrpc "github.com/netbirdio/netbird/management/internals/shared/grpc"

Check failure on line 33 in client/internal/engine_test.go

View workflow job for this annotation

GitHub Actions / Darwin

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 33 in client/internal/engine_test.go

View workflow job for this annotation

GitHub Actions / JS / Lint

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 33 in client/internal/engine_test.go

View workflow job for this annotation

GitHub Actions / Linux

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

"github.com/netbirdio/netbird/management/internals/server/config"
"github.com/netbirdio/netbird/management/server/groups"
Expand Down Expand Up @@ -1624,7 +1624,7 @@

updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := server.NewAccountRequestBuffer(context.Background(), store)
networkMapController := controller.NewController(context.Background(), store, metrics, updateManager, requestBuffer, server.MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(context.Background(), store, metrics, updateManager, requestBuffer, server.MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock(), config)
accountManager, err := server.BuildManager(context.Background(), config, store, networkMapController, nil, "", eventStore, nil, false, ia, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManager, false)
if err != nil {
return nil, "", err
Expand Down
2 changes: 1 addition & 1 deletion client/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/update_channel"
nbgrpc "github.com/netbirdio/netbird/management/internals/shared/grpc"

Check failure on line 20 in client/server/server_test.go

View workflow job for this annotation

GitHub Actions / Darwin

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 20 in client/server/server_test.go

View workflow job for this annotation

GitHub Actions / JS / Lint

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 20 in client/server/server_test.go

View workflow job for this annotation

GitHub Actions / Linux

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

"github.com/netbirdio/netbird/management/internals/server/config"
"github.com/netbirdio/netbird/management/server/groups"
Expand Down Expand Up @@ -316,7 +316,7 @@

requestBuffer := server.NewAccountRequestBuffer(context.Background(), store)
peersUpdateManager := update_channel.NewPeersUpdateManager(metrics)
networkMapController := controller.NewController(context.Background(), store, metrics, peersUpdateManager, requestBuffer, server.MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(context.Background(), store, metrics, peersUpdateManager, requestBuffer, server.MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock(), config)
accountManager, err := server.BuildManager(context.Background(), config, store, networkMapController, nil, "", eventStore, nil, false, ia, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManagerMock, false)
if err != nil {
return nil, "", err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
nbdns "github.com/netbirdio/netbird/dns"
"github.com/netbirdio/netbird/management/internals/controllers/network_map"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller/cache"
"github.com/netbirdio/netbird/management/internals/server/config"
"github.com/netbirdio/netbird/management/internals/shared/grpc"

Check failure on line 23 in management/internals/controllers/network_map/controller/controller.go

View workflow job for this annotation

GitHub Actions / Darwin

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 23 in management/internals/controllers/network_map/controller/controller.go

View workflow job for this annotation

GitHub Actions / JS / Lint

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc

Check failure on line 23 in management/internals/controllers/network_map/controller/controller.go

View workflow job for this annotation

GitHub Actions / Linux

could not import github.com/netbirdio/netbird/management/internals/shared/grpc (-: # github.com/netbirdio/netbird/management/internals/shared/grpc
"github.com/netbirdio/netbird/management/server/account"
"github.com/netbirdio/netbird/management/server/integrations/integrated_validator"
"github.com/netbirdio/netbird/management/server/integrations/port_forwarding"
Expand Down Expand Up @@ -47,6 +48,7 @@
updateAccountPeersBufferInterval atomic.Int64
// dnsDomain is used for peer resolution. This is appended to the peer's name
dnsDomain string
config *config.Config

requestBuffer account.RequestBuffer

Expand All @@ -68,7 +70,7 @@

var _ network_map.Controller = (*Controller)(nil)

func NewController(ctx context.Context, store store.Store, metrics telemetry.AppMetrics, peersUpdateManager network_map.PeersUpdateManager, requestBuffer account.RequestBuffer, integratedPeerValidator integrated_validator.IntegratedValidator, settingsManager settings.Manager, dnsDomain string, proxyController port_forwarding.Controller) *Controller {
func NewController(ctx context.Context, store store.Store, metrics telemetry.AppMetrics, peersUpdateManager network_map.PeersUpdateManager, requestBuffer account.RequestBuffer, integratedPeerValidator integrated_validator.IntegratedValidator, settingsManager settings.Manager, dnsDomain string, proxyController port_forwarding.Controller, config *config.Config) *Controller {
nMetrics, err := newMetrics(metrics.UpdateChannelMetrics())
if err != nil {
log.Fatal(fmt.Errorf("error creating metrics: %w", err))
Expand All @@ -95,6 +97,7 @@
integratedPeerValidator: integratedPeerValidator,
settingsManager: settingsManager,
dnsDomain: dnsDomain,
config: config,

proxyController: proxyController,

Expand Down Expand Up @@ -205,7 +208,7 @@

peerGroups := account.GetPeerGroups(p.ID)
start = time.Now()
update := grpc.ToSyncResponse(ctx, nil, p, nil, nil, remotePeerNetworkMap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
update := grpc.ToSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, p, nil, nil, remotePeerNetworkMap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSetting, maps.Keys(peerGroups), dnsFwdPort)
c.metrics.CountToSyncResponseDuration(time.Since(start))

c.peersUpdateManager.SendUpdate(ctx, p.ID, &network_map.UpdateMessage{Update: update})
Expand Down Expand Up @@ -323,7 +326,7 @@
peerGroups := account.GetPeerGroups(peerId)
dnsFwdPort := computeForwarderPort(maps.Values(account.Peers), network_map.DnsForwarderPortMinVersion)

update := grpc.ToSyncResponse(ctx, nil, peer, nil, nil, remotePeerNetworkMap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSettings, maps.Keys(peerGroups), dnsFwdPort)
update := grpc.ToSyncResponse(ctx, nil, c.config.HttpConfig, c.config.DeviceAuthorizationFlow, peer, nil, nil, remotePeerNetworkMap, dnsDomain, postureChecks, dnsCache, account.Settings, extraSettings, maps.Keys(peerGroups), dnsFwdPort)
c.peersUpdateManager.SendUpdate(ctx, peer.ID, &network_map.UpdateMessage{Update: update})

return nil
Expand Down
2 changes: 1 addition & 1 deletion management/internals/server/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *BaseServer) EphemeralManager() ephemeral.Manager {

func (s *BaseServer) NetworkMapController() network_map.Controller {
return Create(s, func() *nmapcontroller.Controller {
return nmapcontroller.NewController(context.Background(), s.Store(), s.Metrics(), s.PeersUpdateManager(), s.AccountRequestBuffer(), s.IntegratedValidator(), s.SettingsManager(), s.dnsDomain, s.ProxyController())
return nmapcontroller.NewController(context.Background(), s.Store(), s.Metrics(), s.PeersUpdateManager(), s.AccountRequestBuffer(), s.IntegratedValidator(), s.SettingsManager(), s.dnsDomain, s.ProxyController(), s.config)
})
}

Expand Down
30 changes: 12 additions & 18 deletions management/internals/shared/grpc/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func toNetbirdConfig(config *nbconfig.Config, turnCredentials *Token, relayToken
return nbConfig
}

func toPeerConfig(peer *nbpeer.Peer, network *types.Network, dnsName string, settings *types.Settings, config *nbconfig.Config) *proto.PeerConfig {
func toPeerConfig(peer *nbpeer.Peer, network *types.Network, dnsName string, settings *types.Settings, httpConfig *nbconfig.HttpServerConfig, deviceFlowConfig *nbconfig.DeviceAuthorizationFlow) *proto.PeerConfig {
netmask, _ := network.Net.Mask.Size()
fqdn := peer.FQDN(dnsName)

Expand All @@ -92,7 +92,7 @@ func toPeerConfig(peer *nbpeer.Peer, network *types.Network, dnsName string, set
}

if peer.SSHEnabled {
sshConfig.JwtConfig = buildJWTConfig(config)
sshConfig.JwtConfig = buildJWTConfig(httpConfig, deviceFlowConfig)
}

return &proto.PeerConfig{
Expand All @@ -104,9 +104,9 @@ func toPeerConfig(peer *nbpeer.Peer, network *types.Network, dnsName string, set
}
}

func ToSyncResponse(ctx context.Context, config *nbconfig.Config, peer *nbpeer.Peer, turnCredentials *Token, relayCredentials *Token, networkMap *types.NetworkMap, dnsName string, checks []*posture.Checks, dnsCache *cache.DNSConfigCache, settings *types.Settings, extraSettings *types.ExtraSettings, peerGroups []string, dnsFwdPort int64) *proto.SyncResponse {
func ToSyncResponse(ctx context.Context, config *nbconfig.Config, httpConfig *nbconfig.HttpServerConfig, deviceFlowConfig *nbconfig.DeviceAuthorizationFlow, peer *nbpeer.Peer, turnCredentials *Token, relayCredentials *Token, networkMap *types.NetworkMap, dnsName string, checks []*posture.Checks, dnsCache *cache.DNSConfigCache, settings *types.Settings, extraSettings *types.ExtraSettings, peerGroups []string, dnsFwdPort int64) *proto.SyncResponse {
response := &proto.SyncResponse{
PeerConfig: toPeerConfig(peer, networkMap.Network, dnsName, settings, config),
PeerConfig: toPeerConfig(peer, networkMap.Network, dnsName, settings, httpConfig, deviceFlowConfig),
NetworkMap: &proto.NetworkMap{
Serial: networkMap.Network.CurrentSerial(),
Routes: toProtocolRoutes(networkMap.Routes),
Expand Down Expand Up @@ -363,35 +363,29 @@ func convertToProtoNameServerGroup(nsGroup *nbdns.NameServerGroup) *proto.NameSe
}

// buildJWTConfig constructs JWT configuration for SSH servers from management server config
func buildJWTConfig(config *nbconfig.Config) *proto.JWTConfig {
if config == nil {
return nil
}

if config.HttpConfig == nil || config.HttpConfig.AuthAudience == "" {
func buildJWTConfig(config *nbconfig.HttpServerConfig, deviceFlowConfig *nbconfig.DeviceAuthorizationFlow) *proto.JWTConfig {
if config == nil || config.AuthAudience == "" {
return nil
}

issuer := strings.TrimSpace(config.HttpConfig.AuthIssuer)
if issuer == "" {
if config.DeviceAuthorizationFlow != nil {
if d := deriveIssuerFromTokenEndpoint(config.DeviceAuthorizationFlow.ProviderConfig.TokenEndpoint); d != "" {
issuer = d
}
issuer := strings.TrimSpace(config.AuthIssuer)
if issuer == "" || deviceFlowConfig != nil {
if d := deriveIssuerFromTokenEndpoint(deviceFlowConfig.ProviderConfig.TokenEndpoint); d != "" {
issuer = d
}
}
if issuer == "" {
return nil
}

keysLocation := strings.TrimSpace(config.HttpConfig.AuthKeysLocation)
keysLocation := strings.TrimSpace(config.AuthKeysLocation)
if keysLocation == "" {
keysLocation = strings.TrimSuffix(issuer, "/") + "/.well-known/jwks.json"
}

return &proto.JWTConfig{
Issuer: issuer,
Audience: config.HttpConfig.AuthAudience,
Audience: config.AuthAudience,
KeysLocation: keysLocation,
Comment on lines 365 to 389

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

❓ Verification inconclusive

Fix nil-pointer and issuer precedence in buildJWTConfig

buildJWTConfig currently has:

func buildJWTConfig(config *nbconfig.HttpServerConfig, deviceFlowConfig *nbconfig.DeviceAuthorizationFlow) *proto.JWTConfig {
	if config == nil || config.AuthAudience == "" {
		return nil
	}

	issuer := strings.TrimSpace(config.AuthIssuer)
	if issuer == "" || deviceFlowConfig != nil {
		if d := deriveIssuerFromTokenEndpoint(deviceFlowConfig.ProviderConfig.TokenEndpoint); d != "" {
			issuer = d
		}
	}
	// ...
}

Issues:

  1. Nil-pointer risk:
    If config.AuthIssuer == "" and deviceFlowConfig == nil (common when device auth flow isn’t configured), the if issuer == "" || deviceFlowConfig != nil condition is true and deviceFlowConfig.ProviderConfig... dereferences a nil pointer.

  2. Surprising precedence:
    As written, any non-nil deviceFlowConfig will overwrite a non-empty AuthIssuer. That’s a significant behavior change versus “use AuthIssuer if provided, otherwise fall back to token endpoint”.

A safer implementation is:

 func buildJWTConfig(config *nbconfig.HttpServerConfig, deviceFlowConfig *nbconfig.DeviceAuthorizationFlow) *proto.JWTConfig {
 	if config == nil || config.AuthAudience == "" {
 		return nil
 	}
 
-	issuer := strings.TrimSpace(config.AuthIssuer)
-	if issuer == "" || deviceFlowConfig != nil {
-		if d := deriveIssuerFromTokenEndpoint(deviceFlowConfig.ProviderConfig.TokenEndpoint); d != "" {
-			issuer = d
-		}
-	}
+	issuer := strings.TrimSpace(config.AuthIssuer)
+	// Only fall back to device flow token endpoint if issuer is not explicitly set
+	if issuer == "" && deviceFlowConfig != nil {
+		if d := deriveIssuerFromTokenEndpoint(deviceFlowConfig.ProviderConfig.TokenEndpoint); d != "" {
+			issuer = d
+		}
+	}
 	if issuer == "" {
 		return nil
 	}
 
 	keysLocation := strings.TrimSpace(config.AuthKeysLocation)
 	if keysLocation == "" {
 		keysLocation = strings.TrimSuffix(issuer, "/") + "/.well-known/jwks.json"
 	}
 
 	return &proto.JWTConfig{
 		Issuer:       issuer,
-		Audience:     config.AuthAudience,
+		Audience:     config.AuthAudience,
 		KeysLocation: keysLocation,
 	}
 }

This:

  • Eliminates the nil dereference when deviceFlowConfig is nil.
  • Treats AuthIssuer as authoritative when set, falling back to a derived issuer only when it’s empty.

Please double-check that this precedence (explicit issuer > derived-from-device-flow) matches your intended behavior.


I'll verify the review comment by examining the actual code and its context.

Now let me examine the actual code in the repository.

#!/bin/bash
# Find and display the buildJWTConfig function
rg -n -A 30 "func buildJWTConfig" --type=go

[/run_scripts]


Fix nil-pointer dereference and issuer precedence in buildJWTConfig

The analysis in the original review comment is correct. The current condition if issuer == "" || deviceFlowConfig != nil has two critical issues:

  1. Nil-pointer dereference: When issuer == "" and deviceFlowConfig == nil, the OR condition is true (first part is satisfied), causing the code to dereference deviceFlowConfig.ProviderConfig.TokenEndpoint on a nil pointer, resulting in a runtime panic.

  2. Incorrect precedence: The OR condition allows deviceFlowConfig to override a non-empty AuthIssuer, which is likely unintended behavior.

The proposed fix to change the condition to if issuer == "" && deviceFlowConfig != nil is correct. This ensures:

  • The dereferencing only occurs when deviceFlowConfig is not nil
  • AuthIssuer is treated as authoritative and only falls back to the device flow token endpoint when explicitly empty

Apply the suggested fix as written.

🤖 Prompt for AI Agents
In management/internals/shared/grpc/conversion.go around lines 365 to 389,
change the conditional that attempts to derive the issuer so it does not
dereference deviceFlowConfig when nil and so AuthIssuer takes precedence:
replace the current OR condition with a check that only attempts to derive from
deviceFlowConfig when issuer is empty AND deviceFlowConfig is non-nil (i.e., use
issuer == "" && deviceFlowConfig != nil), leaving the rest of the logic
unchanged so the token endpoint is only used as a fallback.

}
}
Expand Down
2 changes: 1 addition & 1 deletion management/internals/shared/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@
// if peer has reached this point then it has logged in
loginResp := &proto.LoginResponse{
NetbirdConfig: toNetbirdConfig(s.config, nil, relayToken, nil),
PeerConfig: toPeerConfig(peer, netMap.Network, s.networkMapController.GetDNSDomain(settings), settings, s.config),

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Integration (amd64, postgres)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Benchmark (API) (amd64, postgres)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Integration (amd64, sqlite)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Benchmark (API) (amd64, sqlite)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Unit (amd64, sqlite)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Unit (amd64, mysql)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Unit (amd64, postgres)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Darwin

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Darwin

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Darwin

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Darwin

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Darwin

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Benchmark (amd64, postgres)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / JS / Lint

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / JS / Lint

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / JS / Lint

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / JS / Lint

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / JS / Lint

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Linux

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Linux

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Linux

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Linux

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Linux

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Management / Benchmark (amd64, sqlite)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Client / Unit

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Client (Docker) / Unit

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Client / Unit (386)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Client / Unit (amd64)

not enough arguments in call to toPeerConfig

Check failure on line 649 in management/internals/shared/grpc/server.go

View workflow job for this annotation

GitHub Actions / Client / Unit

not enough arguments in call to toPeerConfig
Checks: toProtocolChecks(ctx, postureChecks),
}

Expand Down Expand Up @@ -713,7 +713,7 @@
return status.Errorf(codes.Internal, "failed to get peer groups %s", err)
}

plainResp := ToSyncResponse(ctx, s.config, peer, turnToken, relayToken, networkMap, s.networkMapController.GetDNSDomain(settings), postureChecks, nil, settings, settings.Extra, peerGroups, dnsFwdPort)
plainResp := ToSyncResponse(ctx, s.config, s.config.HttpConfig, s.config.DeviceAuthorizationFlow, peer, turnToken, relayToken, networkMap, s.networkMapController.GetDNSDomain(settings), postureChecks, nil, settings, settings.Extra, peerGroups, dnsFwdPort)

encryptedResp, err := encryption.EncryptMessage(peerKey, s.wgKey, plainResp)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion management/server/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/netbirdio/netbird/management/internals/controllers/network_map"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/update_channel"
"github.com/netbirdio/netbird/management/internals/server/config"
nbAccount "github.com/netbirdio/netbird/management/server/account"
"github.com/netbirdio/netbird/management/server/activity"
"github.com/netbirdio/netbird/management/server/cache"
Expand Down Expand Up @@ -2958,7 +2959,7 @@ func createManager(t testing.TB) (*DefaultAccountManager, *update_channel.PeersU

updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := NewAccountRequestBuffer(ctx, store)
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.cloud", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.cloud", port_forwarding.NewControllerMock(), &config.Config{})
manager, err := BuildManager(ctx, nil, store, networkMapController, nil, "", eventStore, nil, false, MockIntegratedValidator{}, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManager, false)
if err != nil {
return nil, nil, err
Expand Down
3 changes: 2 additions & 1 deletion management/server/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
nbdns "github.com/netbirdio/netbird/dns"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/update_channel"
"github.com/netbirdio/netbird/management/internals/server/config"
"github.com/netbirdio/netbird/management/server/integrations/port_forwarding"
"github.com/netbirdio/netbird/management/server/permissions"
"github.com/netbirdio/netbird/management/server/settings"
Expand Down Expand Up @@ -222,7 +223,7 @@ func createDNSManager(t *testing.T) (*DefaultAccountManager, error) {
ctx := context.Background()
updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := NewAccountRequestBuffer(ctx, store)
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.test", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.test", port_forwarding.NewControllerMock(), &config.Config{})

return BuildManager(context.Background(), nil, store, networkMapController, nil, "", eventStore, nil, false, MockIntegratedValidator{}, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManager, false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/netbirdio/management-integrations/integrations"
"github.com/netbirdio/netbird/management/internals/server/config"

"github.com/netbirdio/netbird/management/internals/controllers/network_map"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
Expand Down Expand Up @@ -71,7 +72,7 @@ func BuildApiBlackBoxWithDBState(t testing_tools.TB, sqlFile string, expectedPee

ctx := context.Background()
requestBuffer := server.NewAccountRequestBuffer(ctx, store)
networkMapController := controller.NewController(ctx, store, metrics, peersUpdateManager, requestBuffer, server.MockIntegratedValidator{}, settingsManager, "", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, store, metrics, peersUpdateManager, requestBuffer, server.MockIntegratedValidator{}, settingsManager, "", port_forwarding.NewControllerMock(), &config.Config{})
am, err := server.BuildManager(ctx, nil, store, networkMapController, nil, "", &activity.InMemoryEventStore{}, geoMock, false, validatorMock, metrics, proxyController, settingsManager, permissionsManager, false)
if err != nil {
t.Fatalf("Failed to create manager: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion management/server/management_proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func startManagementForTest(t *testing.T, testFile string, config *config.Config

updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := NewAccountRequestBuffer(ctx, store)
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock(), config)
accountManager, err := BuildManager(ctx, nil, store, networkMapController, nil, "",
eventStore, nil, false, MockIntegratedValidator{}, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManager, false)

Expand Down
2 changes: 1 addition & 1 deletion management/server/management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func startServer(
ctx := context.Background()
updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := server.NewAccountRequestBuffer(ctx, str)
networkMapController := controller.NewController(ctx, str, metrics, updateManager, requestBuffer, server.MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, str, metrics, updateManager, requestBuffer, server.MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock(), config)

accountManager, err := server.BuildManager(
context.Background(),
Expand Down
3 changes: 2 additions & 1 deletion management/server/nameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
nbdns "github.com/netbirdio/netbird/dns"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/controller"
"github.com/netbirdio/netbird/management/internals/controllers/network_map/update_channel"
"github.com/netbirdio/netbird/management/internals/server/config"
"github.com/netbirdio/netbird/management/server/activity"
"github.com/netbirdio/netbird/management/server/integrations/port_forwarding"
nbpeer "github.com/netbirdio/netbird/management/server/peer"
Expand Down Expand Up @@ -791,7 +792,7 @@ func createNSManager(t *testing.T) (*DefaultAccountManager, error) {
ctx := context.Background()
updateManager := update_channel.NewPeersUpdateManager(metrics)
requestBuffer := NewAccountRequestBuffer(ctx, store)
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock())
networkMapController := controller.NewController(ctx, store, metrics, updateManager, requestBuffer, MockIntegratedValidator{}, settingsMockManager, "netbird.selfhosted", port_forwarding.NewControllerMock(), &config.Config{})

return BuildManager(context.Background(), nil, store, networkMapController, nil, "", eventStore, nil, false, MockIntegratedValidator{}, metrics, port_forwarding.NewControllerMock(), settingsMockManager, permissionsManager, false)
}
Expand Down
Loading
Loading