Skip to content

Commit

Permalink
updating to include command-run attestor
Browse files Browse the repository at this point in the history
Signed-off-by: chaosinthecrd <[email protected]>
  • Loading branch information
ChaosInTheCRD committed Mar 26, 2024
1 parent b900f33 commit c65a023
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 41 deletions.
6 changes: 1 addition & 5 deletions cmd/attestors.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ func runAttestors(ctx context.Context) error {
entries := attestation.RegistrationEntries()
for _, entry := range entries {
name := entry.Factory().Name()
// NOTE: This is a workaround to avoid printing the command-run attestor. We should mark it in the registry as such somehow.
if name == "command-run" {
continue
}

for _, a := range alwaysRunAttestors {
if name == a.Name() {
if name == a.Name() || name == "command-run" {
name = name + " (always run)"
}
}
Expand Down
6 changes: 5 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ func runRun(ctx context.Context, ro options.RunOptions, args []string, signers .
}

for _, a := range ro.Attestations {
if a == "command-run" {
log.Warnf("'command-run' is a builtin attestor and cannot be called with --attestations flag")
}

duplicate := false
for _, att := range attestors {
if a != att.Name() {
} else {
log.Warnf("Attestator %s already declared, skipping", a)
log.Warnf("Attestor %s already declared, skipping", a)
duplicate = true
break
}
Expand Down
28 changes: 15 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
module github.com/in-toto/witness

go 1.19
go 1.21

toolchain go1.21.4

require (
github.com/in-toto/go-witness v0.2.3
github.com/olekukonko/tablewriter v0.0.5
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.4
k8s.io/apimachinery v0.26.13
k8s.io/apimachinery v0.26.14
)

require (
Expand All @@ -21,7 +24,7 @@ require (
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
github.com/spiffe/go-spiffe/v2 v2.1.7 // indirect
github.com/zclconf/go-cty v1.12.1 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
)

Expand All @@ -46,7 +49,7 @@ require (
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.11.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
Expand All @@ -67,7 +70,6 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/open-policy-agent/opa v0.49.2 // indirect
github.com/owenrumney/go-sarif v1.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
Expand All @@ -91,17 +93,17 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.1.0 // indirect
github.com/zeebo/errs v1.3.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/grpc v1.61.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit c65a023

Please sign in to comment.