From 50f5ea43bec4aac69ce705fd7c6b6d60152ee327 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 23:24:39 +0000 Subject: [PATCH 1/3] Bump github.com/seancfoley/ipaddress-go from 1.7.0 to 1.7.1 Bumps [github.com/seancfoley/ipaddress-go](https://github.com/seancfoley/ipaddress-go) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/seancfoley/ipaddress-go/releases) - [Commits](https://github.com/seancfoley/ipaddress-go/compare/v1.7.0...v1.7.1) --- updated-dependencies: - dependency-name: github.com/seancfoley/ipaddress-go dependency-version: 1.7.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3e9b2f89..be0c0565 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/lib/pq v1.10.9 github.com/mattn/go-sqlite3 v1.14.28 github.com/rqlite/gorqlite v0.0.0-20240122221808-a8a425b1a6aa - github.com/seancfoley/ipaddress-go v1.7.0 + github.com/seancfoley/ipaddress-go v1.7.1 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/stretchr/testify v1.10.0 github.com/txn2/txeh v1.5.5 diff --git a/go.sum b/go.sum index ce7d291b..31a86223 100644 --- a/go.sum +++ b/go.sum @@ -122,8 +122,8 @@ github.com/rqlite/gorqlite v0.0.0-20240122221808-a8a425b1a6aa/go.mod h1:xF/KoXmr github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/seancfoley/bintree v1.3.1 h1:cqmmQK7Jm4aw8gna0bP+huu5leVOgHGSJBEpUx3EXGI= github.com/seancfoley/bintree v1.3.1/go.mod h1:hIUabL8OFYyFVTQ6azeajbopogQc2l5C/hiXMcemWNU= -github.com/seancfoley/ipaddress-go v1.7.0 h1:vWp3SR3k+HkV3aKiNO2vEe6xbVxS0x/Ixw6hgyP238s= -github.com/seancfoley/ipaddress-go v1.7.0/go.mod h1:TQRZgv+9jdvzHmKoPGBMxyiaVmoI0rYpfEk8Q/sL/Iw= +github.com/seancfoley/ipaddress-go v1.7.1 h1:fDWryS+L8iaaH5RxIKbY0xB5Z+Zxk8xoXLN4S4eAPdQ= +github.com/seancfoley/ipaddress-go v1.7.1/go.mod h1:TQRZgv+9jdvzHmKoPGBMxyiaVmoI0rYpfEk8Q/sL/Iw= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= From 1c20cf36825ab368b6748ff3fd1f422bd2682a20 Mon Sep 17 00:00:00 2001 From: Vishal Dalwadi Date: Thu, 19 Jun 2025 21:53:52 +0530 Subject: [PATCH 2/3] fix(go): mask only if set; --- controllers/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/server.go b/controllers/server.go index 675a9910..916a4256 100644 --- a/controllers/server.go +++ b/controllers/server.go @@ -247,7 +247,10 @@ func getConfig(w http.ResponseWriter, r *http.Request) { // @Success 200 {object} config.ServerSettings func getSettings(w http.ResponseWriter, r *http.Request) { scfg := logic.GetServerSettings() - scfg.ClientSecret = logic.Mask() + if scfg.ClientSecret != "" { + scfg.ClientSecret = logic.Mask() + } + logic.ReturnSuccessResponseWithJson(w, r, scfg, "fetched server settings successfully") } From e606401066bc4e00903c049b318b56091af163bc Mon Sep 17 00:00:00 2001 From: abhishek9686 Date: Mon, 23 Jun 2025 21:31:29 +0530 Subject: [PATCH 3/3] create default user policy on CE --- logic/user_mgmt.go | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/logic/user_mgmt.go b/logic/user_mgmt.go index 0e58374e..d2c5282a 100644 --- a/logic/user_mgmt.go +++ b/logic/user_mgmt.go @@ -2,6 +2,8 @@ package logic import ( "encoding/json" + "fmt" + "time" "github.com/gravitl/netmaker/database" "github.com/gravitl/netmaker/models" @@ -60,7 +62,39 @@ var InitialiseRoles = userRolesInit var IntialiseGroups = func() {} var DeleteNetworkRoles = func(netID string) {} var CreateDefaultNetworkRolesAndGroups = func(netID models.NetworkID) {} -var CreateDefaultUserPolicies = func(netID models.NetworkID) {} +var CreateDefaultUserPolicies = func(netID models.NetworkID) { + if netID.String() == "" { + return + } + if !IsAclExists(fmt.Sprintf("%s.%s", netID, "all-users")) { + defaultUserAcl := models.Acl{ + ID: fmt.Sprintf("%s.%s", netID, "all-users"), + Default: true, + Name: "All Users", + MetaData: "This policy gives access to everything in the network for an user", + NetworkID: netID, + Proto: models.ALL, + ServiceType: models.Any, + Port: []string{}, + RuleType: models.UserPolicy, + Src: []models.AclPolicyTag{ + { + ID: models.UserAclID, + Value: "*", + }, + }, + Dst: []models.AclPolicyTag{{ + ID: models.NodeTagID, + Value: "*", + }}, + AllowedDirection: models.TrafficDirectionUni, + Enabled: true, + CreatedBy: "auto", + CreatedAt: time.Now().UTC(), + } + InsertAcl(defaultUserAcl) + } +} var GetUserGroupsInNetwork = func(netID models.NetworkID) (networkGrps map[models.UserGroupID]models.UserGroup) { return } var GetUserGroup = func(groupId models.UserGroupID) (userGrps models.UserGroup, err error) { return } var AddGlobalNetRolesToAdmins = func(u *models.User) {}