codeql

package
v1.463.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CommitMessageMirroringCode = "Mirroring code for revision %s from %s"
	SrcZip                     = "src.zip"
	CodeqlDatabaseYml          = "codeql-database.yml"
	OriginRemote               = "origin"
)
View Source
const AuditAll string = "Audit All"
View Source
const Optional string = "Optional"

Variables

This section is empty.

Functions

func AppendCodeQLPaths added in v1.463.0

func AppendCodeQLPaths(cfgPath string, scanPaths, ignorePaths []string) error

AppendCodeQLPaths updates the CodeQL config YAML with new paths/paths-ignore.

func AppendCustomFlags added in v1.355.0

func AppendCustomFlags(cmd []string, flags map[string]string) []string

AppendCustomFlags appends custom flags from the flags map to the command slice. The flags map should contain flags in their complete form (e.g., key: "--flag", value: "--flag=value"). Only non-empty flags (after trimming whitespace) are appended to avoid adding empty or whitespace-only entries to the command. Returns a new slice with the original command elements followed by the valid flags.

func AppendFlagIfNotSetByUser added in v1.355.0

func AppendFlagIfNotSetByUser(cmd []string, flagToCheck []string, flagToAppend []string, customFlags map[string]string) []string

func AppendThreadsAndRam added in v1.355.0

func AppendThreadsAndRam(cmd []string, threads, ram string, customFlags map[string]string) []string

func CreateAndPersistToolRecord added in v1.321.0

func CreateAndPersistToolRecord(utils piperutils.FileUtils, repoInfo *RepoInfo, modulePath string) (string, error)

func IsFlagSetByUser added in v1.355.0

func IsFlagSetByUser(customFlags map[string]string, flagsToCheck []string) bool

func ParseCustomFlags added in v1.355.0

func ParseCustomFlags(flagsStr string) map[string]string

ParseCustomFlags parses flagsStr and returns a map where each flag is mapped to its complete form. For flags with values (e.g., "--flag=value"), the key is the flag name and value is the complete flag. For flags without values (e.g., "--flag"), both key and value are set to the flag name. Duplicate flags (long/short variants) are removed based on longShortFlagsMap.

func ParsePaths added in v1.463.0

func ParsePaths(pathsStr string) []string

func WaitSarifUploaded added in v1.358.0

func WaitSarifUploaded(maxRetries, checkRetryInterval int, codeqlSarifUploader CodeqlSarifUploader) error

func Which added in v1.463.0

func Which(name string) (string, error)

Which finds the first executable in PATH and resolves symlinks.

func WriteJSONReport

func WriteJSONReport(jsonReport CodeqlAudit, modulePath string) ([]piperutils.Path, error)

Types

type CodeqlAudit

type CodeqlAudit struct {
	ToolName               string           `json:"toolName"`
	RepositoryUrl          string           `json:"repositoryUrl"`
	RepositoryReferenceUrl string           `json:"repositoryReferenceUrl"` //URL of PR or Branch where scan was performed
	CodeScanningLink       string           `json:"codeScanningLink"`
	QuerySuite             string           `json:"querySuite"`
	ScanResults            []CodeqlFindings `json:"findings"`
}

type CodeqlFindings added in v1.301.0

type CodeqlFindings struct {
	ClassificationName string `json:"classificationName"`
	Total              int    `json:"total"`
	Audited            int    `json:"audited"`
}

type CodeqlSarifUploader added in v1.296.0

type CodeqlSarifUploader interface {
	GetSarifStatus() (SarifFileInfo, error)
}

type CodeqlSarifUploaderInstance added in v1.296.0

type CodeqlSarifUploaderInstance struct {
	// contains filtered or unexported fields
}

func NewCodeqlSarifUploaderInstance added in v1.296.0

func NewCodeqlSarifUploaderInstance(url, token string) CodeqlSarifUploaderInstance

func (*CodeqlSarifUploaderInstance) GetSarifStatus added in v1.296.0

func (codeqlSarifUploader *CodeqlSarifUploaderInstance) GetSarifStatus() (SarifFileInfo, error)

type CodeqlScanAudit

type CodeqlScanAudit interface {
	GetVulnerabilities(analyzedRef string, state string) error
}

type CodeqlScanAuditInstance

type CodeqlScanAuditInstance struct {
	// contains filtered or unexported fields
}

func NewCodeqlScanAuditInstance

func NewCodeqlScanAuditInstance(serverUrl, owner, repository, token string, trustedCerts []string) CodeqlScanAuditInstance

func (*CodeqlScanAuditInstance) GetVulnerabilities

func (codeqlScanAudit *CodeqlScanAuditInstance) GetVulnerabilities(analyzedRef string) ([]CodeqlFindings, error)

type GitUploader added in v1.315.0

type GitUploader interface {
	UploadProjectToGithub() (string, error)
}

type GitUploaderInstance added in v1.315.0

type GitUploaderInstance struct {
	*command.Command
	// contains filtered or unexported fields
}

func NewGitUploaderInstance added in v1.315.0

func NewGitUploaderInstance(token, ref, dbDir, sourceCommitId, sourceRepo, targetRepo string) (*GitUploaderInstance, error)

func (*GitUploaderInstance) UploadProjectToGithub added in v1.315.0

func (uploader *GitUploaderInstance) UploadProjectToGithub() (string, error)

type RepoInfo added in v1.321.0

type RepoInfo struct {
	ServerUrl   string
	Owner       string
	Repo        string
	CommitId    string
	AnalyzedRef string
	FullRef     string
	FullUrl     string
	ScanUrl     string
}

func GetRepoInfo added in v1.358.0

func GetRepoInfo(repository, analyzedRef, commitID, targetGithubRepoURL, targetGithubBranchName string) (*RepoInfo, error)

type SarifFileInfo added in v1.296.0

type SarifFileInfo struct {
	ProcessingStatus string   `json:"processing_status"`
	Errors           []string `json:"errors"`
}

Jump to

Keyboard shortcuts

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