- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38
feat(crafting-schema): support schema v2 during attestation process #2468
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
          
     Merged
      
      
            Piskoo
  merged 7 commits into
  chainloop-dev:main
from
Piskoo:feat-handle-schema-v2-during-attestation-process
  
      
      
   
  Oct 28, 2025 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            7 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      0b91e51
              
                handle schema v2 during attestation process
              
              
                Piskoo 08e0968
              
                fix schema used in att init
              
              
                Piskoo 8f25fd9
              
                add tests
              
              
                Piskoo b6376c2
              
                fix test
              
              
                Piskoo 97bbeaf
              
                missing test data
              
              
                Piskoo 3e13c67
              
                move helpers
              
              
                Piskoo 735a7f9
              
                lint
              
              
                Piskoo File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| schemaVersion: v1 | ||
| # Arbitrary set of annotations can be added to the contract and will be part of the attestation | ||
| annotations: | ||
| - name: version | ||
| value: oss # if the value is left empty, it will be required and resolved at attestation time | ||
| # Three required and one optional materials of three different kinds | ||
| materials: | ||
| # CONTAINER_IMAGE kinds will get resolved to retrieve their repository digest | ||
| - type: CONTAINER_IMAGE | ||
| name: skynet-control-plane | ||
| # The output flag indicates that the material will be part of the attestation subject | ||
| output: true | ||
| # Arbitrary annotations can be added to the material | ||
| annotations: | ||
| - name: component | ||
| value: control-plane | ||
| # The value can be left empty so it can be provided at attestation time | ||
| - name: asset | ||
| # ARTIFACT kinds will first get uploaded to your artifact registry via the built-in Content Addressable Storage (CAS) | ||
| - type: ARTIFACT | ||
| name: rootfs | ||
| # Optional dockerfile | ||
| - type: ARTIFACT | ||
| name: dockerfile | ||
| optional: true | ||
| # SBOMs will be uploaded to the artifact registry and referenced in the attestation | ||
| # Both SBOM_CYCLONEDX_JSON and SBOM_SPDX_JSON are supported | ||
| - type: SBOM_CYCLONEDX_JSON | ||
| name: skynet-sbom | ||
| # CSAF_VEX and OPENVEX are supported | ||
| - type: OPENVEX | ||
| name: disclosure | ||
| # And static analysis reports in SARIF format | ||
| - type: SARIF | ||
| name: static-out | ||
| # STRING kind materials will be injected as simple keypairs | ||
| - type: STRING | ||
| name: build-ref | ||
|  | ||
| # Env vars we want the system to resolve and inject during attestation initialization | ||
| # Additional ones can be inherited from the specified runner context below | ||
| envAllowList: | ||
| - CUSTOM_VAR | ||
|  | ||
| # Enforce in what runner context the attestation must happen | ||
| # If not specified, the attestation crafting process is allowed to run anywhere | ||
| runner: | ||
| type: "GITHUB_ACTION" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| apiVersion: chainloop.dev/v1 | ||
| kind: Contract | ||
| metadata: | ||
| name: test-contract-v2 | ||
| description: Test contract in V2 format | ||
| annotations: | ||
| version: "1.0.0" | ||
| team: test-team | ||
| spec: | ||
| materials: | ||
| - type: CONTAINER_IMAGE | ||
| name: skynet-control-plane | ||
| output: true | ||
| annotations: | ||
| - name: component | ||
| value: control-plane | ||
| - type: ARTIFACT | ||
| name: rootfs | ||
| - type: SBOM_CYCLONEDX_JSON | ||
| name: skynet-sbom | ||
| - type: STRING | ||
| name: build-ref | ||
| optional: true | ||
| envAllowList: | ||
| - CUSTOM_VAR | ||
| - BUILD_NUMBER | ||
| runner: | ||
| type: GITHUB_ACTION | ||
| policies: | ||
| materials: | ||
| - ref: file://policy1.yaml | ||
| - ref: file://policy2.yaml | ||
| attestation: | ||
| - ref: file://attestation-policy.yaml | ||
| policyGroups: | ||
| - ref: file://testdata/policy_group.yaml | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make sure to add comments in the PR about the non obvious things, this change is quite puzzling, thanks
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, PolicyVerifier and PolicyGroupVerifier constructor was changed to take crafting schema policies and crafting schema policy groups and policies respectively, these were the only fields of crafting schema that were used. As consequence, the evaluation tool that previously was building the whole schema just to pass it to PolicyVerifier contructor, was changed as well. Rename in highlighted code is related to renaming function that was previously building the schema.