mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
Make json parsing more strict
This commit is contained in:
parent
c833c00f84
commit
fc3837d655
13 changed files with 68 additions and 36 deletions
|
|
@ -13,7 +13,6 @@ import (
|
|||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
|
|
@ -31,6 +30,7 @@ import (
|
|||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
|
||||
"github.com/gocsaf/csaf/v3/csaf"
|
||||
"github.com/gocsaf/csaf/v3/internal/misc"
|
||||
"github.com/gocsaf/csaf/v3/util"
|
||||
)
|
||||
|
||||
|
|
@ -538,7 +538,7 @@ func (w *worker) mirrorFiles(tlpLabel csaf.TLPLabel, files []csaf.AdvisoryFile)
|
|||
|
||||
download := func(r io.Reader) error {
|
||||
tee := io.TeeReader(r, hasher)
|
||||
return json.NewDecoder(tee).Decode(&advisory)
|
||||
return misc.StrictJSONParse(tee, &advisory)
|
||||
}
|
||||
|
||||
if err := downloadJSON(w.client, file.URL(), download); err != nil {
|
||||
|
|
@ -627,7 +627,6 @@ func (w *worker) mirrorFiles(tlpLabel csaf.TLPLabel, files []csaf.AdvisoryFile)
|
|||
// If this fails it creates a signature itself with the configured key.
|
||||
func (w *worker) downloadSignatureOrSign(url, fname string, data []byte) error {
|
||||
sig, err := w.downloadSignature(url)
|
||||
|
||||
if err != nil {
|
||||
if err != errNotFound {
|
||||
w.log.Error("Could not find signature URL", "url", url, "err", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue