1
0
mirror of synced 2026-10-24 12:59:18 +03:00
Files
step-ca/examples/bootstrap-client/client.go
Max 01c87964d7 fix(lint): resolve golangci-lint errors from updated gosec rules (#2590)
Remove 47 stale //nolint:gosec directives that are no longer needed
after gosec rule changes (nolintlint flagged them as unused). Add
//nolint:gosec annotations for 5 new findings: G117 on config struct
marshaling (password fields by design), G115 on intentional uint->byte
truncation in SCEP OID encoding, and G704 SSRF taint on the
user-configured CA HTTP client.

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-10 20:39:58 -07:00

45 lines
704 B
Go

package main
import (
"context"
"fmt"
"io"
"os"
"time"
"github.com/smallstep/certificates/ca"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintf(os.Stderr, "Usage: %s <token>\n", os.Args[0])
os.Exit(1)
}
token := os.Args[1]
// make sure to cancel the renew goroutine
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
client, err := ca.BootstrapClient(ctx, token)
if err != nil {
panic(err)
}
for {
resp, err := client.Get("https://localhost:8443")
if err != nil {
panic(err)
}
b, err := io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
panic(err)
}
fmt.Printf("Server responded: %s\n", b)
time.Sleep(1 * time.Second)
}
}