mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Check that filename matches ID in csaf_validator
This commit is contained in:
parent
a92c033a5e
commit
900da91687
1 changed files with 8 additions and 0 deletions
|
|
@ -54,6 +54,7 @@ func main() {
|
||||||
func run(opts *options, files []string) error {
|
func run(opts *options, files []string) error {
|
||||||
|
|
||||||
var validator csaf.RemoteValidator
|
var validator csaf.RemoteValidator
|
||||||
|
eval := util.NewPathEval()
|
||||||
|
|
||||||
if opts.RemoteValidator != "" {
|
if opts.RemoteValidator != "" {
|
||||||
validatorOptions := csaf.RemoteValidatorOptions{
|
validatorOptions := csaf.RemoteValidatorOptions{
|
||||||
|
|
@ -109,6 +110,13 @@ func run(opts *options, files []string) error {
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("%q passes the schema validation.\n", file)
|
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.
|
// Validate against remote validator.
|
||||||
if validator != nil {
|
if validator != nil {
|
||||||
rvr, err := validator.Validate(doc)
|
rvr, err := validator.Validate(doc)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue