feat(buildah_build_task): add INCLUDE_PREFETCH_SBOM and INCLUDE_SOURCE_SBOM policy rules#1674
feat(buildah_build_task): add INCLUDE_PREFETCH_SBOM and INCLUDE_SOURCE_SBOM policy rules#1674polasudo wants to merge 2 commits intoconforma:mainfrom
Conversation
…E_SBOM policy rules Add Conforma policy rules to deny release when INCLUDE_PREFETCH_SBOM or INCLUDE_SOURCE_SBOM is set to "false" on a buildah builder task. This ensures that pipelines cannot silently exclude prefetch or source SBOM content without an explicit policy exception. Follows the same pattern as PRIVILEGED_NESTED and ADD_CAPABILITIES enforcement in the existing buildah_build_task package. These rules are the policy-side counterpart to the new params proposed in konflux-ci/build-definitions#3259, ensuring usage is gated by Conforma before the params can be used in production. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 18 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
You can do a |
|
Note that the "invalid checksum digest length" errors are just cosmetic, you don't have to fix those. (But see EC-1679. |
|
Also you'll need to run |
|
Looks pretty good otherwise. |
Group SBOM deny rules with other deny rules to fix messy-rule lint violation. Add regal line-length ignore comments for long expected message strings in tests. Run make generate-docs to include new rule documentation. Assisted-by: Cursor AI Signed-off-by: Martin Polasko <mpolasko@redhat.com> Made-with: Cursor
|
Hi @simonbaird Thanks for review we are now mostly waiting for approval from kflux team so we can merge both PRs |
|
My 2c's . Doesn't PREFETCH_SBOM and SOURCE_SBOM in Konflux's context mean exactly the same thing? I think we need to be aligned with the correct terminology: https://www.cisa.gov/resources-tools/resources/types-software-bill-materials-sbom. There's no such thing as a prefetch SBOM, Hermeto produces a source SBOM. My understanding of what AI's notion of SOURCE_SBOM is here is an analyzed SBOM, because IIUC we only run Syft on the produced artifacts to enhance the source SBOM from Hermeto to make it a more complex and more accurate byproduct. |
Summary
Add Conforma policy rules to the
buildah_build_taskpackage that deny release whenINCLUDE_PREFETCH_SBOMorINCLUDE_SOURCE_SBOMis set to"false"on a buildah builder task.This ensures pipelines cannot silently exclude prefetch or source SBOM content from a hermetic build without an explicit policy exception.
Context
konflux-ci/build-definitions#3259 proposes adding
INCLUDE_PREFETCH_SBOMandINCLUDE_SOURCE_SBOMoptional params to thebuildah-oci-tatask. Both default to"true"for backward compatibility.During review, @chmeliik noted that:
This PR provides that policy gate.
Why these params exist
In Yarn workspace monorepos, Hermeto/Cachi2 resolves the root
yarn.lockwhen prefetching for any workspace path, producing a prefetch SBOM that covers all workspaces — not just the target. This is a known limitation of Yarn workspace resolution in Hermeto (not a general monorepo behavior). Each plugin image ends up with dependencies from sibling workspaces in its SBOM, causing:The params allow pipelines to opt out of prefetch/source SBOM merging while preserving hermetic build guarantees. The hermetic build still runs — only the SBOM merge step is affected.
Design
Follows the exact same pattern as existing
buildah_build_taskrules (PRIVILEGED_NESTED,ADD_CAPABILITIES,PLATFORM):INCLUDE_PREFETCH_SBOM == "false"orINCLUDE_SOURCE_SBOM == "false""true", no violation is raisedredhatcollectionPipelines that legitimately need
false(e.g. RHDH's Yarn monorepo) must configure a policy exception.Tests
test_include_prefetch_sbom_false— denies when param is"false"test_include_prefetch_sbom_true— passes when param is"true"test_include_prefetch_sbom_missing— passes when param is absenttest_include_source_sbom_false— denies when param is"false"test_include_source_sbom_true— passes when param is"true"test_include_both_sbom_false— denies both violations simultaneouslyRelated: konflux-ci/build-definitions#3259, RHIDP-11640
Made with Cursor