mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-02 11:39:24 +01:00
Update slsaStatusHandler to use the version parsing library
This commit is contained in:
parent
034c317d74
commit
41391fba3a
@ -7,8 +7,6 @@ import (
|
|||||||
"html"
|
"html"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ddworken/hishtory/shared"
|
"github.com/ddworken/hishtory/shared"
|
||||||
@ -273,17 +271,12 @@ func (s *Server) addDeletionRequestHandler(w http.ResponseWriter, r *http.Reques
|
|||||||
func (s *Server) slsaStatusHandler(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) slsaStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// returns "OK" unless there is a current SLSA bug
|
// returns "OK" unless there is a current SLSA bug
|
||||||
v := getHishtoryVersion(r)
|
v := getHishtoryVersion(r)
|
||||||
// TODO: Migrate this to a version parsing library
|
pv, err := shared.ParseVersionString(v)
|
||||||
if !strings.Contains(v, "v0.") {
|
|
||||||
w.Write([]byte("OK"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
vNum, err := strconv.Atoi(strings.Split(v, ".")[1])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.Write([]byte("OK"))
|
w.Write([]byte("OK"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if vNum < 159 {
|
if pv.LessThan(shared.ParsedVersion{MajorVersion: 0, MinorVersion: 159}) {
|
||||||
w.Write([]byte("Sigstore deployed a broken change. See https://github.com/slsa-framework/slsa-github-generator/issues/1163"))
|
w.Write([]byte("Sigstore deployed a broken change. See https://github.com/slsa-framework/slsa-github-generator/issues/1163"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user