Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage for IPC server #389

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ steps:
--substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID}
exit

- name: 'gcr.io/cloud-builders/gcloud'
id: HttpServerTests
waitFor: ['DebugImageBuild']
env:
- 'OUTPUT_IMAGE_PREFIX=$_OUTPUT_IMAGE_PREFIX'
- 'OUTPUT_IMAGE_SUFFIX=$_OUTPUT_IMAGE_SUFFIX'
- 'PROJECT_ID=$PROJECT_ID'
script: |
#!/usr/bin/env bash

cd launcher/image/test
echo "running http server tests on ${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX}"
gcloud builds submit --config=test_http_server.yaml --region us-west1 \
--substitutions _IMAGE_NAME=${OUTPUT_IMAGE_PREFIX}-debug-${OUTPUT_IMAGE_SUFFIX},_IMAGE_PROJECT=${PROJECT_ID}
exit

- name: 'gcr.io/cloud-builders/gcloud'
id: DebugImageTests
waitFor: ['DebugImageBuild']
Expand Down
181 changes: 179 additions & 2 deletions go.work.sum

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions launcher/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ type AttestationAgent interface {
// AttestAgentOpts contains user generated options when calling the
// VerifyAttestation API
type AttestAgentOpts struct {
Aud string
Nonces []string
Aud string
Nonces []string
TokenType string
}

type agent struct {
Expand Down Expand Up @@ -103,8 +104,11 @@ func (a *agent) Attest(ctx context.Context, opts AttestAgentOpts) ([]byte, error
Challenge: challenge,
GcpCredentials: principalTokens,
Attestation: attestation,
CustomAudience: opts.Aud,
CustomNonce: opts.Nonces,
TokenOptions: verifier.TokenOptions{
CustomAudience: opts.Aud,
CustomNonce: opts.Nonces,
TokenType: opts.TokenType,
},
}

if a.launchSpec.Experiments.EnableSignedContainerImage {
Expand Down
2 changes: 1 addition & 1 deletion launcher/container_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (r *ContainerRunner) measureContainerClaims(ctx context.Context) error {
return r.attestAgent.MeasureEvent(separator)
}

// Retrieves an OIDC token from the attestation service, and returns how long
// Retrieves the default OIDC token from the attestation service, and returns how long
// to wait before attemping to refresh it.
// The token file will be written to a tmp file and then renamed.
func (r *ContainerRunner) refreshToken(ctx context.Context) (time.Duration, error) {
Expand Down
32 changes: 16 additions & 16 deletions launcher/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ go 1.20

require (
cloud.google.com/go/compute/metadata v0.2.3
cloud.google.com/go/confidentialcomputing v1.3.0
cloud.google.com/go/confidentialcomputing v1.4.0
github.com/cenkalti/backoff/v4 v4.1.3
github.com/containerd/containerd v1.6.18
github.com/golang-jwt/jwt/v4 v4.4.1
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/google/go-tpm v0.9.0
github.com/google/go-tpm-tools v0.3.13-0.20230620182252-4639ecce2aba
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
go.uber.org/multierr v1.11.0
golang.org/x/oauth2 v0.8.0
google.golang.org/api v0.128.0
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc
golang.org/x/oauth2 v0.13.0
google.golang.org/api v0.149.0
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b
)

require (
cloud.google.com/go/compute v1.19.3 // indirect
cloud.google.com/go/compute v1.23.1 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/hcsshim v0.9.6 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
Expand All @@ -40,9 +40,9 @@ require (
github.com/google/go-sev-guest v0.9.3 // indirect
github.com/google/go-tspi v0.3.0 // indirect
github.com/google/logger v1.1.1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/moby/locker v1.0.1 // indirect
Expand All @@ -55,13 +55,13 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/stretchr/testify v1.8.3 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.56.1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
Loading
Loading