Policy as Code
Policy as Code lets you define Fortify SCA automation policies in a standalone JSON file and include them in a scan request.
Policy as Code lets you define Fortify SCA automation policies in a JSON file. Include the file with a scan request.
Name the policy file debricked_policy.json. It is independent of debricked.config. Use it to:
Keep security and compliance policies under version control.
Apply policies to stateless scan requests.
Include policies in Fortify on Demand (FoD) scan payloads.
Define consistent, deterministic automation behavior.
Validate policies before executing automation rules.
Manage policy configuration alongside application configuration.
The debricked_policy.json file contains three main sections:
schemaVersion
settings
automations
Each automation rule defines:
Conditions that determine when the rule matches.
Actions that Fortify SCA performs when those conditions match.
Getting started
Create a JSON file named debricked_policy.json. This minimal example creates one automation rule:
File structure
schemaVersion
schemaVersion identifies the Policy as Code contract version. Use the following value for version 1:
Fortify SCA rejects unsupported schema versions during policy validation.
settings
The settings object controls how Fortify SCA processes the policy file.
fileOnly
Evaluates only the rules in debricked_policy.json for the scan request.
mergeWithWebappRules
Evaluates file rules together with rules configured in Fortify SCA.
invalidPolicyBehavior
invalidPolicyBehavior determines how Fortify SCA handles an invalid policy file.
fail
Fails the scan request when the policy file is invalid.
warn
Reports a warning when the policy file is invalid.
Defining automation rules
Define automation rules in automations.rules. Each rule contains enabled, conditions, and actions.
Enable or disable a rule
Set enabled to true to evaluate a rule. Set it to false to keep it in the file without evaluating it.
Conditions
Conditions define what must match before Fortify SCA executes a rule's actions.
subject
The item or attribute being evaluated.
op
The comparison operator.
value
The comparison value or values. Supply values as an array.
conj
How the condition combines with other conditions in the rule.
Supported condition subjects
vulnerabilitydependencybranchcvssrulelicenselicenseFamilylicenseRiskvulnerabilityDiscoveredDatesecurityScorecontributorScorepopularityScorescopelicenseReviewStatusdependencyDepthcvedependencyAgedependencyVersion
Supported condition operators
islessgreateris_notuntriggeredis_more_thanis_inis_less_than
Combining conditions with AND and OR
Use conj to control condition grouping:
andkeeps the condition in the current group.orstarts a new OR group.
Fortify SCA evaluates conditions using this pattern:
Mixed AND/OR example
This rule matches either group:
CVSS is greater than low and the branch is
feature.The dependency is in
denied_listand CVSS is greater than medium.
Dependency lists
When subject is dependency and op is is_in, use one of these list values:
allowed_listdenied_listallowed_list_direct_onlydenied_list_direct_only
Actions
failPipeline
Fails the pipeline when the rule matches.
warnPipeline
Generates a pipeline warning.
markUnaffected
Marks matching vulnerabilities as unaffected.
markVulnerable
Marks the matching item as vulnerable.
ignoreIfMarkedUnaffected
Ignores vulnerabilities already marked as unaffected.
notifyEmailAddresses
Notifies the specified email addresses.
notifyRoles
Notifies users assigned the specified roles.
webhookUrl
Specifies the webhook destination.
webhookSecret
Specifies the secret associated with the webhook.
Troubleshooting
The policy file is rejected
Verify the following:
The file contains valid JSON and is named
debricked_policy.json.schemaVersionis set to"1.0".executionModeandinvalidPolicyBehavioruse supported values.automations.rulescontains at least one rule.Each condition uses a supported subject, operator, and value format.
No rule sets both
failPipelineandwarnPipelinetotrue.No rule sets both
markUnaffectedandmarkVulnerabletotrue.
A rule is not evaluated
Verify the following:
enabledis set totrue.The rule is defined under
automations.rules.The condition values match the scanned project.
The selected operator is supported for the condition subject.
The AND/OR grouping matches the intended logic.
The selected execution mode includes the rule source.
Web application rules are not evaluated
When executionMode is set to fileOnly, only rules defined in debricked_policy.json are evaluated.
To evaluate file-based rules together with rules configured in the web application, set executionMode to mergeWithWebappRules.
Last updated
Was this helpful?

