github.com/wolfi-dev/wolfictl@v0.16.11/pkg/configs/advisory/v2/fixed.go (about)

     1  package v2
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/wolfi-dev/wolfictl/pkg/versions"
     7  )
     8  
     9  // Fixed is an event that indicates that a vulnerability has been remediated in
    10  // an updated version of the distribution package.
    11  type Fixed struct {
    12  	// FixedVersion is the version of the distribution package that contains
    13  	// the fix to the vulnerability.
    14  	FixedVersion string `yaml:"fixed-version"`
    15  }
    16  
    17  // Validate returns an error if the Fixed data is invalid.
    18  func (f Fixed) Validate() error {
    19  	if f.FixedVersion == "" {
    20  		return fmt.Errorf("fixed version cannot be empty")
    21  	}
    22  
    23  	if err := versions.ValidateWithEpoch(f.FixedVersion); err != nil {
    24  		return fmt.Errorf("invalid fixed version: %w", err)
    25  	}
    26  
    27  	return nil
    28  }