Skip to content

Commit 8ccd0cc

Browse files
authored
Merge pull request #1557 from brunoapimentel/rebrand-cachi2
Rebrand cachi2 in the 'Allowed package sources' rego
2 parents b67712a + 7de5cab commit 8ccd0cc

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

antora/docs/modules/ROOT/pages/packages/release_sbom_cyclonedx.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Confirm the CycloneDX SBOM contains only packages with explicitly allowed extern
3535
[#sbom_cyclonedx__allowed_package_sources]
3636
=== link:#sbom_cyclonedx__allowed_package_sources[Allowed package sources]
3737

38-
For each of the components fetched by Cachi2 which define externalReferences of type distribution, verify they are allowed based on the allowed_package_sources rule data key. By default, allowed_package_sources is empty, which means no components with such references are allowed.
38+
For each of the components fetched by Hermeto which define externalReferences of type distribution, verify they are allowed based on the allowed_package_sources rule data key. By default, allowed_package_sources is empty, which means no components with such references are allowed.
3939

4040
*Solution*: Update the image to not use a package from a disallowed source.
4141

4242
* Rule type: [rule-type-indicator failure]#FAILURE#
43-
* FAILURE message: `Package %s fetched by cachi2 was sourced from %q which is not allowed`
43+
* FAILURE message: `Package %s fetched by Hermeto was sourced from %q which is not allowed`
4444
* Code: `sbom_cyclonedx.allowed_package_sources`
4545
* Effective from: `2024-12-15T00:00:00Z`
4646
* https://github.com/conforma/policy/blob/{page-origin-refhash}/policy/release/sbom_cyclonedx/sbom_cyclonedx.rego#L154[Source, window="_blank"]

antora/docs/modules/ROOT/pages/packages/release_sbom_spdx.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Confirm the SPDX SBOM contains only packages with explicitly allowed external re
3535
[#sbom_spdx__allowed_package_sources]
3636
=== link:#sbom_spdx__allowed_package_sources[Allowed package sources]
3737

38-
For each of the packages fetched by Cachi2 which define externalReferences, verify they are allowed based on the allowed_package_sources rule data key. By default, allowed_package_sources is empty, which means no components with such references are allowed.
38+
For each of the packages fetched by Hermeto which define externalReferences, verify they are allowed based on the allowed_package_sources rule data key. By default, allowed_package_sources is empty, which means no components with such references are allowed.
3939

4040
*Solution*: Update the image to not use a package from a disallowed source.
4141

4242
* Rule type: [rule-type-indicator failure]#FAILURE#
43-
* FAILURE message: `Package %s fetched by cachi2 was sourced from %q which is not allowed`
43+
* FAILURE message: `Package %s fetched by Hermeto was sourced from %q which is not allowed`
4444
* Code: `sbom_spdx.allowed_package_sources`
4545
* Effective from: `2025-02-17T00:00:00Z`
4646
* https://github.com/conforma/policy/blob/{page-origin-refhash}/policy/release/sbom_spdx/sbom_spdx.rego#L170[Source, window="_blank"]
@@ -80,7 +80,7 @@ Confirm the SPDX SBOM contains only packages without disallowed attributes. By d
8080
* FAILURE message: `Package %s has the attribute %q set%s`
8181
* Code: `sbom_spdx.disallowed_package_attributes`
8282
* Effective from: `2025-02-04T00:00:00Z`
83-
* https://github.com/conforma/policy/blob/{page-origin-refhash}/policy/release/sbom_spdx/sbom_spdx.rego#L215[Source, window="_blank"]
83+
* https://github.com/conforma/policy/blob/{page-origin-refhash}/policy/release/sbom_spdx/sbom_spdx.rego#L216[Source, window="_blank"]
8484

8585
[#sbom_spdx__disallowed_package_external_references]
8686
=== link:#sbom_spdx__disallowed_package_external_references[Disallowed package external references]

policy/release/sbom_cyclonedx/sbom_cyclonedx.rego

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ deny contains result if {
154154
# METADATA
155155
# title: Allowed package sources
156156
# description: >-
157-
# For each of the components fetched by Cachi2 which define externalReferences of type
157+
# For each of the components fetched by Hermeto which define externalReferences of type
158158
# distribution, verify they are allowed based on the allowed_package_sources rule data
159159
# key. By default, allowed_package_sources is empty, which means no components with such
160160
# references are allowed.
161161
# custom:
162162
# short_name: allowed_package_sources
163-
# failure_msg: Package %s fetched by cachi2 was sourced from %q which is not allowed
163+
# failure_msg: Package %s fetched by Hermeto was sourced from %q which is not allowed
164164
# solution: Update the image to not use a package from a disallowed source.
165165
# collections:
166166
# - redhat
@@ -175,10 +175,11 @@ deny contains result if {
175175
some reference in component.externalReferences
176176
reference.type == "distribution"
177177

178-
# only look at components fetched by cachi2
178+
# only look at components fetched by Hermeto
179+
# cachi2 is kept here for backwards compatibility
179180
some properties in component.properties
180-
properties.name == "cachi2:found_by"
181-
properties.value == "cachi2"
181+
properties.name in {"hermeto:found_by", "cachi2:found_by"}
182+
properties.value in {"hermeto", "cachi2"}
182183

183184
purl := component.purl
184185
parsed_purl := ec.purl.parse(purl)

policy/release/sbom_cyclonedx/sbom_cyclonedx_test.rego

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ test_allowed_package_sources if {
193193
"code": "sbom_cyclonedx.allowed_package_sources",
194194
"term": "pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz",
195195
# regal ignore:line-length
196-
"msg": `Package pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz fetched by cachi2 was sourced from "https://openssl.org/source/openssl-1.1.0g.tar.gz" which is not allowed`,
196+
"msg": `Package pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz fetched by Hermeto was sourced from "https://openssl.org/source/openssl-1.1.0g.tar.gz" which is not allowed`,
197197
}}
198198

199199
att := json.patch(_sbom_attestation, [
@@ -205,8 +205,8 @@ test_allowed_package_sources if {
205205
"name": "openssl",
206206
"purl": "pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz",
207207
"properties": [{
208-
"name": "cachi2:found_by",
209-
"value": "cachi2",
208+
"name": "hermeto:found_by",
209+
"value": "hermeto",
210210
}],
211211
"externalReferences": [{"type": "distribution", "url": "https://openssl.org/source/openssl-1.1.0g.tar.gz"}],
212212
},
@@ -219,8 +219,8 @@ test_allowed_package_sources if {
219219
"name": "batik-anim",
220220
"purl": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom",
221221
"properties": [{
222-
"name": "cachi2:found_by",
223-
"value": "cachi2",
222+
"name": "hermeto:found_by",
223+
"value": "hermeto",
224224
}],
225225
# regal ignore:line-length
226226
"externalReferences": [{"type": "distribution", "url": "https://repo.maven.apache.org/maven2/org/apache/xmlgraphics/batik-anim/1.9.1/batik-anim-1.9.1.pom"}],
@@ -256,7 +256,7 @@ test_allowed_package_sources_no_rule_defined if {
256256
"code": "sbom_cyclonedx.allowed_package_sources",
257257
"term": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom",
258258
# regal ignore:line-length
259-
"msg": `Package pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom fetched by cachi2 was sourced from "https://repo.maven.apache.org/maven2/org/apache/xmlgraphics/batik-anim/1.9.1/batik-anim-1.9.1.pom" which is not allowed`,
259+
"msg": `Package pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom fetched by Hermeto was sourced from "https://repo.maven.apache.org/maven2/org/apache/xmlgraphics/batik-anim/1.9.1/batik-anim-1.9.1.pom" which is not allowed`,
260260
}}
261261

262262
att := json.patch(_sbom_attestation, [{
@@ -267,8 +267,8 @@ test_allowed_package_sources_no_rule_defined if {
267267
"name": "batik-anim",
268268
"purl": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom",
269269
"properties": [{
270-
"name": "cachi2:found_by",
271-
"value": "cachi2",
270+
"name": "hermeto:found_by",
271+
"value": "hermeto",
272272
}],
273273
# regal ignore:line-length
274274
"externalReferences": [{"type": "distribution", "url": "https://repo.maven.apache.org/maven2/org/apache/xmlgraphics/batik-anim/1.9.1/batik-anim-1.9.1.pom"}],

policy/release/sbom_spdx/sbom_spdx.rego

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ deny contains result if {
170170
# METADATA
171171
# title: Allowed package sources
172172
# description: >-
173-
# For each of the packages fetched by Cachi2 which define externalReferences,
173+
# For each of the packages fetched by Hermeto which define externalReferences,
174174
# verify they are allowed based on the allowed_package_sources rule data
175175
# key. By default, allowed_package_sources is empty, which means no components with such
176176
# references are allowed.
177177
# custom:
178178
# short_name: allowed_package_sources
179-
# failure_msg: Package %s fetched by cachi2 was sourced from %q which is not allowed
179+
# failure_msg: Package %s fetched by Hermeto was sourced from %q which is not allowed
180180
# solution: Update the image to not use a package from a disallowed source.
181181
# collections:
182182
# - redhat
@@ -187,11 +187,12 @@ deny contains result if {
187187
some s in sbom.spdx_sboms
188188
some pkg in s.packages
189189

190-
# only look at components fetched by cachi2
190+
# only look at components fetched by Hermeto
191+
# cachi2 is kept here for backwards compatibility
191192
some annotation in pkg.annotations
192193
properties := json.unmarshal(annotation.comment)
193-
properties.name == "cachi2:found_by"
194-
properties.value == "cachi2"
194+
properties.name in {"hermeto:found_by", "cachi2:found_by"}
195+
properties.value in {"hermeto", "cachi2"}
195196

196197
some externalref in pkg.externalRefs
197198

policy/release/sbom_spdx/sbom_spdx_test.rego

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ test_allowed_package_sources if {
158158
"code": "sbom_spdx.allowed_package_sources",
159159
"term": "pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz",
160160
# regal ignore:line-length
161-
"msg": `Package pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz fetched by cachi2 was sourced from "https://openssl.org/source/openssl-1.1.0g.tar.gz" which is not allowed`,
161+
"msg": `Package pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz fetched by Hermeto was sourced from "https://openssl.org/source/openssl-1.1.0g.tar.gz" which is not allowed`,
162162
}}
163163

164164
att := json.patch(_sbom_attestation, [
@@ -175,8 +175,8 @@ test_allowed_package_sources if {
175175
"referenceLocator": "pkg:generic/openssl@1.1.10g?download_url=https://openssl.org/source/openssl-1.1.0g.tar.gz",
176176
}],
177177
"annotations": [{
178-
"annotator": "Tool: cachi2:jsonencoded",
179-
"comment": "{\"name\":\"cachi2:found_by\",\"value\":\"cachi2\"}",
178+
"annotator": "Tool: hermeto:jsonencoded",
179+
"comment": "{\"name\":\"hermeto:found_by\",\"value\":\"hermeto\"}",
180180
"annotationDate": "2024-12-09T12:00:00Z",
181181
"annotationType": "OTHER",
182182
}],
@@ -197,8 +197,8 @@ test_allowed_package_sources if {
197197
"referenceLocator": "pkg:maven/org.apache.xmlgraphics/batik-anim@1.9.1?type=pom&download_url=https://repo.maven.apache.org/maven2/org/apache/xmlgraphics/batik-anim/1.9.1/batik-anim-1.9.1.pom",
198198
}],
199199
"annotations": [{
200-
"annotator": "Tool: cachi2:jsonencoded",
201-
"comment": "{\"name\":\"cachi2:found_by\",\"value\":\"cachi2\"}",
200+
"annotator": "Tool: hermeto:jsonencoded",
201+
"comment": "{\"name\":\"hermeto:found_by\",\"value\":\"hermeto\"}",
202202
"annotationDate": "2024-12-09T12:00:00Z",
203203
"annotationType": "OTHER",
204204
}],
@@ -218,7 +218,7 @@ test_allowed_package_sources if {
218218
"referenceLocator": "pkg:generic/unrelated?download_url=https://irrelevant.org",
219219
}],
220220
"annotations": [{
221-
"annotator": "Tool: cachi2:jsonencoded",
221+
"annotator": "Tool: hermeto:jsonencoded",
222222
"comment": "{\"name\":\"irrelevant\",\"value\":\"im-irrelevant\"}",
223223
"annotationDate": "2024-12-09T12:00:00Z",
224224
"annotationType": "OTHER",

0 commit comments

Comments
 (0)