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

Enhancement to handle arboretum fetcher-built OSCO evidence as input #311

Merged
merged 3 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 5 additions & 0 deletions tests/data/tasks/osco/demo-osco-to-oscal-fetcher.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[task.osco-to-oscal]

input-dir = tests/data/tasks/osco/input-fetcher
output-dir = tests/data/tasks/osco/runtime
output-overwrite = true
64 changes: 64 additions & 0 deletions tests/data/tasks/osco/input-fetcher/cluster_resource.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"resources": [
{
"apiVersion": "v1",
"bogus": {
"exit-code": "2",
"results": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"kind": "ConfigMap",
"metadata": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"name": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"resources": [
{
"apiVersion": "v1",
"data": {
"exit-code": "2",
"results": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"bogus": "ConfigMap",
"metadata": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"name": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"resources": [
{
"apiVersion": "v1",
"data": {
"exit-code": "2",
"results": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"kind": "bogus",
"metadata": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"name": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"resources": [
{
"apiVersion": "v1",
"data": {
"exit-code": "2",
"results": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"kind": "ConfigMap",
"bogus": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"name": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"resources": [
{
"apiVersion": "v1",
"data": {
"exit-code": "2",
"results": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"kind": "ConfigMap",
"metadata": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"bogus": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"bogus": [
{
"apiVersion": "v1",
"data": {
"exit-code": "2",
"results": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"kind": "ConfigMap",
"metadata": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"name": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"iks": {
"demo2020": [
{
"account": "demo2020",
"name": "compliance-dev-dal10",
"region": "us-south",
"resources": [
{
"apiVersion": "v1",
"data": {
"exit-code": "2",
"bogus": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestResult></TestResult>"
},
"kind": "ConfigMap",
"metadata": {
"annotations": {
"compliance-remediations/processed": "",
"compliance.openshift.io/scan-error-msg": "",
"compliance.openshift.io/scan-result": "NON-COMPLIANT",
"openscap-scan-result/node": "111.222.333.444"
},
"creationTimestamp": "2020-08-03T02:26:34Z",
"labels": {
"compliance-scan": "ssg-ocp4-ds-cis"
},
"name": "ssg-ocp4-ds-cis-111.222.333.444-pod",
"namespace": "openshift-compliance",
"resourceVersion": "22693328",
"selfLink": "/api/v1/namespaces/openshift-compliance/configmaps/ssg-ocp4-ds-cis-111.222.333.444-pod",
"uid": "1da3ea81-0a25-4512-ad86-7ac360246b5d"
}
}
]
}
]
}
}

55 changes: 55 additions & 0 deletions tests/data/tasks/osco/input-fetcher/oscal-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

ssg-ocp4-ds-cis-111.222.333.444-pod:
locker: https://github.mycorp.com/degenaro/evidence-locker
namespace: xccdf
subject-references:
component:
uuid-ref: 56666738-0f9a-4e38-9aac-c0fad00a5821
type: component
title: Red Hat OpenShift Kubernetes
inventory-item:
uuid-ref: 46aADFAC-A1fd-4Cf0-a6aA-d1AfAb3e0d3e
type: inventory-item
title: Pod
properties:
target: kube-br7qsa3d0vceu2so1a90-roksopensca-default-0000026b.iks.mycorp
cluster-name: ROKS-OpenSCAP-1
cluster-type: openshift
cluster-region: us-south

ssg-ocp4-ds-cis-111.222.333.555-pod:
locker: https://github.mycorp.com/degenaro/evidence-locker
namespace: xccdf
subject-references:
component:
uuid-ref: 3e42fa6b-a819-4f58-b073-a04a0b3c828d
type: component
title: Red Hat OpenShift Kubernetes
inventory-item:
uuid-ref: 285d87c2-aab0-4935-b28b-c4dab131cf88
type: inventory-item
title: Pod
properties:
target: kube-br7qsa3d0vceu2so1a90-roksopensca-default-000001fe.iks.mycorp
cluster-name: ROKS-OpenSCAP-1
cluster-type: openshift
cluster-region: us-south

ssg-rhel7-ds-cis-111.222.333.444-pod:
locker: https://github.mycorp.com/degenaro/evidence-locker
namespace: xccdf
subject-references:
component:
uuid-ref: 89cfe7a7-ce6b-4699-aa7b-2f5739c72001
type: component
title: RedHat Enterprise Linux 7.8
inventory-item:
uuid-ref: 46aADFAC-A1fd-4Cf0-a6aA-d1AfAb3e0d3e
type: inventory-item
title: VM
properties:
target: kube-br7qsa3d0vceu2so1a90-roksopensca-default-0000026b.iks.mycorp
cluster-name: ROKS-OpenSCAP-1
cluster-type: openshift
cluster-region: us-south

Loading