codescan

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDataSourceIDForSemgrep added in v0.11.0

func GenerateDataSourceIDForSemgrep(f *SemgrepFinding) string

func GenerateGitHubURL added in v0.11.0

func GenerateGitHubURL(githubBaseURL, masterBranch string, f *SemgrepFinding) string

func GeneratePutFindingRequest added in v0.11.0

func GeneratePutFindingRequest(projectID uint32, f *SemgrepFinding) (*finding.PutFindingRequest, error)

func GetScoreSemgrep added in v0.11.0

func GetScoreSemgrep(serverity, likelihood, impact string) float32

func GetSemgrepRecommend added in v0.11.0

func GetSemgrepRecommend(repoName, fileName, rule, semgrepMessage, githubURL, line string) *recommend

func NewHandler

func NewHandler(
	ctx context.Context,
	fc finding.FindingServiceClient,
	ac alert.AlertServiceClient,
	cc code.CodeServiceClient,
	codeDataKey string,
	githubDefaultToken string,
	limitRepositorySizeKb int,
	l logging.Logger,
) (*sqsHandler, error)

Types

type SemgrepExtra added in v0.11.0

type SemgrepExtra struct {
	EngineKind    string      `json:"engine_kind,omitempty"`
	Fingerprint   string      `json:"fingerprint,omitempty"`
	IsIgnored     bool        `json:"is_ignored,omitempty"`
	Lines         string      `json:"lines,omitempty"`
	Message       string      `json:"message,omitempty"`
	Severity      string      `json:"severity,omitempty"`
	ValidateState string      `json:"validate_state,omitempty"`
	Metadata      interface{} `json:"metadata,omitempty"`
}

type SemgrepFinding added in v0.11.0

type SemgrepFinding struct {
	Repository     string        `json:"repository,omitempty"`
	RepoVisibility string        `json:"repo_visibility,omitempty"`
	GitHubURL      string        `json:"github_url,omitempty"`
	CheckID        string        `json:"check_id,omitempty"`
	Path           string        `json:"path,omitempty"`
	Start          *SemgrepLine  `json:"start,omitempty"`
	End            *SemgrepLine  `json:"end,omitempty"`
	Extra          *SemgrepExtra `json:"extra,omitempty"`
}

func ParseSemgrepResult added in v0.11.0

func ParseSemgrepResult(dir, scanResult, repository, masterBranch, githubBaseURL string) ([]*SemgrepFinding, error)

type SemgrepLine added in v0.11.0

type SemgrepLine struct {
	Line   int `json:"line,omitempty"`
	Column int `json:"col,omitempty"`
	Offset int `json:"offset,omitempty"`
}

type SemgrepMetadata added in v0.11.0

type SemgrepMetadata struct {
	Likelihood string `json:"likelihood,omitempty"`
	Impact     string `json:"impact,omitempty"`
}

SemgrepMetadata is a struct for semgrep metadata. If `security` category, a metadata has `likelihood` and `impact` fields(required fields). refs: https://semgrep.dev/docs/contributing/contributing-to-semgrep-rules-repository/#including-fields-required-by-security-category

type SemgrepResults added in v0.11.0

type SemgrepResults struct {
	Results []*SemgrepFinding `json:"results,omitempty"`
}

Jump to

Keyboard shortcuts

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