Skip to content

Commit

Permalink
respect defaults when listing templates (#5846)
Browse files Browse the repository at this point in the history
* respect defaults when listing templates

* filter out headless, code and dast templates
  • Loading branch information
dogancanbakir authored Nov 23, 2024
1 parent 28abf56 commit 436c386
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/catalog/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,27 @@ func (store *Store) LoadTemplatesOnlyMetadata() error {

for templatePath := range validPaths {
template, _, _ := templatesCache.Has(templatePath)

if len(template.RequestsHeadless) > 0 && !store.config.ExecutorOptions.Options.Headless {
continue
}

if len(template.RequestsCode) > 0 && !store.config.ExecutorOptions.Options.EnableCodeTemplates {
continue
}

if template.IsFuzzing() && !store.config.ExecutorOptions.Options.DAST {
continue
}

if template.SelfContained && !store.config.ExecutorOptions.Options.EnableSelfContainedTemplates {
continue
}

if template.HasFileProtocol() && !store.config.ExecutorOptions.Options.EnableFileTemplates {
continue
}

if template != nil {
template.Path = templatePath
store.templates = append(store.templates, template)
Expand Down

0 comments on commit 436c386

Please sign in to comment.