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_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }}
COSIGN_PASSWORD: ${{ inputs.cosignPassword }} COSIGN_PASSWORD: ${{ inputs.cosignPassword }}
run: | 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}")" absolute_reports="${absolute_reports} $(realpath "${report}")"
done 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}") path=$(realpath "${report}")
cat "${path}" 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/**" - "release/**"
paths: paths:
- "internal/api/**" - "internal/api/**"
- "api/attestationconfigapi/**" - "api/attestationconfig/**"
- ".github/workflows/e2e-attestationconfigapi.yml" - ".github/workflows/e2e-attestationconfig.yml"
- "go.mod" - "go.mod"
jobs: jobs:
@ -33,7 +33,7 @@ jobs:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || github.event.pull_request.head.sha || '' }} ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || github.event.pull_request.head.sha || '' }}
- name: Run Attestationconfig API E2E - name: Run Attestationconfig API E2E
uses: ./.github/actions/e2e_attestationconfigapi uses: ./.github/actions/e2e_attestationconfig
with: with:
cosignPrivateKey: ${{ secrets.COSIGN_DEV_PRIVATE_KEY }} cosignPrivateKey: ${{ secrets.COSIGN_DEV_PRIVATE_KEY }}
cosignPassword: ${{ secrets.COSIGN_DEV_PASSWORD }} 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") load("//bazel/go:go_test.bzl", "go_test")
go_library( go_library(
name = "attestationconfigapi", name = "attestationconfig",
srcs = [ srcs = [
"attestationconfigapi.go", "attestationconfig.go",
"fetcher.go", "fetcher.go",
"version.go", "version.go",
], ],
importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfigapi", importpath = "github.com/edgelesssys/constellation/v2/api/attestationconfig",
visibility = ["//:__subpackages__"], visibility = ["//:__subpackages__"],
deps = [ deps = [
"//internal/api/fetcher", "//internal/api/fetcher",
@ -19,12 +19,12 @@ go_library(
) )
go_test( go_test(
name = "attestationconfigapi_test", name = "attestationconfig_test",
srcs = [ srcs = [
"fetcher_test.go", "fetcher_test.go",
"version_test.go", "version_test.go",
], ],
embed = [":attestationconfigapi"], embed = [":attestationconfig"],
deps = [ deps = [
"//internal/attestation/variant", "//internal/attestation/variant",
"//internal/constants", "//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. 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. 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 SPDX-License-Identifier: AGPL-3.0-only
*/ */
package attestationconfigapi package attestationconfig
import ( import (
"context" "context"

View File

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

View File

@ -16,11 +16,11 @@ go_library(
"upload.go", "upload.go",
"validargs.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"], visibility = ["//visibility:private"],
deps = [ deps = [
"//api/attestationconfigapi", "//api/attestationconfig",
"//api/attestationconfigapi/internal/cli/client", "//api/attestationconfig/internal/cli/client",
"//internal/api/fetcher", "//internal/api/fetcher",
"//internal/attestation/variant", "//internal/attestation/variant",
"//internal/constants", "//internal/constants",

View File

@ -7,10 +7,10 @@ go_library(
"client.go", "client.go",
"reporter.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__"], visibility = ["//:__subpackages__"],
deps = [ deps = [
"//api/attestationconfigapi", "//api/attestationconfig",
"//internal/api/client", "//internal/api/client",
"//internal/attestation/variant", "//internal/attestation/variant",
"//internal/sigstore", "//internal/sigstore",
@ -28,7 +28,7 @@ go_test(
], ],
embed = [":client"], embed = [":client"],
deps = [ deps = [
"//api/attestationconfigapi", "//api/attestationconfig",
"@com_github_stretchr_testify//assert", "@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-v2/service/s3"
"github.com/aws/aws-sdk-go/aws" "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" apiclient "github.com/edgelesssys/constellation/v2/internal/api/client"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/sigstore" "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. // List returns the list of versions for the given attestation variant.
func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfigapi.List, error) { func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfig.List, error) {
versions, err := apiclient.Fetch(ctx, c.s3Client, attestationconfigapi.List{Variant: attestation}) versions, err := apiclient.Fetch(ctx, c.s3Client, attestationconfig.List{Variant: attestation})
if err != nil { if err != nil {
var notFoundErr *apiclient.NotFoundError var notFoundErr *apiclient.NotFoundError
if errors.As(err, &notFoundErr) { 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 versions.Variant = attestation
@ -90,10 +90,10 @@ func (c Client) List(ctx context.Context, attestation variant.Variant) (attestat
return versions, nil 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" versionStr = versionStr + ".json"
ops = append(ops, deleteCmd{ ops = append(ops, deleteCmd{
apiObject: attestationconfigapi.Entry{ apiObject: attestationconfig.Entry{
Variant: versions.Variant, Variant: versions.Variant,
Version: versionStr, Version: versionStr,
}, },
@ -132,19 +132,19 @@ func (c Client) listCachedVersions(ctx context.Context, attestation variant.Vari
return dates, nil 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 versions := list.List
for i, v := range versions { for i, v := range versions {
if v == versionStr { if v == versionStr {
if i == len(versions)-1 { if i == len(versions)-1 {
removedVersions = attestationconfigapi.List{List: versions[:i], Variant: list.Variant} removedVersions = attestationconfig.List{List: versions[:i], Variant: list.Variant}
} else { } 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 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 { type crudCmd interface {

View File

@ -8,7 +8,7 @@ package client
import ( import (
"testing" "testing"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi" "github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -16,19 +16,19 @@ func TestDeleteAzureSEVSNPVersions(t *testing.T) {
sut := Client{ sut := Client{
bucketID: "bucket", 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") ops, err := sut.deleteVersion(versions, "2021-01-01")
assert := assert.New(t) assert := assert.New(t)
assert.NoError(err) assert.NoError(err)
assert.Contains(ops, deleteCmd{ assert.Contains(ops, deleteCmd{
apiObject: attestationconfigapi.Entry{ apiObject: attestationconfig.Entry{
Version: "2021-01-01.json", Version: "2021-01-01.json",
}, },
}) })
assert.Contains(ops, putCmd{ 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" "strings"
"time" "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/api/client"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "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") var ErrNoNewerVersion = errors.New("input version is not newer than latest API version")
func reportVersionDir(attestation variant.Variant) string { 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. // 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 var result bool
actionForVariant(variant, actionForVariant(variant,
func() { func() {
input := inputVersion.(attestationconfigapi.TDXVersion) input := inputVersion.(attestationconfig.TDXVersion)
other := otherVersion.(attestationconfigapi.TDXVersion) other := otherVersion.(attestationconfig.TDXVersion)
result = isInputNewerThanOtherTDXVersion(input, other) result = isInputNewerThanOtherTDXVersion(input, other)
}, },
func() { func() {
input := inputVersion.(attestationconfigapi.SEVSNPVersion) input := inputVersion.(attestationconfig.SEVSNPVersion)
other := otherVersion.(attestationconfigapi.SEVSNPVersion) other := otherVersion.(attestationconfig.SEVSNPVersion)
result = isInputNewerThanOtherSEVSNPVersion(input, other) result = isInputNewerThanOtherSEVSNPVersion(input, other)
}, },
) )
@ -64,18 +64,18 @@ func (c Client) UploadLatestVersion(
var err error var err error
actionForVariant(attestationVariant, actionForVariant(attestationVariant,
func() { 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) 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) err = fmt.Errorf("latest API version %q is not a TDX version", latestVersionInAPI)
} }
}, },
func() { 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) 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) err = fmt.Errorf("latest API version %q is not a SNP version", latestVersionInAPI)
} }
}, },
@ -181,19 +181,19 @@ func (c Client) findMinVersion(
actionForVariant(attestationVariant, actionForVariant(attestationVariant,
func() { func() {
getMinimalVersion = func() (any, string, error) { 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() { func() {
getMinimalVersion = func() (any, string, error) { 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() return getMinimalVersion()
} }
func findMinimalVersion[T attestationconfigapi.TDXVersion | attestationconfigapi.SEVSNPVersion]( func findMinimalVersion[T attestationconfig.TDXVersion | attestationconfig.SEVSNPVersion](
ctx context.Context, variant variant.Variant, versionDates []string, ctx context.Context, variant variant.Variant, versionDates []string,
s3Client *client.Client, cacheWindowSize int, s3Client *client.Client, cacheWindowSize int,
) (T, string, error) { ) (T, string, error) {
@ -233,8 +233,8 @@ type apiVersionObject struct {
version string `json:"-"` version string `json:"-"`
variant variant.Variant `json:"-"` variant variant.Variant `json:"-"`
cached bool `json:"-"` cached bool `json:"-"`
snp attestationconfigapi.SEVSNPVersion snp attestationconfig.SEVSNPVersion
tdx attestationconfigapi.TDXVersion tdx attestationconfig.TDXVersion
} }
func (a apiVersionObject) MarshalJSON() ([]byte, error) { func (a apiVersionObject) MarshalJSON() ([]byte, error) {
@ -266,7 +266,7 @@ func (a apiVersionObject) JSONPath() string {
if a.cached { if a.cached {
return path.Join(reportVersionDir(a.variant), a.version) 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. // ValidateRequest validates the request.
@ -300,10 +300,10 @@ func (a apiVersionObject) getVersion() any {
func (a *apiVersionObject) setVersion(version any) { func (a *apiVersionObject) setVersion(version any) {
actionForVariant(a.variant, actionForVariant(a.variant,
func() { func() {
a.tdx = version.(attestationconfigapi.TDXVersion) a.tdx = version.(attestationconfig.TDXVersion)
}, },
func() { 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. // 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 { if input == other {
return false 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. // 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 { if input == other {
return false return false
} }

View File

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

View File

@ -10,7 +10,7 @@ import (
"os" "os"
"slices" "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/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/file" "github.com/edgelesssys/constellation/v2/internal/file"
"github.com/edgelesssys/constellation/v2/internal/verify" "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/aws"
"github.com/aws/aws-sdk-go-v2/service/s3" "github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi" "github.com/edgelesssys/constellation/v2/api/attestationconfig"
"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/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/logger" "github.com/edgelesssys/constellation/v2/internal/logger"
"github.com/edgelesssys/constellation/v2/internal/staticupload" "github.com/edgelesssys/constellation/v2/internal/staticupload"
@ -50,7 +50,7 @@ func newDeleteCmd() *cobra.Command {
} }
func runDelete(cmd *cobra.Command, args []string) (retErr error) { 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])) deleteCfg, err := newDeleteConfig(cmd, ([3]string)(args[:3]))
if err != nil { if err != nil {
@ -86,7 +86,7 @@ func runRecursiveDelete(cmd *cobra.Command, args []string) (retErr error) {
return fmt.Errorf("creating delete config: %w", err) 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{ client, closeFn, err := staticupload.New(cmd.Context(), staticupload.Config{
Bucket: deleteCfg.bucket, Bucket: deleteCfg.bucket,
Region: deleteCfg.region, 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) 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. 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 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. 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. Any version update is then pushed to the API.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ import (
"net/url" "net/url"
"time" "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/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "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) 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) return cfm.configFetchMeasurements(cmd, fileHandler, fetcher)
} }
func (cfm *configFetchMeasurementsCmd) configFetchMeasurements( func (cfm *configFetchMeasurementsCmd) configFetchMeasurements(
cmd *cobra.Command, fileHandler file.Handler, fetcher attestationconfigapi.Fetcher, cmd *cobra.Command, fileHandler file.Handler, fetcher attestationconfig.Fetcher,
) error { ) error {
if !cfm.canFetchMeasurements { 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.") 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" "net/url"
"testing" "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/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/attestation/variant"
@ -204,13 +204,13 @@ func (f stubVerifyFetcher) FetchAndVerifyMeasurements(_ context.Context, _ strin
type stubAttestationFetcher struct{} type stubAttestationFetcher struct{}
func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfigapi.Variant) (attestationconfigapi.Entry, error) { func (f stubAttestationFetcher) FetchLatestVersion(_ context.Context, _ attestationconfig.Variant) (attestationconfig.Entry, error) {
return attestationconfigapi.Entry{ return attestationconfig.Entry{
SEVSNPVersion: testCfg, SEVSNPVersion: testCfg,
}, nil }, nil
} }
var testCfg = attestationconfigapi.SEVSNPVersion{ var testCfg = attestationconfig.SEVSNPVersion{
Microcode: 93, Microcode: 93,
TEE: 0, TEE: 0,
SNP: 6, SNP: 6,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/edgelesssys/constellation/v2/api/attestationconfigapi" "github.com/edgelesssys/constellation/v2/api/attestationconfig"
"github.com/edgelesssys/constellation/v2/internal/atls" "github.com/edgelesssys/constellation/v2/internal/atls"
azuretdx "github.com/edgelesssys/constellation/v2/internal/attestation/azure/tdx" azuretdx "github.com/edgelesssys/constellation/v2/internal/attestation/azure/tdx"
"github.com/edgelesssys/constellation/v2/internal/attestation/choose" "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) 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) 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))) 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) conf, err := config.New(c.fileHandler, constants.ConfigFilename, configFetcher, c.flags.force)
var configValidationErr *config.ValidationError var configValidationErr *config.ValidationError

View File

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

View File

@ -17,7 +17,7 @@ import (
"sync" "sync"
"time" "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"
"github.com/edgelesssys/constellation/v2/debugd/internal/debugd/logcollector" "github.com/edgelesssys/constellation/v2/debugd/internal/debugd/logcollector"
"github.com/edgelesssys/constellation/v2/debugd/internal/filetransfer" "github.com/edgelesssys/constellation/v2/debugd/internal/filetransfer"
@ -71,7 +71,7 @@ func runDeploy(cmd *cobra.Command, _ []string) error {
fileHandler := file.NewHandler(fs) fileHandler := file.NewHandler(fs)
streamer := streamer.New(fs) streamer := streamer.New(fs)
transfer := filetransfer.New(log, streamer, filetransfer.ShowProgress) 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 var configValidationErr *config.ValidationError
if errors.As(err, &configValidationErr) { if errors.As(err, &configValidationErr) {
cmd.PrintErrln(configValidationErr.LongMessage()) 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 ### 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 ### 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", importpath = "github.com/edgelesssys/constellation/v2/e2e/internal/upgrade",
visibility = ["//e2e:__subpackages__"], visibility = ["//e2e:__subpackages__"],
deps = [ deps = [
"//api/attestationconfigapi", "//api/attestationconfig",
"//internal/config", "//internal/config",
"//internal/constants", "//internal/constants",
"//internal/file", "//internal/file",

View File

@ -36,7 +36,7 @@ import (
"time" "time"
"github.com/bazelbuild/rules_go/go/runfiles" "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/config"
"github.com/edgelesssys/constellation/v2/internal/constants" "github.com/edgelesssys/constellation/v2/internal/constants"
"github.com/edgelesssys/constellation/v2/internal/file" "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. // WriteUpgradeConfig writes the target versions to the config file.
func WriteUpgradeConfig(require *require.Assertions, image string, kubernetes string, microservices string, configPath string) VersionContainer { func WriteUpgradeConfig(require *require.Assertions, image string, kubernetes string, microservices string, configPath string) VersionContainer {
fileHandler := file.NewHandler(afero.NewOsFs()) fileHandler := file.NewHandler(afero.NewOsFs())
attestationFetcher := attestationconfigapi.NewFetcher() attestationFetcher := attestationconfig.NewFetcher()
cfg, err := config.New(fileHandler, configPath, attestationFetcher, true) cfg, err := config.New(fileHandler, configPath, attestationFetcher, true)
var cfgErr *config.ValidationError var cfgErr *config.ValidationError
var longMsg string 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 [no test files]
? github.com/edgelesssys/constellation/v2/image/upload/internal/cmd [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] ? 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/fetcher [no test files]
? github.com/edgelesssys/constellation/v2/internal/api/versionsapi/cli [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 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", importpath = "github.com/edgelesssys/constellation/v2/hack/image-fetch",
visibility = ["//visibility:private"], visibility = ["//visibility:private"],
deps = [ deps = [
"//api/attestationconfigapi", "//api/attestationconfig",
"//internal/cloud/cloudprovider", "//internal/cloud/cloudprovider",
"//internal/config", "//internal/config",
"//internal/constants", "//internal/constants",

View File

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

View File

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

View File

@ -10,7 +10,7 @@ import (
"context" "context"
"fmt" "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/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" "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. // 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. // 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) { if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
return nil return nil
@ -88,7 +88,7 @@ func (c *AWSSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher
return nil return nil
} }
func (c *AWSSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) { func (c *AWSSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) {
if c.BootloaderVersion.WantLatest { if c.BootloaderVersion.WantLatest {
c.BootloaderVersion.Value = latest.Bootloader c.BootloaderVersion.Value = latest.Bootloader
} }

View File

@ -10,7 +10,7 @@ import (
"context" "context"
"fmt" "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/idkeydigest"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "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. // 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. // 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) { if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
return nil return nil
@ -89,7 +89,7 @@ func (c *AzureSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetch
return nil return nil
} }
func (c *AzureSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) { func (c *AzureSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) {
if c.BootloaderVersion.WantLatest { if c.BootloaderVersion.WantLatest {
c.BootloaderVersion.Value = latest.Bootloader 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. // 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. // 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) { if !(c.PCESVN.WantLatest || c.QESVN.WantLatest || c.TEETCBSVN.WantLatest || c.QEVendorID.WantLatest || c.XFAM.WantLatest) {
return nil return nil

View File

@ -33,7 +33,7 @@ import (
en_translations "github.com/go-playground/validator/v10/translations/en" en_translations "github.com/go-playground/validator/v10/translations/en"
"gopkg.in/yaml.v3" "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/api/versionsapi"
"github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest" "github.com/edgelesssys/constellation/v2/internal/attestation/idkeydigest"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "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. // 2. For "latest" version values of the attestation variants fetch the version numbers.
// 3. Read secrets from environment variables. // 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. // 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 // Read config file
c, err := fromFile(fileHandler, name) c, err := fromFile(fileHandler, name)
if err != nil { if err != nil {

View File

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

View File

@ -10,7 +10,7 @@ import (
"context" "context"
"fmt" "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/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "github.com/edgelesssys/constellation/v2/internal/attestation/variant"
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" "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. // 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. // 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) { if !(c.BootloaderVersion.WantLatest || c.TEEVersion.WantLatest || c.SNPVersion.WantLatest || c.MicrocodeVersion.WantLatest) {
return nil return nil
@ -88,7 +88,7 @@ func (c *GCPSEVSNP) FetchAndSetLatestVersionNumbers(ctx context.Context, fetcher
return nil return nil
} }
func (c *GCPSEVSNP) mergeWithLatestVersion(latest attestationconfigapi.SEVSNPVersion) { func (c *GCPSEVSNP) mergeWithLatestVersion(latest attestationconfig.SEVSNPVersion) {
if c.BootloaderVersion.WantLatest { if c.BootloaderVersion.WantLatest {
c.BootloaderVersion.Value = latest.Bootloader 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. Package verify provides the types for the verify report in JSON format.
The package provides an interface for constellation verify and 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. It exposes a CSP-agnostic interface for printing Reports that may include CSP-specific information.
*/ */
package verify package verify

View File

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

View File

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

View File

@ -12,7 +12,7 @@ import (
"fmt" "fmt"
"strconv" "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/idkeydigest"
"github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/measurements"
"github.com/edgelesssys/constellation/v2/internal/attestation/variant" "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. // 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{ tfAttestation = attestationAttribute{
Variant: attVar.String(), Variant: attVar.String(),
} }