mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-05 21:44:15 -04:00
config: disable user-facing version Azure SEV SNP fetch for v2.8 (#1882)
* config: disable user-facing version fetch for Azure SEV SNP don't allow "latest" value and disable user-facing version fetcher for Azure SEV SNP Co-authored-by: @derpsteb * fix unittests * attestation: getTrustedKey --------- Co-authored-by: Otto Bittner <cobittner@posteo.net>
This commit is contained in:
parent
7c07e3be18
commit
c7b22d314a
5 changed files with 121 additions and 48 deletions
|
@ -8,6 +8,7 @@ package config
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -33,7 +34,7 @@ func (v AttestationVersion) MarshalYAML() (any, error) {
|
|||
if v.IsLatest {
|
||||
return "latest", nil
|
||||
}
|
||||
return v.Value, nil
|
||||
return int(v.Value), nil
|
||||
}
|
||||
|
||||
// UnmarshalYAML implements a custom unmarshaller to resolve "atest" values.
|
||||
|
@ -67,13 +68,17 @@ func (v *AttestationVersion) parseRawUnmarshal(rawUnmarshal any) error {
|
|||
switch s := rawUnmarshal.(type) {
|
||||
case string:
|
||||
if strings.ToLower(s) == "latest" {
|
||||
v.IsLatest = true
|
||||
v.Value = placeholderVersionValue
|
||||
} else {
|
||||
return fmt.Errorf("invalid version value: %s", s)
|
||||
// TODO(elchead): activate latest logic for next release AB#3036
|
||||
return errors.New("latest is not supported as a version value")
|
||||
// v.IsLatest = true
|
||||
// v.Value = placeholderVersionValue
|
||||
}
|
||||
return fmt.Errorf("invalid version value: %s", s)
|
||||
case int:
|
||||
v.Value = uint8(s)
|
||||
// yaml spec allows "1" as float64, so version number might come as a float: https://github.com/go-yaml/yaml/issues/430
|
||||
case float64:
|
||||
v.Value = uint8(s)
|
||||
default:
|
||||
return fmt.Errorf("invalid version value type: %s", s)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue