package main import ( "encoding/json" "fmt" "log" "net/http" "os" "runtime/debug" jwt "github.com/golang-jwt/jwt/v5" ) func signingKey() []byte { if k := os.Getenv("JWT_KEY"); k != "" { return []byte(k) } return []byte("demo-only-not-for-real-use") } type versionInfo struct { Service string `json:"service"` Commit string `json:"commit"` GoVersion string `json:"go_version"` Deps map[string]string `json:"deps"` JWTLibrary string `json:"jwt_library"` } func main() { mux := http.NewServeMux() mux.HandleFunc("/", index) mux.HandleFunc("/version", version) mux.HandleFunc("/healthz", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) fmt.Fprintln(w, "ok") }) mux.HandleFunc("/verify", verifyToken) port := os.Getenv("PORT") if port == "" { port = "8080" } log.Printf("demo-secure listening on :%s", port) if err := http.ListenAndServe(":"+port, mux); err != nil { log.Fatal(err) } } func index(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") jwtLib := "unknown" if bi, ok := debug.ReadBuildInfo(); ok { for _, d := range bi.Deps { if d.Path == "github.com/dgrijalva/jwt-go" || d.Path == "github.com/golang-jwt/jwt/v5" { jwtLib = d.Path + "@" + d.Version break } } } vulnerable := jwtLib == "github.com/dgrijalva/jwt-go@v3.2.0+incompatible" pillClass := "pill-good" pillText := "patched" if vulnerable { pillClass = "pill-bad" pillText = "vulnerable" } fmt.Fprintf(w, `
A minimal HTTP service threaded through the Red Hat Advanced Developer Suite: RHDH golden-path scaffolding → Tekton build → RHTAS keyless signing → RHTPA SBOM scanning.
Active JWT library: %s
Build info plus the full dependency tree. Proves at runtime which jwt-go version is shipped.
Liveness probe endpoint. Returns 200 OK while the process is up.
Send Authorization: Bearer <jwt> to exercise the JWT library — this is the call path RHTPA sees as in-use.