From a5251bf2d2f688b0bbeb6343f357b5b8d5d6efa8 Mon Sep 17 00:00:00 2001 From: Stefano Pentassuglia Date: Tue, 2 Sep 2025 15:19:18 +0200 Subject: [PATCH] Add Conforma Workflow high level diagram This commit adds a new section in the user guide, named Diagrams. The purpose of this section is to collect several diagrams to capture the high-level workflows and architecture of the Conforma project. The first diagram outlines the workflow of Conforma within the Konflux pipelines, with detailed descriptions for each step. Assisted by: Claude Code Ref: https://issues.redhat.com/browse/EC-1270 --- CLAUDE.md | 50 +++++++ .../ROOT/pages/diagram-conforma-workflow.adoc | 130 ++++++++++++++++++ modules/ROOT/partials/contents.adoc | 4 + 3 files changed, 184 insertions(+) create mode 100644 CLAUDE.md create mode 100644 modules/ROOT/pages/diagram-conforma-workflow.adoc diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..72427d4 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,50 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +This is the Conforma User Guide repository, which contains documentation for Conforma (a supply chain security tool) written in AsciiDoc and built with Antora. The published documentation is available at https://conforma.dev/docs/user-guide/. + +## Common Commands + +### Documentation Preview +```bash +make ec-docs-preview +``` +Builds a preview of the documentation by cloning the main docs repository and building the site with local changes. Note: This requires the `../conforma.github.io/antora` directory structure and dependencies. + +### Screenshot Management +```bash +bin/screenshot-helper.sh # Helper script for taking screenshots +bin/screenshot-pruner.sh # Script to clean up unused screenshots +``` + +## Repository Structure + +- `antora.yml` - Antora configuration file defining the documentation component +- `modules/ROOT/` - Main documentation module containing: + - `pages/` - AsciiDoc documentation files + - `images/` - Screenshot and image assets + - `partials/` - Reusable AsciiDoc content snippets + - `nav.adoc` - Navigation structure definition +- `bin/` - Utility scripts for documentation maintenance +- `Makefile` - Build automation for documentation preview + +## Content Organization + +The documentation is structured as follows: +- Getting Started guides (configuration, setup) +- How-to guides (Cosign usage, CLI usage, custom configurations) +- Reference material (SLSA integration, glossary) +- Troubleshooting guides (reproducing Konflux reports) + +## Key Files + +- `modules/ROOT/nav.adoc` - Defines the documentation navigation structure +- `modules/ROOT/partials/contents.adoc` - Contains the main content navigation menu +- Individual `.adoc` files in `pages/` contain the actual documentation content + +## Development Notes + +This is a documentation-only repository using Antora static site generator. Changes to `.adoc` files will be reflected in the published documentation after the preview build process. \ No newline at end of file diff --git a/modules/ROOT/pages/diagram-conforma-workflow.adoc b/modules/ROOT/pages/diagram-conforma-workflow.adoc new file mode 100644 index 0000000..7d903a2 --- /dev/null +++ b/modules/ROOT/pages/diagram-conforma-workflow.adoc @@ -0,0 +1,130 @@ += Conforma Workflow Diagram + +The Conforma workflow operates within the Konflux supply chain security ecosystem, where it validates build artifacts and enforces security policies at critical checkpoints throughout the CI/CD process. Each numbered step in the diagram represents a key phase in this validation workflow. + +[mermaid] +.... +flowchart TD + + subgraph s6["IT PipelineRun"] + n7["Conforma task"]:::conforma + end + + subgraph s7["Release PipelineRun"] + n10["Conforma task"]:::conforma + end + + subgraph s2["Openshift build cluster"] + n1["Build PipelineRun"]:::pipeline + n6["Snapshot"]:::cluster_res + n9["KNative Conforma Controller"]:::cluster_res + decisionId{"VSA present?"}:::white + s6:::pipeline + s7:::pipeline + end + s2:::openshift + + subgraph s5["Build artifacts"] + n3["SBOM"]:::artifact + n4["Provenance Attestation"]:::artifact + n5["Component manifest"]:::artifact + end + s5:::artifacts_group + + subgraph s3["Quay.io"] + s5 + end + s3:::instance + + subgraph s4["Rekor"] + n8["VSA Attestation"]:::artifact + end + s4:::instance + + subgraph s1["Konflux"] + n2["Component"]:::component + s2 + s3 + s4 + end + s1:::konflux + + n2 -- "1 - CI events trigger build" --> n1 + n1 -- "2 - Pipeline produces artifacts" --> s5 + n1 -- "3 - Pipeline completion triggers Snapshot creation" --> n6 + n6 -- "4 - Snapshot creation triggers Conforma Controller" --> n9 + n9 -. "5 - Controller validates Snapshot and build artifacts" .-> s5 + n9 -- "6 - Controller produces VSA" --> n8 + n6 -- "7 - Snapshot creation triggers Integration Tests" --> s6 + decisionId -. NO: validate Snapshot and build artifacts .-> s5 + decisionId -. YES: return output from VSA .-> n8 + n7 -- "8 - Conforma validates the Build artifacts" --> decisionId + n2 -- "9 - Trigger release" --> s7 + n10 -- "10 - Conforma gates the Release" --> decisionId + + subgraph s8["Legend"] + n11["Pipeline"]:::pipeline + n12["Openshift resource / Manifest / Artifact"]:::artifact + n13["Instance"]:::instance + n14["Conforma"]:::conforma + n15[" "] + n16[" "] + n17[" "] + n18[" "] + end + s8:::white + + n15 -- "Next step" --> n16 + n17 -. "Step run against artifact" .-> n18 + + classDef konflux stroke:#000000,fill:#b0a3c4 + classDef openshift stroke:#000000,fill:#ffffff + classDef pipeline stroke:#000000,fill:#dbd0ea + classDef instance stroke:#000000,fill:#ffffff + classDef cluster_res stroke:#000000,fill:#ab1e35,color:white + classDef artifact stroke:#000000,fill:#ab1e35,color:white + classDef conforma stroke:#000000,fill:#614d89,color:white + classDef white stroke:#000000,fill:#ffffff + classDef artifacts_group stroke:#000000,fill:#f8c6c9 + classDef component stroke:#000000,fill:#ffffff +.... + +== 1 - CI events trigger build + +The workflow begins when continuous integration events occur within a Konflux Component. These events include code commits, pull requests, or manual triggers that initiate the build process. When a developer pushes code changes to a repository that is configured as a Konflux Component, the system automatically detects these changes and triggers a Build PipelineRun. This pipeline is responsible for compiling the source code into container images and other distributable artifacts. The Component represents the logical unit of software being built, while the Build PipelineRun is the actual execution context that will orchestrate all the build tasks, including compilation, testing, and artifact generation. + +== 2 - Pipeline produces artifacts + +During the Build PipelineRun execution, the pipeline generates several critical build artifacts that will later be used for security validation. The primary artifacts include the Software Bill of Materials (SBOM), which is a comprehensive inventory of all software components and dependencies used in the build; the Provenance Attestation, which provides cryptographic proof of how the software was built, including build environment details, source code references, and build parameters; and the Component manifest, which describes the metadata and configuration of the built component. These artifacts are automatically generated by approved Konflux build tasks and are stored in Quay.io, Red Hat's container registry. The SBOM uses the CycloneDX format and contains detailed information about all packages, libraries, and dependencies, while the provenance attestation follows the SLSA (Supply-chain Levels for Software Artifacts) specification to ensure build integrity and traceability. + +== 3 - Pipeline completion triggers Snapshot creation + +Once the Build PipelineRun completes successfully, the system automatically creates a Snapshot resource. The Snapshot represents a point-in-time capture of all components within an Application, including the newly built component and its associated artifacts. This Snapshot serves as an immutable reference to the specific versions of all components that will undergo testing and potentially be released together. The Snapshot creation is a crucial step because it establishes the exact artifact versions that will be validated by Conforma and other security tools. It includes references to the container images stored in Quay.io, along with their cryptographic digests, ensuring that the artifacts cannot be tampered with after this point. + +== 4 - Snapshot creation triggers Conforma Controller + +The creation of a new Snapshot automatically triggers the KNative Conforma Controller, which is a Kubernetes controller running within the OpenShift build cluster. This controller is responsible for orchestrating the security validation process for all artifacts referenced in the Snapshot. The controller monitors Snapshot creation events and initiates the Conforma validation workflow whenever new artifacts need to be evaluated. + +== 5 - Controller validates Snapshot and build artifacts + +The Conforma Controller performs a comprehensive validation of the Snapshot and its associated build artifacts by executing the 'ec validate image' command from the Conforma CLI tool. This validation process involves downloading and inspecting the SBOM, provenance attestations, and container images from Quay.io. The controller verifies the cryptographic signatures on these artifacts using Cosign and validates that they were produced by trusted build processes. It checks the SBOM for known vulnerabilities, validates that all dependencies come from approved sources, and ensures that the provenance attestation correctly describes the build process. The controller also verifies that all required build tasks were executed and that the build environment met the necessary security requirements, such as running in a hermetic (network-isolated) environment when required for release builds. + +== 6 - Controller produces VSA + +Upon validation of the build artifacts, the Conforma Controller generates a Verification Summary Attestation (VSA). The VSA is a cryptographically signed document that contains the complete output of the policy bundle evaluation, including all successes, warnings, and violations found during the validation process. It includes comprehensive information about which policies were evaluated, all validation results regardless of their severity, and references to the specific artifacts that were validated. This attestation is stored in Rekor, the transparency log component of Sigstore, ensuring that the validation results are tamper-evident and publicly verifiable. The VSA serves as a complete record of the security evaluation that can be processed by downstream validation tasks. + +== 7 - Snapshot creation triggers Integration Tests + +In parallel with the Conforma validation process, the creation of the Snapshot also triggers Integration Test PipelineRuns. These integration tests are designed to validate the functional correctness and compatibility of the components in the Snapshot. Integration Test Scenarios are automatically created for every Application and include both functional tests and policy validation tests. The integration test pipeline executes various test suites to ensure that the software works correctly in realistic deployment scenarios and that it integrates properly with other system components. + +== 8 - Conforma validates the Build artifacts + +During the Integration Test PipelineRun, a dedicated Conforma task is executed that includes a decision point to check whether a VSA attestation already exists for the current Snapshot. If a VSA is present from the earlier controller validation (step 6), the task processes the VSA content and applies the current policy configuration to determine which results (successes, warnings, violations) are relevant for this specific validation context. If the VSA contains relevant violations based on the applied policy configuration, the Conforma task fails. If no VSA is present, the task executes the same 'ec validate image' command that the controller uses, but applies the policy configuration to consider only the relevant subset of results for the final pass/fail determination. This approach ensures consistent validation while allowing different policy configurations to focus on different aspects of the security evaluation. + +== 9 - Trigger release + +When a development team is ready to release their software, they initiate a release process by creating a Release resource that references the validated Snapshot. This action triggers a Release PipelineRun, which is responsible for promoting the validated artifacts from the development environment to production or customer-facing registries. The release process is only initiated for Snapshots that have successfully passed all integration tests and security validations, ensuring that only high-quality, secure software is released. + +== 10 - Conforma gates the Release + +The final step in the workflow occurs during the Release PipelineRun, where Conforma acts as a security gate that must be passed before the release can proceed. Similar to step 8, this involves a Conforma task that checks for the presence of a VSA attestation. If a VSA exists, the task processes the VSA content and applies the release policy configuration to determine if there are any relevant violations that would block the release. If the VSA contains violations that are relevant to the release policy configuration, the release process is blocked. If no VSA is present, the task performs the same validation as the controller by executing 'ec validate image', but only considers the subset of results that are relevant according to the release policy configuration. If this validation reveals relevant violations, the release process is blocked, preventing potentially insecure or non-compliant software from being released to customers. This final validation step ensures that all released software meets the specific security and compliance requirements defined for the release process. \ No newline at end of file diff --git a/modules/ROOT/partials/contents.adoc b/modules/ROOT/partials/contents.adoc index 90868e0..8c5fbde 100644 --- a/modules/ROOT/partials/contents.adoc +++ b/modules/ROOT/partials/contents.adoc @@ -12,4 +12,8 @@ * xref:slsa.adoc[Conforma & SLSA] +* Diagrams +** xref:diagram-conforma-workflow.adoc[Conforma Workflow Diagram] + + * xref:glossary.adoc[Glossary]