semgrep

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package semgrep provides data model, decoder, and validator for Semgrep reports

Index

Constants

View Source
const ConfigFieldName = "semgrep"

ConfigFieldName the field name in the config map

View Source
const ConfigType = "Semgrep Config"

ConfigType in plaintext

View Source
const ReportType = "Semgrep Scan Report"

ReportType in plaintext

Variables

This section is empty.

Functions

func NewReportDecoder

func NewReportDecoder() *gce.JSONWriterDecoder[ScanReport]

NewReportDecoder implementation of generic JSON decoder with check function for simple field validation

func NewValidator

func NewValidator() gcv.Validator[semgrep.CliMatch, Config]

NewValidator implementation generic validatork

func ThresholdRule

func ThresholdRule(matches []semgrep.CliMatch, config Config) error

ThresholdRule deny if more than X vulnerability of Y severity

Types

type Config

type Config struct {
	Error   int `json:"error"   toml:"error"   yaml:"error"`
	Warning int `json:"warning" toml:"warning" yaml:"warning"`
	Info    int `json:"info"    toml:"info"    yaml:"info"`
}

Config data model

type ScanReport

ScanReport is a data model for a Semgrep Output scan produced by `semgrep scan --json`

func (ScanReport) String

func (r ScanReport) String() string

String pretty formatted table with all findings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL