Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions api/curl.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
opts.Cookies = ctx.Request.Cookies()
client := request.NewClient(opts)

s, err := scenario.NewURLScan(form.Method, form.URL, form.Data, client, &scan.ScanOptions{
IncludeScans: form.Opts.Scans,
ExcludeScans: form.Opts.ExcludeScans,
s, err := scenario.NewURLScan(form.Method, form.URL, form.Data, client, nil, &scan.ScanOptions{
IncludeScans: form.Opts.Scans,
ExcludeScans: form.Opts.ExcludeScans,
MinIssueSeverity: form.Opts.MinSeverity,
IncludeCWEs: form.Opts.IncludeCWEs,
ExcludeCWEs: form.Opts.ExcludeCWEs,
IncludeOWASPs: form.Opts.IncludeOWASPs,
ExcludeOWASPs: form.Opts.ExcludeOWASPs,

Check warning on line 43 in api/curl.go

View check run for this annotation

Codecov / codecov/patch

api/curl.go#L36-L43

Added lines #L36 - L43 were not covered by tests
})
if err != nil {
span.RecordError(err)
Expand Down
11 changes: 8 additions & 3 deletions api/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@
opts.Cookies = ctx.Request.Cookies()
client := request.NewClient(opts)

s, err := scenario.NewGraphQLScan(form.Endpoint, client, &scan.ScanOptions{
IncludeScans: form.Opts.Scans,
ExcludeScans: form.Opts.ExcludeScans,
s, err := scenario.NewGraphQLScan(form.Endpoint, client, nil, &scan.ScanOptions{
IncludeScans: form.Opts.Scans,
ExcludeScans: form.Opts.ExcludeScans,
MinIssueSeverity: form.Opts.MinSeverity,
IncludeCWEs: form.Opts.IncludeCWEs,
ExcludeCWEs: form.Opts.ExcludeCWEs,
IncludeOWASPs: form.Opts.IncludeOWASPs,
ExcludeOWASPs: form.Opts.ExcludeOWASPs,

Check warning on line 42 in api/graphql.go

View check run for this annotation

Codecov / codecov/patch

api/graphql.go#L35-L42

Added lines #L35 - L42 were not covered by tests
})
if err != nil {
span.RecordError(err)
Expand Down
11 changes: 8 additions & 3 deletions api/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@
}
}
securitySchemesValues := openapi.NewSecuritySchemeValues(values)
s, err := scenario.NewOpenAPIScan(doc, securitySchemesValues, client, &scan.ScanOptions{
IncludeScans: form.Opts.Scans,
ExcludeScans: form.Opts.ExcludeScans,
s, err := scenario.NewOpenAPIScan(doc, securitySchemesValues, client, nil, &scan.ScanOptions{
IncludeScans: form.Opts.Scans,
ExcludeScans: form.Opts.ExcludeScans,
MinIssueSeverity: form.Opts.MinSeverity,
IncludeCWEs: form.Opts.IncludeCWEs,
ExcludeCWEs: form.Opts.ExcludeCWEs,
IncludeOWASPs: form.Opts.IncludeOWASPs,
ExcludeOWASPs: form.Opts.ExcludeOWASPs,

Check warning on line 69 in api/openapi.go

View check run for this annotation

Codecov / codecov/patch

api/openapi.go#L62-L69

Added lines #L62 - L69 were not covered by tests
})
if err != nil {
span.RecordError(err)
Expand Down
9 changes: 7 additions & 2 deletions api/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ type ScanOptions struct {
RateLimit int `json:"rateLimit"`
ProxyURL string `json:"proxy"`

Scans []string `json:"scans"`
ExcludeScans []string `json:"excludeScans"`
Scans []string `json:"scans"`
ExcludeScans []string `json:"excludeScans"`
MinSeverity float64 `json:"minSeverity"`
IncludeCWEs []string `json:"includeCWEs"`
ExcludeCWEs []string `json:"excludeCWEs"`
IncludeOWASPs []string `json:"includeOWASPs"`
ExcludeOWASPs []string `json:"excludeOWASPs"`
}

func parseScanOptions(opts *ScanOptions) request.NewClientOptions {
Expand Down
11 changes: 8 additions & 3 deletions cmd/scan/curl.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@
}
request.SetDefaultClient(client)

s, err := scenario.NewURLScan(curlMethod, curlUrl, curlData, client, &scan.ScanOptions{
IncludeScans: internalCmd.GetIncludeScans(),
ExcludeScans: internalCmd.GetExcludeScans(),
s, err := scenario.NewURLScan(curlMethod, curlUrl, curlData, client, nil, &scan.ScanOptions{
IncludeScans: internalCmd.GetIncludeScans(),
ExcludeScans: internalCmd.GetExcludeScans(),
MinIssueSeverity: internalCmd.GetScanMinIssueSeverity(),
IncludeCWEs: internalCmd.GetScanIncludeCWEs(),
ExcludeCWEs: internalCmd.GetScanExcludeCWEs(),
IncludeOWASPs: internalCmd.GetScanIncludeOWASPs(),
ExcludeOWASPs: internalCmd.GetScanExcludeOWASPs(),

Check warning on line 51 in cmd/scan/curl.go

View check run for this annotation

Codecov / codecov/patch

cmd/scan/curl.go#L44-L51

Added lines #L44 - L51 were not covered by tests
})
if err != nil {
span.RecordError(err)
Expand Down
11 changes: 8 additions & 3 deletions cmd/scan/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@
}
request.SetDefaultClient(client)

s, err := scenario.NewGraphQLScan(graphqlEndpoint, client, &scan.ScanOptions{
IncludeScans: internalCmd.GetIncludeScans(),
ExcludeScans: internalCmd.GetExcludeScans(),
s, err := scenario.NewGraphQLScan(graphqlEndpoint, client, nil, &scan.ScanOptions{
IncludeScans: internalCmd.GetIncludeScans(),
ExcludeScans: internalCmd.GetExcludeScans(),
MinIssueSeverity: internalCmd.GetScanMinIssueSeverity(),
IncludeCWEs: internalCmd.GetScanIncludeCWEs(),
ExcludeCWEs: internalCmd.GetScanExcludeCWEs(),
IncludeOWASPs: internalCmd.GetScanIncludeOWASPs(),
ExcludeOWASPs: internalCmd.GetScanExcludeOWASPs(),

Check warning on line 45 in cmd/scan/graphql.go

View check run for this annotation

Codecov / codecov/patch

cmd/scan/graphql.go#L38-L45

Added lines #L38 - L45 were not covered by tests
})
if err != nil {
span.RecordError(err)
Expand Down
11 changes: 8 additions & 3 deletions cmd/scan/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@
}
request.SetDefaultClient(client)

s, err := scenario.NewOpenAPIScan(doc, securitySchemesValues, client, &scan.ScanOptions{
IncludeScans: internalCmd.GetIncludeScans(),
ExcludeScans: internalCmd.GetExcludeScans(),
s, err := scenario.NewOpenAPIScan(doc, securitySchemesValues, client, nil, &scan.ScanOptions{
IncludeScans: internalCmd.GetIncludeScans(),
ExcludeScans: internalCmd.GetExcludeScans(),
MinIssueSeverity: internalCmd.GetScanMinIssueSeverity(),
IncludeCWEs: internalCmd.GetScanIncludeCWEs(),
ExcludeCWEs: internalCmd.GetScanExcludeCWEs(),
IncludeOWASPs: internalCmd.GetScanIncludeOWASPs(),
ExcludeOWASPs: internalCmd.GetScanExcludeOWASPs(),

Check warning on line 88 in cmd/scan/openapi.go

View check run for this annotation

Codecov / codecov/patch

cmd/scan/openapi.go#L81-L88

Added lines #L81 - L88 were not covered by tests
})
if err != nil {
span.RecordError(err)
Expand Down
37 changes: 37 additions & 0 deletions internal/cmd/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ var (
noProgress bool
severityThreshold float64

scanMinIssueSeverity float64
scanIncludeCWEs []string
scanExcludeCWEs []string
scanIncludeOWASPs []string
scanExcludeOWASPs []string

placeholderString string
placeholderBool bool
)
Expand All @@ -48,6 +54,12 @@ func AddCommonArgs(cmd *cobra.Command) {

cmd.Flags().BoolVarP(&noProgress, "no-progress", "", false, "Disable progress output")
cmd.Flags().Float64VarP(&severityThreshold, "severity-threshold", "", 1, "Threshold to trigger stderr output if at least one vulnerability CVSS is higher")

cmd.Flags().Float64VarP(&scanMinIssueSeverity, "scan-min-severity", "", 0, "Minimum severity score (CVSS) to report an issue")
cmd.Flags().StringArrayVarP(&scanIncludeCWEs, "scan-include-cwe", "", scanIncludeCWEs, "Include specific CWEs (e.g., CWE-200, CWE-22)")
cmd.Flags().StringArrayVarP(&scanExcludeCWEs, "scan-exclude-cwe", "", scanExcludeCWEs, "Exclude specific CWEs (e.g., CWE-200, CWE-22)")
cmd.Flags().StringArrayVarP(&scanIncludeOWASPs, "scan-include-owasp", "", scanIncludeOWASPs, "Include specific OWASP")
cmd.Flags().StringArrayVarP(&scanExcludeOWASPs, "scan-exclude-owasp", "", scanExcludeOWASPs, "Exclude specific OWASP")
}

func AddPlaceholderArgs(cmd *cobra.Command) {
Expand Down Expand Up @@ -126,6 +138,26 @@ func GetSeverityThreshold() float64 {
return severityThreshold
}

func GetScanMinIssueSeverity() float64 {
return scanMinIssueSeverity
}

func GetScanIncludeCWEs() []string {
return scanIncludeCWEs
}

func GetScanExcludeCWEs() []string {
return scanExcludeCWEs
}

func GetScanIncludeOWASPs() []string {
return scanIncludeOWASPs
}

func GetScanExcludeOWASPs() []string {
return scanExcludeOWASPs
}

func basicAuth(user string) string {
credentials := strings.Split(user, ":")
if len(credentials) != 2 || credentials[0] == "" {
Expand All @@ -148,4 +180,9 @@ func ClearValues() {
reportURL = ""
noProgress = false
severityThreshold = 1
scanMinIssueSeverity = 0
scanIncludeCWEs = []string{}
scanExcludeCWEs = []string{}
scanIncludeOWASPs = []string{}
scanExcludeOWASPs = []string{}
}
Loading