Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enabling exit codes for general cli o/p and updating field names #43

Merged
merged 5 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions analyses/summary/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type SeverityType struct {
type StackSummary struct {
TotalScannedDependencies int `json:"total_scanned_dependencies"`
TotalScannedTransitiveDependencies int `json:"total_scanned_transitives"`
TotalVulnerabilities int `json:"total_vulnerabilites"`
CommonlyKnownVulnerabilities int `json:"commonly_known_vulnerabilites"`
TotalVulnerabilities int `json:"total_vulnerabilities"`
CommonlyKnownVulnerabilities int `json:"publicly_available_vulnerabilities"`
VulnerabilitiesUniqueToSynk int `json:"vulnerabilities_unique_to_synk"`
DirectVulnerableDependencies int `json:"direct_vulnerable_dependencies"`
LowVulnerabilities int `json:"low_vulnerabilities"`
Expand Down
2 changes: 1 addition & 1 deletion analyses/verbose/testdata/verbosedata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"version": "1.1"
}],
"latest_version": "7.1.2",
"commonly_known_vulnerabilities": [
"publicly_available_vulnerabilities": [
deepak1725 marked this conversation as resolved.
Show resolved Hide resolved
{"id": "ABC-PYTHON-CODECOV-12345", "severity": "medium", "title": "Command Injection1"},
{"id": "ABC-PYTHON-CODECOV-67890", "severity": "medium", "title": "Command Injection2"},
{"id": "ABC-PYTHON-CODECOV-abcde", "severity": "high", "title": "Command Injection3"}
Expand Down
2 changes: 1 addition & 1 deletion analyses/verbose/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type DependenciesType struct {
Transitives []DependenciesType `json:"transitives"`
LatestVersion string `json:"latest_version"`
RecommendedVersion string `json:"recommended_version"`
CommonlyKnownVulnerabilities []VulnerabilityType `json:"commonly_known_vulnerabilities"`
CommonlyKnownVulnerabilities []VulnerabilityType `json:"publicly_available_vulnerabilities"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change the field name as well? @yzainee ?
CommonlyKnownVulnerabilities => PubliclyAvailableVulnerabilities?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wouldnt matter much in the end. will leave it to @deepak1725

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arajkumar its internal usage only.. I feel it's okay to keep it as it is.
Please let me know if you have strong opinions regarding that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, included that update also

CommonlyKnownVulnerabilities => PubliclyAvailableVulnerabilities?

VulnerabilitiesUniqueToSynk []VulnerabilityType `json:"vulnerabilities_unique_with_snyk"`
VulnerableTransitives []DependenciesType `json:"vulnerable_transitives"`
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/analyse.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func runAnalyse(cmd *cobra.Command, args []string) {
fmt.Fprintln(os.Stdout, "Analysing your Dependency Stack! Please wait...")
}
hasVul := sa.StackAnalyses(requestParams, jsonOut, verboseOut)
if hasVul && jsonOut {
if hasVul {
// Stack has vulnerability, exit with 2 code
os.Exit(2)
}
Expand Down