Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateIdeaErrorOutput(e error) string
- func GenerateIdeaOutput(c context.Context) string
- func NewInspectError(language Language, message string) error
- func WithInspectorTask(ctx context.Context, scanDir string) context.Context
- func WithScanTask(ctx context.Context, task *ScanTask) context.Context
- func WrapIdeaErr(e error, ideaCode IdeaErrCode) error
- type Contributor
- type Dependency
- type FileHash
- type GitInfo
- type IdeaErrCode
- type InspectError
- type Inspector
- type InspectorFeature
- type InspectorTask
- type Language
- type LicenseLevel
- type Module
- type PackageManagerType
- type PluginComp
- type PluginCompFix
- type PluginCompFixList
- type PluginCompLicense
- type PluginCompSolution
- type PluginOutput
- type ProjectType
- type ScanStrategy
- type ScanTask
- type SuggestLevel
- type TaskKind
- type TaskScanResponse
- type TaskType
- type VoVulnInfo
- type VulnLevelType
Constants ¶
View Source
const ( ErrNoGitRemoteFound _e // no git remote found ErrNoGitRepo // no git repo found )
Variables ¶
View Source
var Logger = zap.NewNop()
Functions ¶
func GenerateIdeaErrorOutput ¶ added in v1.7.0
func GenerateIdeaOutput ¶ added in v1.7.0
func NewInspectError ¶
func WithInspectorTask ¶
func WrapIdeaErr ¶ added in v1.7.0
func WrapIdeaErr(e error, ideaCode IdeaErrCode) error
Types ¶
type Contributor ¶
type Dependency ¶
type Dependency struct { Name string `json:"name"` Version string `json:"version"` Dependencies []Dependency `json:"dependencies,omitempty"` }
type GitInfo ¶
type GitInfo struct { RemoteName string `json:"remote_name"` RemoteURL string `json:"remote_url"` HeadCommitHash string `json:"head_commit_hash"` HeadRefName string `json:"head_ref_name"` ProjectName string `json:"project_name"` CommitMsg string `json:"commit_msg"` Committer string `json:"committer"` CommitterEmail string `json:"committer_email"` CommitTime time.Time `json:"commit_time"` }
type IdeaErrCode ¶ added in v1.7.0
type IdeaErrCode int
const ( IdeaSucceed IdeaErrCode = iota + 100 IdeaUnknownErr IdeaInspectErr IdeaEngineScanFailed IdeaServerRequestFailed IdeaTokenInvalid IdeaApiTimeout IdeaScanDirInvalid IdeaLogFileCreateFailed )
func GetIdeaErrCode ¶ added in v1.7.0
func GetIdeaErrCode(e error) IdeaErrCode
func (IdeaErrCode) Error ¶ added in v1.7.0
func (code IdeaErrCode) Error() string
func (IdeaErrCode) String ¶ added in v1.7.0
func (code IdeaErrCode) String() string
func (*IdeaErrCode) UnmarshalText ¶ added in v1.7.0
func (code *IdeaErrCode) UnmarshalText(data []byte) error
type InspectError ¶
func (InspectError) Error ¶
func (i InspectError) Error() string
type InspectorFeature ¶ added in v1.9.8
type InspectorFeature int
const (
InspectorFeatureAllowNested InspectorFeature = 1 << iota
)
type InspectorTask ¶
func UseInspectorTask ¶
func UseInspectorTask(ctx context.Context) *InspectorTask
func (*InspectorTask) AddModule ¶
func (i *InspectorTask) AddModule(module Module)
type Language ¶
type Language string
const ( Cxx Language = "C/C++" Ruby Language = "Ruby" ObjectiveC Language = "Objective-C" PHP Language = "PHP" Go Language = "Go" Java Language = "Java" JavaScript Language = "JavaScript" Python Language = "Python" DotNet Language = "DotNet" Erlang Language = "Erlang" Rust Language = "Rust" Scala Language = "Scala" )
type LicenseLevel ¶
type LicenseLevel string
const ( LicenseLevelLow LicenseLevel = "Low" LicenseLevelMedium LicenseLevel = "Medium" LicenseLevelHigh LicenseLevel = "High" )
type Module ¶
type Module struct { PackageManager PackageManagerType `json:"package_manager"` Language Language `json:"language"` Name string `json:"name"` Version string `json:"version"` RelativePath string `json:"relative_path"` Dependencies []Dependency `json:"dependencies,omitempty"` RuntimeInfo interface{} `json:"runtime_info,omitempty"` UUID uuid.UUID `json:"uuid"` ScanStrategy ScanStrategy `json:"scan_strategy"` }
type PackageManagerType ¶
type PackageManagerType string
const ( PMMaven PackageManagerType = "maven" PMGoMod PackageManagerType = "gomod" PMNpm PackageManagerType = "npm" PMGradle PackageManagerType = "gradle" PMYarn PackageManagerType = "yarn" PMPython PackageManagerType = "python" PMPip PackageManagerType = "pip" PMComposer PackageManagerType = "composer" PMBundler PackageManagerType = "bundler" PMCocoaPods PackageManagerType = "cocoapods" PMPoetry PackageManagerType = "poetry" PmNuget PackageManagerType = "nuget" PmConan PackageManagerType = "conan" PmRebar3 PackageManagerType = "rebar3" PmCargo PackageManagerType = "cargo" PmIvy PackageManagerType = "ivy" PmSbt PackageManagerType = "sbt" )
type PluginComp ¶ added in v1.7.0
type PluginComp struct { CompName string `json:"comp_name"` ShowLevel int `json:"show_level"` MinFixedVersion string `json:"min_fixed_version"` DisposePlan PluginCompFixList `json:"dispose_plan"` Vulns []VoVulnInfo `json:"vulns"` Version string `json:"version"` License *PluginCompLicense `json:"license,omitempty"` Solutions []PluginCompSolution `json:"solutions"` IsDirectDependency bool `json:"is_direct_dependency"` Language string `json:"language"` FixType string `json:"fix_type"` CompSecScore int `json:"comp_sec_score"` }
type PluginCompFix ¶ added in v1.7.0
type PluginCompFixList ¶ added in v1.7.0
type PluginCompFixList []PluginCompFix
func (PluginCompFixList) Len ¶ added in v1.7.3
func (l PluginCompFixList) Len() int
func (PluginCompFixList) Less ¶ added in v1.7.3
func (l PluginCompFixList) Less(i, j int) bool
func (PluginCompFixList) MarshalJSON ¶ added in v1.7.0
func (l PluginCompFixList) MarshalJSON() ([]byte, error)
func (PluginCompFixList) Swap ¶ added in v1.7.3
func (l PluginCompFixList) Swap(i, j int)
func (PluginCompFixList) Uniq ¶ added in v1.7.3
func (l PluginCompFixList) Uniq() (rs PluginCompFixList)
type PluginCompLicense ¶ added in v1.7.0
type PluginCompLicense struct { Level LicenseLevel `json:"level"` Spdx string `json:"spdx"` }
type PluginCompSolution ¶ added in v1.7.0
type PluginOutput ¶ added in v1.7.0
type PluginOutput struct { ProjectName string `json:"project_name"` Username string `json:"username"` ErrCode IdeaErrCode `json:"err_code"` IssuesCount int `json:"issues_count"` Comps []PluginComp `json:"comps"` ProjectScore int `json:"project_score"` SurpassScore string `json:"surpass_score"` IssuesLevelCount struct { Critical int `json:"critical"` High int `json:"high"` Medium int `json:"medium"` Low int `json:"low"` } `json:"issues_level_count"` TaskId string `json:"task_id"` TotalContributors int `json:"total_contributors"` ProjectId string `json:"project_id"` InspectErrors []InspectError `json:"inspect_errors,omitempty"` DependenciesCount int `json:"dependencies_count"` InspectReportUrl string `json:"inspect_report_url"` AnonymousReportUrl string `json:"anonymous_report_url"` HasGradleProject bool `json:"has_gradle_project"` }
type ProjectType ¶
type ProjectType string
const ( ProjectTypeLocal ProjectType = "Local" ProjectTypeGit ProjectType = "Git" )
type ScanStrategy ¶ added in v1.9.7
type ScanStrategy string
const ( ScanStrategyNormal ScanStrategy = "Normal" ScanStrategyBackup ScanStrategy = "Backup" )
type ScanTask ¶
type ScanTask struct { TaskId string ProjectDir string ProjectName string Kind TaskKind ProjectType ProjectType ProjectId string Username string StartTime time.Time GitInfo *GitInfo TaskType TaskType ContributorList []Contributor TotalContributors int Modules []Module ScanResult *TaskScanResponse EnableDeepScan bool FileHashes []FileHash }
func CreateScanTask ¶
func UseScanTask ¶
func (*ScanTask) AnonymousReportUrl ¶ added in v1.9.8
type SuggestLevel ¶
type SuggestLevel string
const ( SuggestLevelOptional SuggestLevel = "Optional" SuggestLevelRecommend SuggestLevel = "Recommend" SuggestLevelStrongRecommend SuggestLevel = "StrongRecommend" )
type TaskScanResponse ¶
type TaskScanResponse struct { Complete bool `json:"complete"` DependenciesCount int `json:"dependencies_count"` IssuesCompsCount int `json:"issues_comps_count"` ProjectScore int `json:"project_score"` SurpassScore int `json:"surpass_score"` Modules []struct { ModuleId int `json:"module_id"` Language string `json:"language"` PackageManager string `json:"package_manager"` Comps []struct { MinFixedInfo []struct { Name string `json:"name"` OldVersion string `json:"old_version"` NewVersion string `json:"new_version"` SecurityScore int `json:"security_score"` CompatibilityScore int `json:"compatibility_score"` } `json:"min_fixed_info,omitempty"` IsDirectDependency bool `json:"is_direct_dependency"` CompId int `json:"comp_id"` CompName string `json:"comp_name"` CompVersion string `json:"comp_version"` MinFixedVersion string `json:"min_fixed_version"` License *struct { Level LicenseLevel `json:"level"` Spdx string `json:"spdx"` } `json:"license,omitempty"` Solutions []struct { Compatibility *int `json:"compatibility,omitempty"` Description string `json:"description"` Type string `json:"type,omitempty"` } `json:"solutions,omitempty"` Vuls []VoVulnInfo `json:"vuls"` FixType string `json:"fix_type"` CompSecScore int `json:"comp_sec_score"` } `json:"comps"` } `json:"modules"` TaskId string `json:"task_id"` Status string `json:"status"` InspectReportUrl string `json:"inspect_report_url"` }
func (TaskScanResponse) ReportURL ¶ added in v1.7.9
func (t TaskScanResponse) ReportURL() string
type VoVulnInfo ¶
type VoVulnInfo struct { CveId string `json:"cve_id"` Description string `json:"description"` Level VulnLevelType `json:"level"` Influence int `json:"influence"` Poc bool `json:"poc"` PublishTime int `json:"publish_time"` AffectedVersion string `json:"affected_version"` MinFixedVersion string `json:"min_fixed_version"` References []struct { Name string `json:"name"` Url string `json:"url"` } `json:"references"` Solutions []struct { Type string `json:"type"` Description string `json:"description"` Compatibility int `json:"compatibility"` } `json:"solutions"` SuggestLevel SuggestLevel `json:"suggest_level"` VulnNo string `json:"vuln_no"` VulnPath []string `json:"vuln_path"` Title string `json:"title"` }
type VulnLevelType ¶
type VulnLevelType string
const ( VulnLevelCritical VulnLevelType = "Critical" VulnLevelHigh VulnLevelType = "High" VulnLevelMedium VulnLevelType = "Medium" VulnLevelLow VulnLevelType = "Low" )
Click to show internal directories.
Click to hide internal directories.