@@ -107,10 +107,11 @@ func TestGetAttestation(t *testing.T) {
107107func TestValidateAttestation (t * testing.T ) {
108108 testNonce := make ([]byte , 32 )
109109 for name , tc := range map [string ]struct {
110- nonce []byte
111- resp * httpapi.AttestationResponse
112- validateErr error
113- wantErr string
110+ nonce []byte
111+ resp * httpapi.AttestationResponse
112+ validateErr error
113+ allowInsecure bool
114+ wantErr string
114115 }{
115116 "success" : {
116117 nonce : testNonce ,
@@ -143,6 +144,26 @@ func TestValidateAttestation(t *testing.T) {
143144 validateErr : assert .AnError ,
144145 wantErr : assert .AnError .Error (),
145146 },
147+ "insecure manifest without opt-in" : {
148+ nonce : testNonce ,
149+ resp : & httpapi.AttestationResponse {
150+ RawAttestationDoc : testNonce ,
151+ CoordinatorState : httpapi.CoordinatorState {
152+ Manifests : [][]byte {testInsecureManifest },
153+ },
154+ },
155+ wantErr : "WithInsecure" ,
156+ },
157+ "insecure manifest with opt-in" : {
158+ nonce : testNonce ,
159+ allowInsecure : true ,
160+ resp : & httpapi.AttestationResponse {
161+ RawAttestationDoc : testNonce ,
162+ CoordinatorState : httpapi.CoordinatorState {
163+ Manifests : [][]byte {testInsecureManifest },
164+ },
165+ },
166+ },
146167 } {
147168 t .Run (name , func (t * testing.T ) {
148169 assert := assert .New (t )
@@ -152,6 +173,9 @@ func TestValidateAttestation(t *testing.T) {
152173 require .NoError (err )
153174
154175 c := New ()
176+ if tc .allowInsecure {
177+ c = c .WithInsecure ()
178+ }
155179
156180 c .validatorsFromManifestOverride = func (* certcache.CachedHTTPSGetter , * manifest.Manifest , * slog.Logger ) ([]atls.Validator , error ) {
157181 return []atls.Validator {& stubValidator {err : tc .validateErr }}, nil
@@ -224,6 +248,25 @@ var testManifest = []byte(`
224248}
225249` )
226250
251+ var testInsecureManifest = []byte (`
252+ {
253+ "Policies": {
254+ "ef27c1c91a0ce044c67f0ec10d7c66ea9f178453dc96a233e97f0675578042f2": {
255+ "SANs": ["coordinator"],
256+ "WorkloadSecretID": "apps/v1/StatefulSet/default/coordinator",
257+ "Role": "coordinator"
258+ }
259+ },
260+ "ReferenceValues": {
261+ "snp": [
262+ {
263+ "Platform": "metal-qemu-snp-insecure"
264+ }
265+ ]
266+ }
267+ }
268+ ` )
269+
227270type stubValidator struct {
228271 atls.Validator
229272
0 commit comments