Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
env:
# StackRox internal certificate for central is issued for this name.
ROX_INTERNAL_CENTRAL_NAME: 'central.stackrox'
# Frozen test data published by https://github.com/stackrox/stackrox/pull/23544.
SCANNER_V4_MATCHER_VULNERABILITIES_URL: https://definitions.stackrox.io/v4/vulnerability-bundles/ci-minimal-bab3cec6e362f74bbe0c4f6a2e552ce1bac983feb836c449929f20cfd88bf4ce/vulnerabilities.zip

jobs:
build:
Expand Down Expand Up @@ -68,12 +70,13 @@ jobs:
run: |
envrc_file="$(mktemp)"
cd stackrox
# Keep envVars in one --set expression; separate flags replace the list.
roxie deploy central \
--envrc "$envrc_file" \
--resources=tiny \
--set roxie.imageRegistry=quay.io/stackrox-io \
--set central.namespace=stackrox \
--set 'central.spec.customize.envVars[0].name=SCANNER_V4_MATCHER_READINESS,central.spec.customize.envVars[0].value=vulnerability' \
--set "central.spec.customize.envVars[0].name=SCANNER_V4_MATCHER_READINESS,central.spec.customize.envVars[0].value=vulnerability,central.spec.customize.envVars[1].name=SCANNER_V4_MATCHER_VULNERABILITIES_URL,central.spec.customize.envVars[1].value=$SCANNER_V4_MATCHER_VULNERABILITIES_URL" \
--early-readiness=false \
--central-wait 60m
source "$envrc_file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import com.offbytwo.jenkins.model.BuildResult
import com.stackrox.model.StorageEnforcementAction
import com.stackrox.model.StorageListPolicy
import com.stackrox.model.StoragePolicy
import com.stackrox.model.StoragePolicyGroup
import com.stackrox.model.StoragePolicySection
import com.stackrox.model.StoragePolicyValue
import com.stackrox.model.StorageSeverity

import util.Config

Expand All @@ -22,7 +26,7 @@ class ImageScanningTest extends BaseSpecification {
@Unroll
def "image scanning test with toggle enforcement(#imageName, #policyName, #enforcements, #endStatus)"() {
given:
updatePolicy("Fixable CVSS >= 7", [])
updatePolicy("Fixable CVSS >= 5", [])
updatePolicy("Fixable Severity at least Important", [])

when:
Expand Down Expand Up @@ -66,7 +70,7 @@ class ImageScanningTest extends BaseSpecification {
where:
"data inputs are: "
imageName | policyName | tag
"nginx-alpine:1.2.1" | "Fixable CVSS >= 7" | "1.2.1"
"nginx-alpine:1.2.1" | "Fixable CVSS >= 5" | "1.2.1"
"nginx-alpine:latest" | "Latest tag" | "latest"
}

Expand Down Expand Up @@ -104,6 +108,17 @@ class ImageScanningTest extends BaseSpecification {
StoragePolicy updatePolicy(String policyName, List<StorageEnforcementAction> enforcements) {
List<StorageListPolicy> policies = restApiClient.policies
def policyId = policies.find { it.name == policyName }?.id
if (policyId == null && policyName == "Fixable CVSS >= 5") {
// The minimal bundle includes fixable CVE-2022-2097 with CVSS 5.3 for the test image.
return restApiClient.policyServiceApi.policyServicePostPolicy(new StoragePolicy(
name: policyName, policyVersion: "1.1", severity: StorageSeverity.MEDIUM_SEVERITY,
categories: ["Vulnerability Management"], disabled: false,
lifecycleStages: [BUILD, DEPLOY], enforcementActions: enforcements,
policySections: [new StoragePolicySection(policyGroups:
["Fixed By": ".*", "CVSS": ">= 5"].collect { field, value ->
new StoragePolicyGroup(fieldName: field, values: [new StoragePolicyValue(value: value)])
})]), true)
}
Comment thread
janisz marked this conversation as resolved.
Resolved
assert policyId != null

def policy = restApiClient.getPolicy(policyId)
Expand Down
Loading