Skip to content

Commit

Permalink
adding the check for CVSS3 feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagobcx committed Nov 2, 2023
1 parent 1ccc35e commit b6061e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/commands/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ func runTriageUpdate(resultsPredicatesWrapper wrappers.ResultsPredicatesWrapper)
state, _ := cmd.Flags().GetString(params.StateFlag)
comment, _ := cmd.Flags().GetString(params.CommentFlag)
scanType, _ := cmd.Flags().GetString(params.ScanTypeFlag)

// check if the current tenant has critical severity available
if !wrappers.FeatureFlags[wrappers.CVSSV3Enabled] && severity == "CRITICAL" {
return errors.Errorf("%s", "Critical severity is not available for your tenant")
}
predicate := &wrappers.PredicateRequest{
SimilarityID: similarityID,
ProjectID: projectID,
Expand Down
10 changes: 10 additions & 0 deletions internal/wrappers/feature-flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

const tenantIDClaimKey = "tenant_id"
const PackageEnforcementEnabled = "PACKAGE_ENFORCEMENT_ENABLED"
const CVSSV3Enabled = "CVSS_V3_ENABLED"

var FeatureFlagsBaseMap = []CommandFlags{
{
Expand All @@ -17,6 +18,15 @@ var FeatureFlagsBaseMap = []CommandFlags{
},
},
},
{
CommandName: "cx triage update",
FeatureFlags: []FlagBase{
{
Name: CVSSV3Enabled,
Default: false,
},
},
},
}

var FeatureFlags = map[string]bool{}
Expand Down

0 comments on commit b6061e6

Please sign in to comment.