rename to attestationconfig

This commit is contained in:
Adrian Stobbe 2024-09-10 14:07:14 +02:00
parent c28e8fbd43
commit e4bc426dc2
50 changed files with 161 additions and 161 deletions

View File

@ -30,4 +30,4 @@ runs:
COSIGN_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }}
COSIGN_PASSWORD: ${{ inputs.cosignPassword }}
run: |
bazel run //api/attestationconfigapi/internal/cli:cli_e2e_test -- ${{ inputs.attestationVariant }}
bazel run //api/attestationconfig/internal/cli:cli_e2e_test -- ${{ inputs.attestationVariant }}

View File

@ -103,9 +103,9 @@ runs:
absolute_reports="${absolute_reports} $(realpath "${report}")"
done
report=$(bazel run //api/attestationconfigapi/internal/cli -- compare ${{ inputs.attestationVariant }} ${absolute_reports})
report=$(bazel run //api/attestationconfig/internal/cli -- compare ${{ inputs.attestationVariant }} ${absolute_reports})
path=$(realpath "${report}")
cat "${path}"
bazel run //api/attestationconfigapi/internal/cli -- upload ${{ inputs.attestationVariant }} attestation-report "${path}"
bazel run //api/attestationconfig/internal/cli -- upload ${{ inputs.attestationVariant }} attestation-report "${path}"

View File

@ -8,8 +8,8 @@ on:
- "release/**"
paths:
- "internal/api/**"
- "api/attestationconfigapi/**"
- ".github/workflows/e2e-attestationconfigapi.yml"
- "api/attestationconfig/**"
- ".github/workflows/e2e-attestationconfig.yml"
- "go.mod"
jobs:
@ -33,7 +33,7 @@ jobs:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || github.event.pull_request.head.sha || '' }}
- name: Run Attestationconfig API E2E
uses: ./.github/actions/e2e_attestationconfigapi
uses: ./.github/actions/e2e_attestationconfig
with:
cosignPrivateKey: ${{ secrets.COSIGN_DEV_PRIVATE_KEY }}
cosignPassword: ${{ secrets.COSIGN_DEV_PASSWORD }}

View File

