-
Notifications
You must be signed in to change notification settings - Fork 43
feat: add --attestation-format flag to support multiple VSA output formats #3080
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
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
cmd/validate/image.go
Outdated
| break | ||
| } | ||
| } | ||
| if !formatValid { |
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.
Consider moving the validation to PreRunE.
PreRunE: func(cmd *cobra.Command, args []string) error {
if data.vsaEnabled {
if !slices.Contains([]string{"dsse", "predicate"}, data.vsaFormat) {
return fmt.Errorf("invalid --vsa-format: %s (valid: dsse, predicate)", data.vsaFormat)
}
if data.vsaFormat == "dsse" && data.vsaSigningKey == "" {
return fmt.Errorf("--vsa-signing-key required for --vsa-format=dsse")
}
if data.vsaFormat == "predicate" && data.vsaSigningKey != "" {
log.Warn("--vsa-signing-key is ignored for --vsa-format=predicate")
}
}
return nil
}|
/ok-to-test |
|
/ok-to-test |
|
Might need to rebase with |
Add support for generating VSAs in different formats to enable flexible signing workflows. The new --vsa-format flag accepts two values: - "dsse" (default): Generates complete DSSE envelope with signature (existing behavior, requires --vsa-signing-key) - "predicate": Generates raw VSA predicate JSON without signature (new capability, enables downstream signing with correct subject) This addresses the challenge in release pipelines where images are validated before being pushed to destination registries. With predicate format, validation can generate unsigned VSAs that are later signed with the correct image location after the push completes. The implementation maintains backward compatibility by defaulting to "dsse" format and reuses existing VSA generation functions. Format validation ensures only supported values are accepted. Updated verify-conforma-konflux-ta task to support VSA generation with parameters for format selection, signing key configuration, and trusted artifact storage integration. Assisted-by: Claude Code (Sonnet 4.5)
…apshots Address PR feedback by improving error handling in extractLocalPath() and fixing acceptance test snapshot to include new VSA_GENERATED result field. Changes: - Modify extractLocalPath() to return error instead of defaulting to /tmp/vsa when no local@ path is found, preventing silent data loss - Update acceptance test snapshot to include VSA_GENERATED result field added by the VSA format feature - Update auto-generated documentation for verify-conforma-konflux-ta task The security concern about arbitrary file writes is a false positive - the CLI runs with user permissions and the user explicitly controls the destination path, similar to mkdir or cp commands. Assisted-by: Claude Code (Sonnet 4.5)
Rename the two new attestation parameters introduced in this PR to use generic naming that supports future verification attestation types (e.g., Simple Verification Result/SVR) without breaking changes. Changes: - Rename --vsa-format to --attestation-format - Rename --vsa-output-dir to --attestation-output-dir - Move format/signing-key validation from RunE to PreRunE per review feedback - Add comprehensive test coverage for path validation and error handling - Fix Writer to handle both temp directory prefixes and absolute paths - Add path traversal protection (restrict output to /tmp or workspace) These flags were introduced in this PR and have not been released, making this rename non-breaking. Existing VSA flags (--vsa, --vsa-signing-key, --vsa-upload, --vsa-expiration) remain unchanged. Security: Validates output paths to prevent writing to arbitrary filesystem locations. While this is a CLI tool running with user permissions, the validation provides defense-in-depth for CI/CD environments. Addresses PR feedback from Joe Stuart on PreRunE validation pattern. Assisted-by: Claude Code (Sonnet 4.5)
Tests were still using the old flag name --vsa-output-dir instead of --attestation-output-dir, causing CI failures. Assisted-by: Claude Code (Sonnet 4.5)
b20c120 to
f29560c
Compare
|
/ok-to-test |
User description
Add support for generating VSAs in different formats to enable flexible signing workflows. The new --attestation-format flag accepts two values:
This addresses the challenge in release pipelines where images are validated before being pushed to destination registries. With predicate format, validation can generate unsigned VSAs that are later signed with the correct image location after the push completes.
The implementation maintains backward compatibility by defaulting to "dsse" format and reuses existing VSA generation functions. Format validation ensures only supported values are accepted.
Updated verify-conforma-konflux-ta task to support VSA generation with parameters for format selection, signing key configuration, and trusted artifact storage integration.
Assisted-by: Claude Code (Sonnet 4.5)
PR Type
Enhancement
Description
Add
--vsa-formatflag supporting "dsse" (signed envelope) and "predicate" (raw JSON) formatsEnable unsigned VSA predicate generation for downstream signing workflows
Implement format validation with appropriate signing key requirements
Update verify-conforma-konflux-ta task with VSA parameters and trusted artifact integration
Diagram Walkthrough
flowchart LR A["VSA Generation"] --> B{VSA Format} B -->|"dsse"| C["DSSE Envelope<br/>with Signature"] B -->|"predicate"| D["Raw Predicate<br/>JSON"] C --> E["Upload to Storage"] D --> F["Downstream Signing"] E --> G["Signed Attestation"] F --> GFile Walkthrough
image.go
Implement VSA format flag with dual code pathscmd/validate/image.go
vsaFormatfield to command data structure with default value"dsse"
"predicate" values
approach, predicate path generates raw JSON
extractLocalPath()helper function to parse VSA uploadspecifications
verify-conforma-konflux-ta.yaml
Extend task with VSA parameters and trusted artifact supporttasks/verify-conforma-konflux-ta/0.1/verify-conforma-konflux-ta.yaml
ENABLE_VSA,VSA_FORMAT,VSA_SIGNING_KEY,VSA_UPLOAD,ociStorageVSA_GENERATED,sourceDataArtifactconditional VSA argument construction
create-trusted-artifactstep for storing VSA files in OCIstorage
image_test.go
Add comprehensive VSA format flag testscmd/validate/image_test.go
ec_validate_image.adoc
Document --vsa-format flag in CLI referencedocs/modules/ROOT/pages/ec_validate_image.adoc
--vsa-formatflag with description of supported valuesraw JSON