mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-23 00:15:26 +00:00
update validation logic to validate workflow templates and subtemplates
This commit is contained in:
parent
7ff2335935
commit
09893539d2
@ -13,6 +13,7 @@ import (
|
|||||||
templateTypes "github.com/projectdiscovery/nuclei/v2/pkg/templates/types"
|
templateTypes "github.com/projectdiscovery/nuclei/v2/pkg/templates/types"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/utils/stats"
|
"github.com/projectdiscovery/nuclei/v2/pkg/utils/stats"
|
||||||
|
"github.com/projectdiscovery/nuclei/v2/pkg/workflows"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config contains the configuration options for the loader
|
// Config contains the configuration options for the loader
|
||||||
@ -196,6 +197,30 @@ func areWorkflowOrTemplatesValid(store *Store, filteredTemplatePaths map[string]
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if isWorkflow {
|
||||||
|
if !areWorkflowTemplatesValid(store, template.Workflows) {
|
||||||
|
areTemplatesValid = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return areTemplatesValid
|
||||||
|
}
|
||||||
|
|
||||||
|
func areWorkflowTemplatesValid(store *Store, workflows []*workflows.WorkflowTemplate) bool {
|
||||||
|
areTemplatesValid := true
|
||||||
|
for _, workflow := range workflows {
|
||||||
|
if !areWorkflowTemplatesValid(store, workflow.Subtemplates) {
|
||||||
|
areTemplatesValid = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
_, err := store.config.Catalog.GetTemplatePath(workflow.Template)
|
||||||
|
if err != nil {
|
||||||
|
if isParsingError("Error occurred loading template %s: %s\n", workflow.Template, err) {
|
||||||
|
areTemplatesValid = false
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return areTemplatesValid
|
return areTemplatesValid
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user