1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Check that filename matches ID in csaf_validator

This commit is contained in:
Bernhard Herzog 2023-04-25 18:38:49 +02:00
parent a92c033a5e
commit 900da91687

View file

@ -54,6 +54,7 @@ func main() {
func run(opts *options, files []string) error {
var validator csaf.RemoteValidator
eval := util.NewPathEval()
if opts.RemoteValidator != "" {
validatorOptions := csaf.RemoteValidatorOptions{
@ -109,6 +110,13 @@ func run(opts *options, files []string) error {
} else {
fmt.Printf("%q passes the schema validation.\n", file)
}
// Check filename agains ID
if err := util.IDMatchesFilename(eval, doc, filepath.Base(file)); err != nil {
log.Printf("%s: %s.\n", file, err)
continue
}
// Validate against remote validator.
if validator != nil {
rvr, err := validator.Validate(doc)