Skip to content

Commit 463813e

Browse files
Merge pull request #9207 from harness/STO-8477
STO: Document STO Policy Sample - Block Based on External Policy Failures
2 parents 3623697 + 2a4d5df commit 463813e

8 files changed

+32
-7
lines changed

docs/security-testing-orchestration/sto-techref-category/anchore-enterprise-scanner-reference.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can scan your container images with [Anchore Enterprise](https://docs.anchor
2020

2121
- You must use the Anchore v2 API and Anchore Enterprise Server v5.0 or higher to run orchestration and extraction scans.
2222

23-
- When you're deploying an Anchore Enterprise server, expose port 8228. This is the port that Harness uses to communicate with the server.
23+
When you deploy an Anchore Enterprise server, expose port 8228. Harness uses this port to communicate with the server.
2424

2525
### All data ingestion methods are supported
2626

@@ -229,7 +229,7 @@ import ScannerRefAdvancedSettings from './shared/_advanced-settings.md';
229229
<ScannerRefAdvancedSettings />
230230

231231
## View Anchore policy failures
232-
Anchore policy failures will appear in scan results as `Info` severity issues, with the issue type set to `EXTERNAL_POLICY`. Successfully passed policies will not be included in the scan results. Additionally, you can apply [OPA policies](/docs/security-testing-orchestration/policies/create-opa-policies) in Harness STO to enforce or manage the policy failures.
232+
Anchore policy failures will appear in scan results as `Info` severity issues, with the issue type set to `EXTERNAL_POLICY`. Successfully passed policies will not be included in the scan results. Additionally, you can apply an OPA policy to fail the pipeline based on the policy failures. This can be achieved using the [Security Tests - External Policy Failures](/docs/security-testing-orchestration/policies/create-opa-policies.md#block-the-pipeline-based-on-external-policy-failures) policy from the [security tests policy samples](/docs/security-testing-orchestration/policies/create-opa-policies.md#security-test-policy-samples).
233233

234234
## Proxy settings
235235

docs/security-testing-orchestration/sto-techref-category/shared/_wiz-policy-failure-results.md

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The Wiz policy failure results appear in the scan results as an `Info` level issue, categorized as `External Policy` Issue Type. Additionally, you can apply an OPA policy to fail the pipeline based on the policy failures. This can be achieved using the [Security Tests - External Policy Failures](/docs/security-testing-orchestration/policies/create-opa-policies.md#block-the-pipeline-based-on-external-policy-failures) policy from the [security tests policy samples](/docs/security-testing-orchestration/policies/create-opa-policies.md#security-test-policy-samples).

docs/security-testing-orchestration/sto-techref-category/sonarqube-sonar-scanner-reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ You can use [Harness expressions](https://developer.harness.io/docs/platform/var
344344
This setup ensures that the scan result name reflects both the branch and the PR, making it easier to identify and manage scan results in the SonarQube portal.
345345

346346
## View SonarQube quality gate failures
347-
SonarQube quality gate failures will appear in scan results as 'Info' severity issues, with the issue type set to `EXTERNAL_POLICY`. Additionally, you can apply OPA policies in Harness STO to enforce or manage these failures.
347+
SonarQube quality gate failures will appear in scan results as 'Info' severity issues, with the issue type set to `EXTERNAL_POLICY`. Additionally, you can apply an OPA policy to fail the pipeline based on the quality gate failures. This can be achieved using the [Security Tests - External Policy Failures](/docs/security-testing-orchestration/policies/create-opa-policies.md#block-the-pipeline-based-on-external-policy-failures) policy from the [security tests policy samples](/docs/security-testing-orchestration/policies/create-opa-policies.md#security-test-policy-samples).
348348

349349
To retrieve quality gate failure data from SonarQube, ensure the access token used in the SonarQube step configuration has **Browse Project** or **Administer** [permissions](https://docs.sonarsource.com/sonarqube/latest/instance-administration/user-management/user-permissions/) for the project being scanned.
350350

docs/security-testing-orchestration/sto-techref-category/wiz/artifact-scans-with-wiz.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ import ScannerRefAdvancedSettings from '../shared/_advanced-settings.md';
394394

395395
## View Wiz policy failures
396396

397-
import WizPolicyFailureResults from '../shared/_wiz-policy-failure-results.md';
397+
import WizPolicyFailureResults from '../shared/wiz-policy-failure-results.md';
398398

399399
<WizPolicyFailureResults />
400400

docs/security-testing-orchestration/sto-techref-category/wiz/iac-scans-with-wiz.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ import ScannerRefAdvancedSettings from '../shared/_advanced-settings.md';
268268

269269
## View Wiz policy failures
270270

271-
import WizPolicyFailureResults from '../shared/_wiz-policy-failure-results.md';
271+
import WizPolicyFailureResults from '../shared/wiz-policy-failure-results.md';
272272

273273
<WizPolicyFailureResults />
274274

docs/security-testing-orchestration/sto-techref-category/wiz/repo-scans-with-wiz.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ import ScannerRefAdvancedSettings from '../shared/_advanced-settings.md';
313313

314314
## View Wiz policy failures
315315

316-
import WizPolicyFailureResults from '../shared/_wiz-policy-failure-results.md';
316+
import WizPolicyFailureResults from '../shared/wiz-policy-failure-results.md';
317317

318318
<WizPolicyFailureResults />
319319

docs/security-testing-orchestration/use-sto/shared/security-tests-policy-samples.md

+25
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The Harness Policy Library includes the following [policy samples](/docs/platfor
1818
- [Exclude vulnerabilities by CVE age](#exclude-vulnerabilities-by-cve-age)
1919
- [Exclude vulnerabilities using STO output variables](#exclude-vulnerabilities-using-sto-output-variables)
2020
- [Block the pipeline based on the code coverage results](#block-the-pipeline-based-on-the-code-coverage-results)
21+
- [Block the pipeline based on external policy failures](#block-the-pipeline-based-on-external-policy-failures)
2122

2223
<!-- TOC end -->
2324

@@ -243,4 +244,28 @@ deny_list :=([
243244
# "name": "HIGH", "value": 0, "operator": ">"
244245
# }
245246
])
247+
```
248+
249+
#### Block the pipeline based on external policy failures
250+
251+
Apply a policy to the scan step to either warn or block the pipeline based on the external policy failures. You can use the sample policy **Security Tests - External Policy Failures**. Below is a sample policy for reference:
252+
253+
```
254+
package securityTests
255+
256+
import future.keywords.in
257+
import future.keywords.if
258+
259+
# Define a set of Output Variables that are denied
260+
deny_list :=([
261+
# Fail if EXTERNAL_POLICY_FAILURES count is greater than 0
262+
{
263+
"name": "EXTERNAL_POLICY_FAILURES", "value": 0, "operator": ">"
264+
},
265+
# Optionally define more Output Variables here
266+
# {
267+
# "name": "HIGH", "value": 0, "operator": ">"
268+
# }
269+
])
270+
246271
```

0 commit comments

Comments
 (0)