@ -2,13 +2,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel/go:go_test.bzl", "go_test")
go_library(
name = "attestationconfigapi",
name = "attestationconfig",
srcs = [
"attestationconfigapi.go",
"attestationconfig.go",
"fetcher.go",
"version.go",
],
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi",
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig",
visibility = ["//:__subpackages__"],
deps = [
"//internal/api/fetcher",
@ -19,12 +19,12 @@ go_library(
)
go_test(
name = "attestationconfigapi_test",
name = "attestationconfig_test",
srcs = [
"fetcher_test.go",
"version_test.go",
],
embed = [":attestationconfigapi"],
embed = [":attestationconfig"],
deps = [
"//internal/attestation/variant",
"//internal/constants",

View File

@ -20,4 +20,4 @@ Thus, existing config types (AWSNitroTPM, AzureSEVSNP, ...) can not be extended
Instead, we need a separate type that wraps _all_ attestation types. In the codebase this is done using the AttestationCfg interface.
The new type AttestationCfgGet needs to be located inside internal/config in order to implement UnmarshalJSON.
*/
package attestationconfigapi
package attestationconfig

View File

@ -4,7 +4,7 @@ Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package attestationconfigapi
package attestationconfig
import (
"context"

View File

@ -3,7 +3,7 @@ Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package attestationconfigapi
package attestationconfig
import (
"bytes"

View File

@ -16,11 +16,11 @@ go_library(
"upload.go",
"validargs.go",
],
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli",
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli",
visibility = ["//visibility:private"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfigapi/internal/cli/client",
"//api/attestationconfig",
"//api/attestationconfig/internal/cli/client",
"//internal/api/fetcher",
"//internal/attestation/variant",
"//internal/constants",

View File

@ -7,10 +7,10 @@ go_library(
"client.go",
"reporter.go",
],
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client",
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client",
visibility = ["//:__subpackages__"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//internal/api/client",
"//internal/attestation/variant",
"//internal/sigstore",
@ -28,7 +28,7 @@ go_test(
],
embed = [":client"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"@com_github_stretchr_testify//assert",
],
)

View File

@ -20,7 +20,7 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go/aws"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
apiclient "github.com/edgelesssys/constellation/v2/internal/api/client"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/sigstore"
@ -75,14 +75,14 @@ func (c Client) DeleteVersion(ctx context.Context, attestation variant.Variant,
}
// List returns the list of versions for the given attestation variant.
func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfigapi.List, error) {
versions, err := apiclient.Fetch(ctx, c.s3Client, attestationconfigapi.List{Variant: attestation})
func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfig.List, error) {
versions, err := apiclient.Fetch(ctx, c.s3Client, attestationconfig.List{Variant: attestation})
if err != nil {
var notFoundErr *apiclient.NotFoundError
if errors.As(err, &notFoundErr) {
return attestationconfigapi.List{Variant: attestation}, nil
return attestationconfig.List{Variant: attestation}, nil
}
return attestationconfigapi.List{}, err
return attestationconfig.List{}, err
}
versions.Variant = attestation
@ -90,10 +90,10 @@ func (c Client) List(ctx context.Context, attestation variant.Variant) (attestat
return versions, nil
}
func (c Client) deleteVersion(versions attestationconfigapi.List, versionStr string) (ops []crudCmd, err error) {
func (c Client) deleteVersion(versions attestationconfig.List, versionStr string) (ops []crudCmd, err error) {
versionStr = versionStr + ".json"
ops = append(ops, deleteCmd{
apiObject: attestationconfigapi.Entry{
apiObject: attestationconfig.Entry{
Variant: versions.Variant,
Version: versionStr,
},
@ -132,19 +132,19 @@ func (c Client) listCachedVersions(ctx context.Context, attestation variant.Vari
return dates, nil
}
func removeVersion(list attestationconfigapi.List, versionStr string) (removedVersions attestationconfigapi.List, err error) {
func removeVersion(list attestationconfig.List, versionStr string) (removedVersions attestationconfig.List, err error) {
versions := list.List
for i, v := range versions {
if v == versionStr {
if i == len(versions)-1 {
removedVersions = attestationconfigapi.List{List: versions[:i], Variant: list.Variant}
removedVersions = attestationconfig.List{List: versions[:i], Variant: list.Variant}
} else {
removedVersions = attestationconfigapi.List{List: append(versions[:i], versions[i+1:]...), Variant: list.Variant}
removedVersions = attestationconfig.List{List: append(versions[:i], versions[i+1:]...), Variant: list.Variant}
}
return removedVersions, nil
}
}
return attestationconfigapi.List{}, fmt.Errorf("version %s not found in list %v", versionStr, versions)
return attestationconfig.List{}, fmt.Errorf("version %s not found in list %v", versionStr, versions)
}
type crudCmd interface {

View File

@ -8,7 +8,7 @@ package client
import (
"testing"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/stretchr/testify/assert"
)
@ -16,19 +16,19 @@ func TestDeleteAzureSEVSNPVersions(t *testing.T) {
sut := Client{
bucketID: "bucket",
}
versions := attestationconfigapi.List{List: []string{"2023-01-01.json", "2021-01-01.json", "2019-01-01.json"}}
versions := attestationconfig.List{List: []string{"2023-01-01.json", "2021-01-01.json", "2019-01-01.json"}}
ops, err := sut.deleteVersion(versions, "2021-01-01")
assert := assert.New(t)
assert.NoError(err)
assert.Contains(ops, deleteCmd{
apiObject: attestationconfigapi.Entry{
apiObject: attestationconfig.Entry{
Version: "2021-01-01.json",
},
})
assert.Contains(ops, putCmd{
apiObject: attestationconfigapi.List{List: []string{"2023-01-01.json", "2019-01-01.json"}},
apiObject: attestationconfig.List{List: []string{"2023-01-01.json", "2019-01-01.json"}},
})
}

View File

@ -16,7 +16,7 @@ import (
"strings"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/api/client"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
)
@ -28,7 +28,7 @@ const cachedVersionsSubDir = "cached-versions"
var ErrNoNewerVersion = errors.New("input version is not newer than latest API version")
func reportVersionDir(attestation variant.Variant) string {
return path.Join(attestationconfigapi.AttestationURLPath, attestation.String(), cachedVersionsSubDir)
return path.Join(attestationconfig.AttestationURLPath, attestation.String(), cachedVersionsSubDir)
}
// IsInputNewerThanOtherVersion compares the input version with the other version and returns true if the input version is newer.
@ -37,13 +37,13 @@ func IsInputNewerThanOtherVersion(variant variant.Variant, inputVersion, otherVe
var result bool
actionForVariant(variant,
func() {
input := inputVersion.(attestationconfigapi.TDXVersion)
other := otherVersion.(attestationconfigapi.TDXVersion)
input := inputVersion.(attestationconfig.TDXVersion)
other := otherVersion.(attestationconfig.TDXVersion)
result = isInputNewerThanOtherTDXVersion(input, other)
},
func() {
input := inputVersion.(attestationconfigapi.SEVSNPVersion)
other := otherVersion.(attestationconfigapi.SEVSNPVersion)
input := inputVersion.(attestationconfig.SEVSNPVersion)
other := otherVersion.(attestationconfig.SEVSNPVersion)
result = isInputNewerThanOtherSEVSNPVersion(input, other)
},
)
@ -64,18 +64,18 @@ func (c Client) UploadLatestVersion(
var err error
actionForVariant(attestationVariant,
func() {
if _, ok := inputVersion.(attestationconfigapi.TDXVersion); !ok {
if _, ok := inputVersion.(attestationconfig.TDXVersion); !ok {
err = fmt.Errorf("input version %q is not a TDX version", inputVersion)
}
if _, ok := latestVersionInAPI.(attestationconfigapi.TDXVersion); !ok {
if _, ok := latestVersionInAPI.(attestationconfig.TDXVersion); !ok {
err = fmt.Errorf("latest API version %q is not a TDX version", latestVersionInAPI)
}
},
func() {
if _, ok := inputVersion.(attestationconfigapi.SEVSNPVersion); !ok {
if _, ok := inputVersion.(attestationconfig.SEVSNPVersion); !ok {
err = fmt.Errorf("input version %q is not a SNP version", inputVersion)
}
if _, ok := latestVersionInAPI.(attestationconfigapi.SEVSNPVersion); !ok {
if _, ok := latestVersionInAPI.(attestationconfig.SEVSNPVersion); !ok {
err = fmt.Errorf("latest API version %q is not a SNP version", latestVersionInAPI)
}
},
@ -181,19 +181,19 @@ func (c Client) findMinVersion(
actionForVariant(attestationVariant,
func() {
getMinimalVersion = func() (any, string, error) {
return findMinimalVersion[attestationconfigapi.TDXVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize)
return findMinimalVersion[attestationconfig.TDXVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize)
}
},
func() {
getMinimalVersion = func() (any, string, error) {
return findMinimalVersion[attestationconfigapi.SEVSNPVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize)
return findMinimalVersion[attestationconfig.SEVSNPVersion](ctx, attestationVariant, versionDates, c.s3Client, c.cacheWindowSize)
}
},
)
return getMinimalVersion()
}
func findMinimalVersion[T attestationconfigapi.TDXVersion | attestationconfigapi.SEVSNPVersion](
func findMinimalVersion[T attestationconfig.TDXVersion | attestationconfig.SEVSNPVersion](
ctx context.Context, variant variant.Variant, versionDates []string,
s3Client *client.Client, cacheWindowSize int,
) (T, string, error) {
@ -233,8 +233,8 @@ type apiVersionObject struct {
version string `json:"-"`
variant variant.Variant `json:"-"`
cached bool `json:"-"`
snp attestationconfigapi.SEVSNPVersion
tdx attestationconfigapi.TDXVersion
snp attestationconfig.SEVSNPVersion
tdx attestationconfig.TDXVersion
}
func (a apiVersionObject) MarshalJSON() ([]byte, error) {
@ -266,7 +266,7 @@ func (a apiVersionObject) JSONPath() string {
if a.cached {
return path.Join(reportVersionDir(a.variant), a.version)
}
return path.Join(attestationconfigapi.AttestationURLPath, a.variant.String(), a.version)
return path.Join(attestationconfig.AttestationURLPath, a.variant.String(), a.version)
}
// ValidateRequest validates the request.
@ -300,10 +300,10 @@ func (a apiVersionObject) getVersion() any {
func (a *apiVersionObject) setVersion(version any) {
actionForVariant(a.variant,
func() {
a.tdx = version.(attestationconfigapi.TDXVersion)
a.tdx = version.(attestationconfig.TDXVersion)
},
func() {
a.snp = version.(attestationconfigapi.SEVSNPVersion)
a.snp = version.(attestationconfig.SEVSNPVersion)
},
)
}
@ -324,7 +324,7 @@ func actionForVariant(
}
// isInputNewerThanOtherSEVSNPVersion compares all version fields and returns false if any input field is older, or the versions are equal.
func isInputNewerThanOtherSEVSNPVersion(input, other attestationconfigapi.SEVSNPVersion) bool {
func isInputNewerThanOtherSEVSNPVersion(input, other attestationconfig.SEVSNPVersion) bool {
if input == other {
return false
}
@ -344,7 +344,7 @@ func isInputNewerThanOtherSEVSNPVersion(input, other attestationconfigapi.SEVSNP
}
// isInputNewerThanOtherSEVSNPVersion compares all version fields and returns false if any input field is older, or the versions are equal.
func isInputNewerThanOtherTDXVersion(input, other attestationconfigapi.TDXVersion) bool {
func isInputNewerThanOtherTDXVersion(input, other attestationconfig.TDXVersion) bool {
if input == other {
return false
}

View File

@ -7,13 +7,13 @@ package client
import (
"testing"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/stretchr/testify/assert"
)
func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) {
newTestCfg := func() attestationconfigapi.SEVSNPVersion {
return attestationconfigapi.SEVSNPVersion{
newTestCfg := func() attestationconfig.SEVSNPVersion {
return attestationconfig.SEVSNPVersion{
Microcode: 93,
TEE: 0,
SNP: 6,
@ -22,12 +22,12 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) {
}
testCases := map[string]struct {
latest attestationconfigapi.SEVSNPVersion
input attestationconfigapi.SEVSNPVersion
latest attestationconfig.SEVSNPVersion
input attestationconfig.SEVSNPVersion
expect bool
}{
"input is older than latest": {
input: func(c attestationconfigapi.SEVSNPVersion) attestationconfigapi.SEVSNPVersion {
input: func(c attestationconfig.SEVSNPVersion) attestationconfig.SEVSNPVersion {
c.Microcode--
return c
}(newTestCfg()),
@ -35,7 +35,7 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) {
expect: false,
},
"input has greater and smaller version field than latest": {
input: func(c attestationconfigapi.SEVSNPVersion) attestationconfigapi.SEVSNPVersion {
input: func(c attestationconfig.SEVSNPVersion) attestationconfig.SEVSNPVersion {
c.Microcode++
c.Bootloader--
return c
@ -44,7 +44,7 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) {
expect: false,
},
"input is newer than latest": {
input: func(c attestationconfigapi.SEVSNPVersion) attestationconfigapi.SEVSNPVersion {
input: func(c attestationconfig.SEVSNPVersion) attestationconfig.SEVSNPVersion {
c.TEE++
return c
}(newTestCfg()),
@ -66,8 +66,8 @@ func TestIsInputNewerThanOtherSEVSNPVersion(t *testing.T) {
}
func TestIsInputNewerThanOtherTDXVersion(t *testing.T) {
newTestVersion := func() attestationconfigapi.TDXVersion {
return attestationconfigapi.TDXVersion{
newTestVersion := func() attestationconfig.TDXVersion {
return attestationconfig.TDXVersion{
QESVN: 1,
PCESVN: 2,
TEETCBSVN: [16]byte{2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
@ -77,12 +77,12 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) {
}
testCases := map[string]struct {
latest attestationconfigapi.TDXVersion
input attestationconfigapi.TDXVersion
latest attestationconfig.TDXVersion
input attestationconfig.TDXVersion
expect bool
}{
"input is older than latest": {
input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion {
input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion {
c.QESVN--
return c
}(newTestVersion()),
@ -90,7 +90,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) {
expect: false,
},
"input has greater and smaller version field than latest": {
input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion {
input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion {
c.QESVN++
c.PCESVN--
return c
@ -99,7 +99,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) {
expect: false,
},
"input is newer than latest": {
input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion {
input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion {
c.QESVN++
return c
}(newTestVersion()),
@ -112,7 +112,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) {
expect: false,
},
"tee tcb svn is newer": {
input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion {
input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion {
c.TEETCBSVN[4]++
return c
}(newTestVersion()),
@ -120,7 +120,7 @@ func TestIsInputNewerThanOtherTDXVersion(t *testing.T) {
expect: true,
},
"xfam is different": {
input: func(c attestationconfigapi.TDXVersion) attestationconfigapi.TDXVersion {
input: func(c attestationconfig.TDXVersion) attestationconfig.TDXVersion {
c.XFAM[3]++
return c
}(newTestVersion()),

View File

@ -10,7 +10,7 @@ import (
"os"
"slices"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client"
"github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/file"
"github.com/edgelesssys/constellation/v2/internal/verify"

View File

@ -15,8 +15,8 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/logger"
"github.com/edgelesssys/constellation/v2/internal/staticupload"
@ -50,7 +50,7 @@ func newDeleteCmd() *cobra.Command {
}
func runDelete(cmd *cobra.Command, args []string) (retErr error) {
log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfigapi")
log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfig")
deleteCfg, err := newDeleteConfig(cmd, ([3]string)(args[:3]))
if err != nil {
@ -86,7 +86,7 @@ func runRecursiveDelete(cmd *cobra.Command, args []string) (retErr error) {
return fmt.Errorf("creating delete config: %w", err)
}
log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfigapi")
log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfig")
client, closeFn, err := staticupload.New(cmd.Context(), staticupload.Config{
Bucket: deleteCfg.bucket,
Region: deleteCfg.region,
@ -102,7 +102,7 @@ func runRecursiveDelete(cmd *cobra.Command, args []string) (retErr error) {
}
}()
deletePath := path.Join(attestationconfigapi.AttestationURLPath, deleteCfg.variant.String())
deletePath := path.Join(attestationconfig.AttestationURLPath, deleteCfg.variant.String())
return deleteEntryRecursive(cmd.Context(), deletePath, client, deleteCfg)
}

View File

@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
/*
This package provides a CLI to interact with the Attestationconfig API, a sub API of the Resource API.
You can execute an e2e test by running: `bazel run //internal/api/attestationconfigapi:configapi_e2e_test`.
You can execute an e2e test by running: `bazel run //internal/api/attestationconfig:configapi_e2e_test`.
The CLI is used in the CI pipeline. Manual actions that change the bucket's data shouldn't be necessary.
The reporter CLI caches the observed version values in a dedicated caching directory and derives the latest API version from it.
Any version update is then pushed to the API.

View File

@ -14,8 +14,8 @@ import (
"os"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi/internal/cli/client"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/api/attestationconfig/internal/cli/client"
"github.com/edgelesssys/constellation/v2/internal/api/fetcher"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/file"
@ -64,7 +64,7 @@ func envCheck(_ *cobra.Command, _ []string) error {
func runUpload(cmd *cobra.Command, args []string) (retErr error) {
ctx := cmd.Context()
log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfigapi")
log := logger.NewTextLogger(slog.LevelDebug).WithGroup("attestationconfig")
uploadCfg, err := newConfig(cmd, ([3]string)(args[:3]))
if err != nil {
@ -103,7 +103,7 @@ func uploadReport(
return fmt.Errorf("kind %s not supported", cfg.kind)
}
apiFetcher := attestationconfigapi.NewFetcherWithCustomCDNAndCosignKey(cfg.url, cfg.cosignPublicKey)
apiFetcher := attestationconfig.NewFetcherWithCustomCDNAndCosignKey(cfg.url, cfg.cosignPublicKey)
latestVersionInAPI, err := apiFetcher.FetchLatestVersion(ctx, cfg.variant)
if err != nil {
var notFoundErr *fetcher.NotFoundError
@ -149,8 +149,8 @@ func uploadReport(
return nil
}
func convertTCBVersionToSNPVersion(tcb verify.TCBVersion) attestationconfigapi.SEVSNPVersion {
return attestationconfigapi.SEVSNPVersion{
func convertTCBVersionToSNPVersion(tcb verify.TCBVersion) attestationconfig.SEVSNPVersion {
return attestationconfig.SEVSNPVersion{
Bootloader: tcb.Bootloader,
TEE: tcb.TEE,
SNP: tcb.SNP,
@ -158,8 +158,8 @@ func convertTCBVersionToSNPVersion(tcb verify.TCBVersion) attestationconfigapi.S
}
}
func convertQuoteToTDXVersion(quote *tdx.QuoteV4) attestationconfigapi.TDXVersion {
return attestationconfigapi.TDXVersion{
func convertQuoteToTDXVersion(quote *tdx.QuoteV4) attestationconfig.TDXVersion {
return attestationconfig.TDXVersion{
QESVN: binary.LittleEndian.Uint16(quote.Header.QeSvn),
PCESVN: binary.LittleEndian.Uint16(quote.Header.PceSvn),
QEVendorID: [16]byte(quote.Header.QeVendorId),

View File

@ -4,7 +4,7 @@ Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package attestationconfigapi
package attestationconfig
import (
"encoding/json"

View File

@ -4,7 +4,7 @@ Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package attestationconfigapi
package attestationconfig
import (
"testing"

View File

@ -55,7 +55,6 @@ go_library(
"//cli/internal/libvirt",
"//cli/internal/terraform",
"//disk-mapper/recoverproto",
"//api/attestationconfigapi",
"//internal/api/fetcher",
"//internal/api/versionsapi",
"//internal/atls",
@ -116,6 +115,7 @@ go_library(
"//internal/attestation/azure/tdx",
"@com_github_google_go_sev_guest//proto/sevsnp",
"@com_github_google_go_tpm_tools//proto/attest",
"//api/attestationconfig",
] + select({
"@io_bazel_rules_go//go/platform:android_amd64": [
"@org_golang_x_sys//unix",
@ -154,7 +154,7 @@ go_test(
],
embed = [":cmd"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//bootstrapper/initproto",
"//cli/internal/cloudcmd",
"//cli/internal/cmd/pathprefix",

View File

@ -21,7 +21,7 @@ import (
"strings"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/cli/internal/cloudcmd"
"github.com/edgelesssys/constellation/v2/internal/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/atls"
@ -268,7 +268,7 @@ func runApply(cmd *cobra.Command, _ []string) error {
defer cancel()
cmd.SetContext(ctx)
return apply.apply(cmd, attestationconfigapi.NewFetcher(), upgradeDir)
return apply.apply(cmd, attestationconfig.NewFetcher(), upgradeDir)
}
type applyCmd struct {
@ -356,7 +356,7 @@ The control flow is as follows:
*/
func (a *applyCmd) apply(
cmd *cobra.Command, configFetcher attestationconfigapi.Fetcher, upgradeDir string,
cmd *cobra.Command, configFetcher attestationconfig.Fetcher, upgradeDir string,
) error {
// Validate inputs
conf, stateFile, err := a.validateInputs(cmd, configFetcher)
@ -450,7 +450,7 @@ func (a *applyCmd) apply(
return nil
}
func (a *applyCmd) validateInputs(cmd *cobra.Command, configFetcher attestationconfigapi.Fetcher) (*config.Config, *state.State, error) {
func (a *applyCmd) validateInputs(cmd *cobra.Command, configFetcher attestationconfig.Fetcher) (*config.Config, *state.State, error) {
// Read user's config and state file
a.log.Debug(fmt.Sprintf("Reading config from %q", a.flags.pathPrefixer.PrefixPrintablePath(constants.ConfigFilename)))
conf, err := config.New(a.fileHandler, constants.ConfigFilename, configFetcher, a.flags.force)

View File

@ -14,7 +14,7 @@ import (
"net/url"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
@ -106,12 +106,12 @@ func runConfigFetchMeasurements(cmd *cobra.Command, _ []string) error {
}
cfm.log.Debug("Using flags", "insecure", cfm.flags.insecure, "measurementsURL", cfm.flags.measurementsURL, "signatureURL", cfm.flags.signatureURL)
fetcher := attestationconfigapi.NewFetcherWithClient(http.DefaultClient, constants.CDNRepositoryURL)
fetcher := attestationconfig.NewFetcherWithClient(http.DefaultClient, constants.CDNRepositoryURL)
return cfm.configFetchMeasurements(cmd, fileHandler, fetcher)
}
func (cfm *configFetchMeasurementsCmd) configFetchMeasurements(
cmd *cobra.Command, fileHandler file.Handler, fetcher attestationconfigapi.Fetcher,
cmd *cobra.Command, fileHandler file.Handler, fetcher attestationconfig.Fetcher,
) error {
if !cfm.canFetchMeasurements {
cmd.PrintErrln("Fetching measurements is not supported in the OSS build of the Constellation CLI. Consult the documentation for instructions on where to download the enterprise version.")

View File

@ -12,7 +12,7 @@ import (
"net/url"
"testing"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
@ -204,13 +204,13 @@ func (f stubVerifyFetcher) FetchAndVerifyMeasurements(_ context.Context, _ strin
type stubAttestationFetcher struct{}
func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfigapi.Variant) (attestationconfigapi.Entry, error) {
return attestationconfigapi.Entry{
func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfig.Variant) (attestationconfig.Entry, error) {
return attestationconfig.Entry{
SEVSNPVersion: testCfg,
}, nil
}
var testCfg = attestationconfigapi.SEVSNPVersion{
var testCfg = attestationconfig.SEVSNPVersion{
Microcode: 93,
TEE: 0,
SNP: 6,

View File

@ -12,7 +12,7 @@ import (
"io"
"path/filepath"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/cli/internal/cloudcmd"
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
@ -68,7 +68,7 @@ func (f *iamUpgradeApplyFlags) parse(flags *pflag.FlagSet) error {
type iamUpgradeApplyCmd struct {
fileHandler file.Handler
log debugLog
configFetcher attestationconfigapi.Fetcher
configFetcher attestationconfig.Fetcher
flags iamUpgradeApplyFlags
}
@ -76,7 +76,7 @@ func runIAMUpgradeApply(cmd *cobra.Command, _ []string) error {
fileHandler := file.NewHandler(afero.NewOsFs())
upgradeID := generateUpgradeID(upgradeCmdKindIAM)
upgradeDir := filepath.Join(constants.UpgradeDir, upgradeID)
configFetcher := attestationconfigapi.NewFetcher()
configFetcher := attestationconfig.NewFetcher()
iamMigrateCmd, err := cloudcmd.NewIAMUpgrader(
cmd.Context(),
constants.TerraformIAMWorkingDir,

View File

@ -12,7 +12,7 @@ import (
"strings"
"testing"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/v2/internal/config"
@ -170,6 +170,6 @@ type stubConfigFetcher struct {
fetchLatestErr error
}
func (s *stubConfigFetcher) FetchLatestVersion(context.Context, attestationconfigapi.Variant) (attestationconfigapi.Entry, error) {
return attestationconfigapi.Entry{}, s.fetchLatestErr
func (s *stubConfigFetcher) FetchLatestVersion(context.Context, attestationconfig.Variant) (attestationconfig.Entry, error) {
return attestationconfig.Entry{}, s.fetchLatestErr
}

View File

@ -12,7 +12,7 @@ import (
"os"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/cli/internal/libvirt"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/v2/internal/config"
@ -40,7 +40,7 @@ func newMiniUpCmd() *cobra.Command {
type miniUpCmd struct {
log debugLog
configFetcher attestationconfigapi.Fetcher
configFetcher attestationconfig.Fetcher
fileHandler file.Handler
flags rootFlags
}
@ -53,7 +53,7 @@ func runUp(cmd *cobra.Command, _ []string) error {
m := &miniUpCmd{
log: log,
configFetcher: attestationconfigapi.NewFetcher(),
configFetcher: attestationconfig.NewFetcher(),
fileHandler: file.NewHandler(afero.NewOsFs()),
}
if err := m.flags.parse(cmd.Flags()); err != nil {

View File

@ -15,7 +15,7 @@ import (
"sync"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/disk-mapper/recoverproto"
"github.com/edgelesssys/constellation/v2/internal/atls"
"github.com/edgelesssys/constellation/v2/internal/attestation/choose"
@ -67,7 +67,7 @@ func (f *recoverFlags) parse(flags *pflag.FlagSet) error {
type recoverCmd struct {
log debugLog
configFetcher attestationconfigapi.Fetcher
configFetcher attestationconfig.Fetcher
flags recoverFlags
}
@ -80,7 +80,7 @@ func runRecover(cmd *cobra.Command, _ []string) error {
newDialer := func(validator atls.Validator) *dialer.Dialer {
return dialer.New(nil, validator, &net.Dialer{})
}
r := &recoverCmd{log: log, configFetcher: attestationconfigapi.NewFetcher()}
r := &recoverCmd{log: log, configFetcher: attestationconfig.NewFetcher()}
if err := r.flags.parse(cmd.Flags()); err != nil {
return err
}

View File

@ -12,7 +12,7 @@ import (
"fmt"
"strings"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/config"
"github.com/edgelesssys/constellation/v2/internal/constants"
@ -59,7 +59,7 @@ func runStatus(cmd *cobra.Command, _ []string) error {
return helmClient.Versions()
}
fetcher := attestationconfigapi.NewFetcher()
fetcher := attestationconfig.NewFetcher()
kubeClient, err := kubecmd.New(kubeConfig, log)
if err != nil {
return fmt.Errorf("setting up kubernetes client: %w", err)
@ -81,7 +81,7 @@ type statusCmd struct {
// status queries the cluster for the relevant status information and returns the output string.
func (s *statusCmd) status(
cmd *cobra.Command, getHelmVersions func() (fmt.Stringer, error),
kubeClient kubeCmd, fetcher attestationconfigapi.Fetcher,
kubeClient kubeCmd, fetcher attestationconfig.Fetcher,
) error {
conf, err := config.New(s.fileHandler, constants.ConfigFilename, fetcher, s.flags.force)
var configValidationErr *config.ValidationError

View File

@ -16,7 +16,7 @@ import (
"sort"
"strings"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/cli/internal/cloudcmd"
"github.com/edgelesssys/constellation/v2/internal/api/fetcher"
"github.com/edgelesssys/constellation/v2/internal/api/versionsapi"
@ -155,7 +155,7 @@ func runUpgradeCheck(cmd *cobra.Command, _ []string) error {
log: log,
}
return up.upgradeCheck(cmd, attestationconfigapi.NewFetcher())
return up.upgradeCheck(cmd, attestationconfig.NewFetcher())
}
type upgradeCheckCmd struct {
@ -169,7 +169,7 @@ type upgradeCheckCmd struct {
}
// upgradePlan plans an upgrade of a Constellation cluster.
func (u *upgradeCheckCmd) upgradeCheck(cmd *cobra.Command, fetcher attestationconfigapi.Fetcher) error {
func (u *upgradeCheckCmd) upgradeCheck(cmd *cobra.Command, fetcher attestationconfig.Fetcher) error {
conf, err := config.New(u.fileHandler, constants.ConfigFilename, fetcher, u.flags.force)
var configValidationErr *config.ValidationError
if errors.As(err, &configValidationErr) {

View File

@ -21,7 +21,7 @@ import (
"strconv"
"strings"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/atls"
azuretdx "github.com/edgelesssys/constellation/v2/internal/attestation/azure/tdx"
"github.com/edgelesssys/constellation/v2/internal/attestation/choose"
@ -121,11 +121,11 @@ func runVerify(cmd *cobra.Command, _ []string) error {
}
v.log.Debug("Using flags", "clusterID", v.flags.clusterID, "endpoint", v.flags.endpoint, "ownerID", v.flags.ownerID)
fetcher := attestationconfigapi.NewFetcher()
fetcher := attestationconfig.NewFetcher()
return v.verify(cmd, verifyClient, fetcher)
}
func (c *verifyCmd) verify(cmd *cobra.Command, verifyClient verifyClient, configFetcher attestationconfigapi.Fetcher) error {
func (c *verifyCmd) verify(cmd *cobra.Command, verifyClient verifyClient, configFetcher attestationconfig.Fetcher) error {
c.log.Debug(fmt.Sprintf("Loading configuration file from %q", c.flags.pathPrefixer.PrefixPrintablePath(constants.ConfigFilename)))
conf, err := config.New(c.fileHandler, constants.ConfigFilename, configFetcher, c.flags.force)
var configValidationErr *config.ValidationError

View File

@ -9,7 +9,7 @@ go_library(
importpath = "github.com/edgelesssys/constellation/v2/debugd/internal/cdbg/cmd",
visibility = ["//debugd:__subpackages__"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//debugd/internal/debugd",
"//debugd/internal/debugd/logcollector",
"//debugd/internal/filetransfer",

View File

@ -17,7 +17,7 @@ import (
"sync"
"time"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/debugd/internal/debugd"
"github.com/edgelesssys/constellation/v2/debugd/internal/debugd/logcollector"
"github.com/edgelesssys/constellation/v2/debugd/internal/filetransfer"
@ -71,7 +71,7 @@ func runDeploy(cmd *cobra.Command, _ []string) error {
fileHandler := file.NewHandler(fs)
streamer := streamer.New(fs)
transfer := filetransfer.New(log, streamer, filetransfer.ShowProgress)
constellationConfig, err := config.New(fileHandler, constants.ConfigFilename, attestationconfigapi.NewFetcher(), force)
constellationConfig, err := config.New(fileHandler, constants.ConfigFilename, attestationconfig.NewFetcher(), force)
var configValidationErr *config.ValidationError
if errors.As(err, &configValidationErr) {
cmd.PrintErrln(configValidationErr.LongMessage())

View File

@ -8,10 +8,10 @@ This estimate might make manual intervention necessary when a global rollout did
### Manually delete a version
```
COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfigapi/cli delete -- --version 2023-09-02-12-52
COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfig/cli delete -- --version 2023-09-02-12-52
```
### Manually upload a version
```
COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfigapi/cli -- --force --version 2023-09-02-12-52 --maa-claims-path "${path}"
COSIGN_PASSWORD=$CPW COSIGN_PRIVATE_KEY="$(cat $PATH_TO_KEY)" AWS_ACCESS_KEY_ID=$ID AWS_ACCESS_KEY=$KEY bazel run //internal/api/attestationconfig/cli -- --force --version 2023-09-02-12-52 --maa-claims-path "${path}"
```

View File

@ -10,7 +10,7 @@ go_library(
importpath = "github.com/edgelesssys/constellation/v2/e2e/internal/upgrade",
visibility = ["//e2e:__subpackages__"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//internal/config",
"//internal/constants",
"//internal/file",

View File

@ -36,7 +36,7 @@ import (
"time"
"github.com/bazelbuild/rules_go/go/runfiles"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/config"
"github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/edgelesssys/constellation/v2/internal/file"
@ -248,7 +248,7 @@ func workingDir(workspace string) (string, error) {
// WriteUpgradeConfig writes the target versions to the config file.
func WriteUpgradeConfig(require *require.Assertions, image string, kubernetes string, microservices string, configPath string) VersionContainer {
fileHandler := file.NewHandler(afero.NewOsFs())
attestationFetcher := attestationconfigapi.NewFetcher()
attestationFetcher := attestationconfig.NewFetcher()
cfg, err := config.New(fileHandler, configPath, attestationFetcher, true)
var cfgErr *config.ValidationError
var longMsg string

View File

@ -75,7 +75,7 @@ ok github.com/edgelesssys/constellation/v2/disk-mapper/internal/systemd (cache
? github.com/edgelesssys/constellation/v2/image/upload [no test files]
? github.com/edgelesssys/constellation/v2/image/upload/internal/cmd [no test files]
? github.com/edgelesssys/constellation/v2/internal/api/client [no test files]
ok github.com/edgelesssys/constellation/v2/internal/api/attestationconfigapi (cached) coverage: 59.2% of statements
ok github.com/edgelesssys/constellation/v2/internal/api/attestationconfig (cached) coverage: 59.2% of statements
? github.com/edgelesssys/constellation/v2/internal/api/fetcher [no test files]
? github.com/edgelesssys/constellation/v2/internal/api/versionsapi/cli [no test files]
ok github.com/edgelesssys/constellation/v2/internal/api/versionsapi (cached) coverage: 69.8% of statements

View File

@ -7,7 +7,7 @@ go_library(
importpath = "github.com/edgelesssys/constellation/v2/hack/image-fetch",
visibility = ["//visibility:private"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//internal/cloud/cloudprovider",
"//internal/config",
"//internal/constants",

View File

@ -19,7 +19,7 @@ import (
"path/filepath"
"regexp"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/v2/internal/config"
"github.com/edgelesssys/constellation/v2/internal/constants"
@ -39,7 +39,7 @@ func main() {
ctx := context.Background()
fh := file.NewHandler(afero.NewOsFs())
attFetcher := attestationconfigapi.NewFetcher()
attFetcher := attestationconfig.NewFetcher()
conf, err := config.New(fh, filepath.Join(cwd, constants.ConfigFilename), attFetcher, true)
var configValidationErr *config.ValidationError
if errors.As(err, &configValidationErr) {

View File

@ -20,7 +20,7 @@ go_library(
importpath = "github.com/edgelesssys/constellation/v2/internal/config",
visibility = ["//:__subpackages__"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//internal/api/versionsapi",
"//internal/attestation/idkeydigest",
"//internal/attestation/measurements",
@ -57,7 +57,7 @@ go_test(
data = glob(["testdata/**"]),
embed = [":config"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//internal/attestation/measurements",
"//internal/attestation/variant",
"//internal/cloud/cloudprovider",

View File

@ -10,7 +10,7 @@ import (
"context"
"fmt"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
@ -73,7 +73,7 @@ func (c *AWSSEVSNP) getToMarshallLatestWithResolvedVersions() AttestationCfg {
}
// FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them.
func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error {
func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error {
// Only talk to the API if at least one version number is set to latest.
if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
return nil
@ -88,7 +88,7 @@ func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher
return nil
}
func (c *AWSSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) {
func (c *AWSSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) {
if c.BootloaderVersion.WantLatest {
c.BootloaderVersion.Value = latest.Bootloader
}

View File

@ -10,7 +10,7 @@ import (
"context"
"fmt"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
@ -74,7 +74,7 @@ func (c AzureSEVSNP) EqualTo(old AttestationCfg) (bool, error) {
}
// FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them.
func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error {
func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error {
// Only talk to the API if at least one version number is set to latest.
if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
return nil
@ -89,7 +89,7 @@ func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetch
return nil
}
func (c *AzureSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) {
func (c *AzureSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) {
if c.BootloaderVersion.WantLatest {
c.BootloaderVersion.Value = latest.Bootloader
}
@ -180,7 +180,7 @@ func (c AzureTDX) EqualTo(other AttestationCfg) (bool, error) {
}
// FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them.
func (c *AzureTDX) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error {
func (c *AzureTDX) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error {
// Only talk to the API if at least one version number is set to latest.
if !(c.PCESVN.WantLatest || c.QESVN.WantLatest || c.TEETCBSVN.WantLatest || c.QEVendorID.WantLatest || c.XFAM.WantLatest) {
return nil

View File

@ -33,7 +33,7 @@ import (
en_translations "github.com/go-playground/validator/v10/translations/en"
"gopkg.in/yaml.v3"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
@ -461,7 +461,7 @@ func (e *UnsupportedAppRegistrationError) Error() string {
// 2. For "latest" version values of the attestation variants fetch the version numbers.
// 3. Read secrets from environment variables.
// 4. Validate config. If `--force` is set the version validation will be disabled and any version combination is allowed.
func New(fileHandler file.Handler, name string, fetcher attestationconfigapi.Fetcher, force bool) (*Config, error) {
func New(fileHandler file.Handler, name string, fetcher attestationconfig.Fetcher, force bool) (*Config, error) {
// Read config file
c, err := fromFile(fileHandler, name)
if err != nil {

View File

@ -21,7 +21,7 @@ import (
"go.uber.org/goleak"
"gopkg.in/yaml.v3"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
@ -1051,13 +1051,13 @@ func getConfigAsMap(conf *Config, t *testing.T) (res configMap) {
type stubAttestationFetcher struct{}
func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfigapi.Variant) (attestationconfigapi.Entry, error) {
return attestationconfigapi.Entry{
func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfig.Variant) (attestationconfig.Entry, error) {
return attestationconfig.Entry{
SEVSNPVersion: testCfg,
}, nil
}
var testCfg = attestationconfigapi.SEVSNPVersion{
var testCfg = attestationconfig.SEVSNPVersion{
Microcode: 93,
TEE: 0,
SNP: 6,

View File

@ -10,7 +10,7 @@ import (
"context"
"fmt"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
@ -73,7 +73,7 @@ func (c *GCPSEVSNP) getToMarshallLatestWithResolvedVersions() AttestationCfg {
}
// FetchAndSetLatestVersionNumbers fetches the latest version numbers from the configapi and sets them.
func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfigapi.Fetcher) error {
func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher attestationconfig.Fetcher) error {
// Only talk to the API if at least one version number is set to latest.
if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
return nil
@ -88,7 +88,7 @@ func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher
return nil
}
func (c *GCPSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) {
func (c *GCPSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) {
if c.BootloaderVersion.WantLatest {
c.BootloaderVersion.Value = latest.Bootloader
}

View File

@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
Package verify provides the types for the verify report in JSON format.
The package provides an interface for constellation verify and
the attestationconfigapi upload tool through JSON serialization.
the attestationconfig upload tool through JSON serialization.
It exposes a CSP-agnostic interface for printing Reports that may include CSP-specific information.
*/
package verify

View File

@ -14,7 +14,7 @@ go_library(
importpath = "github.com/edgelesssys/constellation/v2/terraform-provider-constellation/internal/provider",
visibility = ["//terraform-provider-constellation:__subpackages__"],
deps = [
"//api/attestationconfigapi",
"//api/attestationconfig",
"//internal/api/versionsapi",
"//internal/atls",
"//internal/attestation/choose",

View File

@ -12,7 +12,7 @@ import (
"fmt"
"net/http"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
@ -41,7 +41,7 @@ func NewAttestationDataSource() datasource.DataSource {
// AttestationDataSource defines the data source implementation.
type AttestationDataSource struct {
client *http.Client
fetcher attestationconfigapi.Fetcher
fetcher attestationconfig.Fetcher
rekor *sigstore.Rekor
version string
}
@ -73,7 +73,7 @@ func (d *AttestationDataSource) Configure(_ context.Context, req datasource.Conf
d.version = providerData.Version.String()
d.client = http.DefaultClient
d.fetcher = attestationconfigapi.NewFetcher()
d.fetcher = attestationconfig.NewFetcher()
rekor, err := sigstore.NewRekor()
if err != nil {
resp.Diagnostics.AddError("constructing rekor client", err.Error())
@ -172,7 +172,7 @@ func (d *AttestationDataSource) Read(ctx context.Context, req datasource.ReadReq
insecureFetch := data.Insecure.ValueBool()
latestVersions := attestationconfigapi.Entry{}
latestVersions := attestationconfig.Entry{}
if attestationVariant.Equal(variant.AWSSEVSNP{}) ||
attestationVariant.Equal(variant.AzureSEVSNP{}) ||
attestationVariant.Equal(variant.AzureTDX{}) ||

View File

@ -12,7 +12,7 @@ import (
"fmt"
"strconv"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi"
"github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
@ -138,7 +138,7 @@ func convertFromTfAttestationCfg(tfAttestation attestationAttribute, attestation
}
// convertToTfAttestationCfg converts the constellation attestation config to the related terraform structs.
func convertToTfAttestation(attVar variant.Variant, latestVersions attestationconfigapi.Entry) (tfAttestation attestationAttribute, err error) {
func convertToTfAttestation(attVar variant.Variant, latestVersions attestationconfig.Entry) (tfAttestation attestationAttribute, err error) {
tfAttestation = attestationAttribute{
Variant: attVar.String(),
}