From ebb13ac611b14b972389c5a36eba8483b6e96e2f Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 28 Nov 2022 11:18:56 -0500 Subject: [PATCH 1/2] simply token generation; createToken+createServiceName (#114) --- .gitignore | 1 + controller/util.go | 17 +++-------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 115a11f63..d65055612 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .idea *.db automated-release-build +etc/dev.yml diff --git a/controller/util.go b/controller/util.go index b42baeb09..877237a18 100644 --- a/controller/util.go +++ b/controller/util.go @@ -9,7 +9,6 @@ import ( "github.com/openziti-test-kitchen/zrok/rest_model_zrok" "github.com/openziti/edge/rest_management_api_client" "github.com/openziti/edge/rest_util" - "github.com/teris-io/shortid" "net/http" "strings" ) @@ -44,10 +43,6 @@ func edgeClient() (*rest_management_api_client.ZitiEdgeManagement, error) { return rest_util.NewEdgeManagementClientWithUpdb(cfg.Ziti.Username, cfg.Ziti.Password, cfg.Ziti.ApiEndpoint, caPool) } -func createToken() (string, error) { - return shortid.Generate() -} - func createServiceName() (string, error) { gen, err := nanoid.CustomASCII("abcdefghijklmnopqrstuvwxyz0123456789", 12) if err != nil { @@ -56,18 +51,12 @@ func createServiceName() (string, error) { return gen(), nil } -func dnsSafeShortId() (string, error) { - sid, err := shortid.Generate() +func createToken() (string, error) { + gen, err := nanoid.CustomASCII("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 12) if err != nil { return "", err } - for sid[0] == '-' || sid[0] == '_' { - sid, err = shortid.Generate() - if err != nil { - return "", err - } - } - return sid, nil + return gen(), nil } func hashPassword(raw string) string { From 37ac11850c9cc4ad6cf694668eb0ac5383142221 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 28 Nov 2022 11:22:06 -0500 Subject: [PATCH 2/2] CHANGELOG --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b2a83f19..b41da78fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -# v0.2.18 (WiP) +# v0.2.18 -* First official release in the `v0.2.x` series. +* DEFECT: Token generation has been improved to use an alphabet consisting of `[a-zA-Z0-9]`. Service token generation continues to use a case-insensitive alphabet consisting of `[a-z0-9]` to be DNS-safe.