Skip to content

(misc) Update dependencies and go #2264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
test:
strategy:
matrix:
go: ["1.24"]
go: ["1.25"]

runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
test:
strategy:
matrix:
go: ["1.23.9", "1.24"] # using 1.23.9 temporarily because of some github actions cache issue
go: ["1.24", "1.25"]

runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 20 additions & 1 deletion choria/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,26 @@ func (fw *Framework) PQLQueryCertNames(query string) ([]string, error) {

// Colorize returns a string of either 'red', 'green' or 'yellow'. If the 'color' configuration
// is set to false then the string will have no color hints
func (fw *Framework) Colorize(c string, format string, a ...any) string {
func (fw *Framework) Colorize(c string, s string) string {
if !fw.Config.Color {
return fmt.Sprint(s)
}

switch c {
case "red":
return color.RedString(s)
case "green":
return color.GreenString(s)
case "yellow":
return color.YellowString(s)
default:
return s
}
}

// Colorizef returns a string of either 'red', 'green' or 'yellow'. If the 'color' configuration
// is set to false then the string will have no color hints
func (fw *Framework) Colorizef(c string, format string, a ...any) string {
if !fw.Config.Color {
return fmt.Sprintf(format, a...)
}
Expand Down
8 changes: 6 additions & 2 deletions client/aaa_signerclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package aaa_signerclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
8 changes: 6 additions & 2 deletions client/choria_provisionclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package choria_provisionclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
8 changes: 6 additions & 2 deletions client/choria_registryclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package choria_registryclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
8 changes: 6 additions & 2 deletions client/choria_utilclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package choria_utilclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
8 changes: 6 additions & 2 deletions client/executorclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package executorclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
8 changes: 6 additions & 2 deletions client/rpcutilclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package rpcutilclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
8 changes: 6 additions & 2 deletions client/scoutclient/requester.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2025, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0

// generated code; DO NOT EDIT

package scoutclient
Expand Down Expand Up @@ -133,10 +137,10 @@ func (r *requester) configureProgress(count int) {

r.progress.PrependFunc(func(b *uiprogress.Bar) string {
if b.Current() < count {
return r.client.fw.Colorize("red", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("red", "%d / %d", b.Current(), count)
}

return r.client.fw.Colorize("green", "%d / %d", b.Current(), count)
return r.client.fw.Colorizef("green", "%d / %d", b.Current(), count)
})

uiprogress.Start()
Expand Down
52 changes: 26 additions & 26 deletions cmd/jwt_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (c *jwtCheckCommand) Run(wg *sync.WaitGroup) (err error) {

func (c *jwtCheckCommand) check(result *monitor.Result) {
if c.file == "" {
result.Critical("token file is required")
result.Criticalf("token file is required")
return
}

Expand All @@ -114,7 +114,7 @@ func (c *jwtCheckCommand) check(result *monitor.Result) {
}

token, err := os.ReadFile(c.file)
if result.CriticalIfErr(err, "token cannot be read: %v", err) {
if result.CriticalIfErrf(err, "token cannot be read: %v", err) {
return
}

Expand All @@ -138,7 +138,7 @@ func (c *jwtCheckCommand) check(result *monitor.Result) {
case tokens.ProvisioningPurpose:
c.checkProvToken(string(token), issuer, result)
case tokens.UnknownPurpose:
result.Critical("unknown token purpose")
result.Criticalf("unknown token purpose")
}
}

Expand All @@ -151,39 +151,39 @@ func (c *jwtCheckCommand) checkClientToken(token string, issuer ed25519.PublicKe
} else {
jwt, err = tokens.ParseClientIDToken(token, issuer, false)
}
if result.CriticalIfErr(err, "%s", err) {
if result.CriticalIfErrf(err, "%s", err) {
return
}

if c.identity != "" && jwt.CallerID != c.identity {
result.Critical("identity %s", jwt.CallerID)
result.Criticalf("identity %s", jwt.CallerID)
}

if jwt.PublicKey == "" {
result.Critical("no public key")
result.Criticalf("no public key")
}

if c.chainIssuerSet {
isIssuer := jwt.IsChainedIssuer(true)

if isIssuer != c.chainIssuer {
result.Critical("chain issuer: %t", isIssuer)
result.Criticalf("chain issuer: %t", isIssuer)
}
}

if c.opa && jwt.OPAPolicy == "" {
result.Critical("no OPA policy")
result.Criticalf("no OPA policy")
}

for _, sub := range c.sub {
if !iu.StringInList(jwt.AdditionalSubscribeSubjects, sub) {
result.Critical("subscribe %v", sub)
result.Criticalf("subscribe %v", sub)
}
}

for _, pub := range c.pub {
if !iu.StringInList(jwt.AdditionalPublishSubjects, pub) {
result.Critical("subscribe %v", pub)
result.Criticalf("subscribe %v", pub)
}
}

Expand All @@ -202,21 +202,21 @@ func (c *jwtCheckCommand) checkServerToken(token string, issuer ed25519.PublicKe
} else {
jwt, err = tokens.ParseServerToken(token, issuer)
}
if result.CriticalIfErr(err, "%s", err) {
if result.CriticalIfErrf(err, "%s", err) {
return
}

if c.identity != "" && jwt.ChoriaIdentity != c.identity {
result.Critical("identity %s", jwt.ChoriaIdentity)
result.Criticalf("identity %s", jwt.ChoriaIdentity)
}

if jwt.PublicKey == "" {
result.Critical("no public key")
result.Criticalf("no public key")
}

for _, pub := range c.pub {
if !iu.StringInList(jwt.AdditionalPublishSubjects, pub) {
result.Critical("publish %v", pub)
result.Criticalf("publish %v", pub)
}
}

Expand All @@ -234,7 +234,7 @@ func (c *jwtCheckCommand) checkProvToken(token string, issuer ed25519.PublicKey,
} else {
jwt, err = tokens.ParseProvisioningToken(token, issuer)
}
if result.CriticalIfErr(err, "%s", err) {
if result.CriticalIfErrf(err, "%s", err) {
return
}

Expand All @@ -247,40 +247,40 @@ func (c *jwtCheckCommand) commonChecks(claims tokens.StandardClaims, result *mon
c.checkValidity(claims, result)

if claims.ID == "" {
result.Critical("no id")
result.Criticalf("no id")
}
if claims.ExpireTime().IsZero() {
result.Critical("no expiry")
result.Criticalf("no expiry")
}
if claims.NotBefore == nil || claims.NotBefore.IsZero() {
result.Critical("no not before")
result.Criticalf("no not before")
}
}

func (c *jwtCheckCommand) checkValidity(claims tokens.StandardClaims, result *monitor.Result) {
exp := claims.ExpireTime()
untilExp := time.Until(exp)
if exp.IsZero() {
result.Critical("no expires time")
result.Criticalf("no expires time")
return
}

result.Pd(&monitor.PerfDataItem{Name: "expires", Value: untilExp.Seconds(), Unit: "s", Help: "Seconds until expiry"})

if claims.IsExpired() {
result.Critical("expired")
result.Criticalf("expired")
return
}

if c.validityMin > 0 {
if untilExp < c.validityMin {
result.Critical("expires in %v", iu.RenderDuration(untilExp))
result.Criticalf("expires in %v", iu.RenderDuration(untilExp))
}
}

if c.validityMax > 0 {
if untilExp > c.validityMax {
result.Critical("expires in %v", iu.RenderDuration(untilExp))
result.Criticalf("expires in %v", iu.RenderDuration(untilExp))
}
}
}
Expand All @@ -297,7 +297,7 @@ func (c *jwtCheckCommand) checkPurpose(purpose tokens.Purpose, result *monitor.R
should = tokens.ProvisioningPurpose
}
if purpose != should {
result.Critical("%s purpose", purpose)
result.Criticalf("%s purpose", purpose)
}
}
}
Expand All @@ -311,18 +311,18 @@ func (c *jwtCheckCommand) checkQueries(token any, result *monitor.Result) {
json.Unmarshal(dat, &claims)

prog, err := expr.Compile(query, expr.AsBool())
if result.CriticalIfErr(err, "invalid query: %s: %v", query, err) {
if result.CriticalIfErrf(err, "invalid query: %s: %v", query, err) {
return
}

res, err := expr.Run(prog, claims)
if result.CriticalIfErr(err, "invalid query: %s: %v", query, err) {
if result.CriticalIfErrf(err, "invalid query: %s: %v", query, err) {
return
}

b, ok := res.(bool)
if !ok {
result.Critical("query not boolean")
result.Criticalf("query not boolean")
return
}

Expand Down
Loading
Loading