Skip to content

Commit

Permalink
[TEP-0089] Enable SPIRE for signing taskrun results in alpha.
Browse files Browse the repository at this point in the history
Breaking down PR tektoncd#4759 originally proposed by @pxp928 to address TEP-0089 according @lumjjb suggestions. Plan for breaking down PR is PR 1.1: api PR 1.2: entrypointer (+cmd line + test/entrypointer) Entrypoint takes results and signs the results (termination message). PR 1.3: reconciler + pod + cmd/controller + integration tests Controller will verify the signed result. This commit corresponds to 1.3 above.

Signed-off-by: jagathprakash <[email protected]>
  • Loading branch information
jagathprakash committed Dec 14, 2022
1 parent c0a05c2 commit 1149d51
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/config/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ const (
DefaultSendCloudEventsForRuns = false
// DefaultEmbeddedStatus is the default value for "embedded-status".
DefaultEmbeddedStatus = FullEmbeddedStatus
// EnableNonfalsifiabilityWithSpire is the value used for "enable-nonfalsifiability" when SPIRE is used to enable non-falsifiability.
// EnforceNonfalsifiabilityWithSpire is the value used for "enable-nonfalsifiability" when SPIRE is used to enable non-falsifiability.
EnforceNonfalsifiabilityWithSpire = "spire"
// EnableNonfalsifiabilityNone is the value used for "enable-nonfalsifiability" when non-falsifiability is not enabled.
// EnforceNonfalsifiabilityNone is the value used for "enable-nonfalsifiability" when non-falsifiability is not enabled.
EnforceNonfalsifiabilityNone = ""
// DefaultEnforceNonfalsifiability is the default value for "enforce-nonfalsifiability".
DefaultEnforceNonfalsifiability = EnforceNonfalsifiabilityNone
Expand Down
25 changes: 25 additions & 0 deletions pkg/spire/spire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/spiffe/go-spiffe/v2/spiffeid"
"github.com/spiffe/go-spiffe/v2/svid/x509svid"
pconf "github.com/tektoncd/pipeline/pkg/apis/config"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing"
"github.com/tektoncd/pipeline/pkg/spire/config"
Expand Down Expand Up @@ -668,6 +669,30 @@ func TestSpire_TaskRunResultsSignTamper(t *testing.T) {
}
}

func TestOnStore(t *testing.T) {
ctx, _ := ttesting.SetupDefaultContext(t)
logger := logging.FromContext(ctx)
ctx = context.WithValue(ctx, controllerKey{}, &spireControllerAPIClient{
config: &config.SpireConfig{
TrustDomain: "before_test_domain",
SocketPath: "before_test_socket_path",
ServerAddr: "before_test_server_path",
NodeAliasPrefix: "before_test_node_alias_prefix",
},
})
want := config.SpireConfig{
TrustDomain: "after_test_domain",
SocketPath: "after_test_socket_path",
ServerAddr: "after_test_server_path",
NodeAliasPrefix: "after_test_node_alias_prefix",
}
OnStore(ctx, logger)(pconf.GetSpireConfigName(), &want)
got := *GetControllerAPIClient(ctx).(*spireControllerAPIClient).config
if got != want {
t.Fatalf("test TestOnStore expected %v but got %v", got, want)
}
}

func makeX509SVIDs(ca *test.CA, ids ...spiffeid.ID) []*x509svid.SVID {
svids := []*x509svid.SVID{}
for _, id := range ids {
Expand Down

0 comments on commit 1149d51

Please sign in to comment.