Skip to content

Commit c06555d

Browse files
Migrating to the use of in-toto/go-witness module (#331)
* added all imports * fixing go sum * changing go-witness back for now, makes more sense * moved witness to using new in-toto/go-witness module Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk> * adding change to test now following newer version of policy * running docgen as changes found from use of new module * pinning to v0.2.0 of archivista and go-witness Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk> --------- Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk> Signed-off-by: Tom Meadows <tom@tmlabs.co.uk>
1 parent c0f5843 commit c06555d

17 files changed

+123
-79
lines changed

cmd/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import (
2020
"os"
2121
"strings"
2222

23+
"github.com/in-toto/go-witness/log"
2324
"github.com/in-toto/witness/options"
2425
"github.com/spf13/cobra"
2526
"github.com/spf13/pflag"
2627
"github.com/spf13/viper"
27-
"github.com/testifysec/go-witness/log"
2828
)
2929

3030
func initConfig(rootCmd *cobra.Command, rootOptions *options.RootOptions) error {

cmd/keyloader.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919
"fmt"
2020
"strings"
2121

22+
"github.com/in-toto/go-witness/cryptoutil"
23+
"github.com/in-toto/go-witness/log"
24+
"github.com/in-toto/go-witness/signer"
2225
"github.com/in-toto/witness/options"
2326
"github.com/spf13/pflag"
24-
"github.com/testifysec/go-witness/cryptoutil"
25-
"github.com/testifysec/go-witness/log"
26-
"github.com/testifysec/go-witness/signer"
2727
)
2828

2929
// signerProvidersFromFlags looks at all flags that were set by the user to determine which signer providers we should use

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import (
1818
"fmt"
1919
"os"
2020

21+
"github.com/in-toto/go-witness/log"
2122
"github.com/in-toto/witness/options"
2223
"github.com/spf13/cobra"
23-
"github.com/testifysec/go-witness/log"
2424
)
2525

2626
var ro = &options.RootOptions{}

cmd/root_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ import (
2626
"testing"
2727
"time"
2828

29+
"github.com/in-toto/go-witness/cryptoutil"
30+
"github.com/in-toto/go-witness/signer"
31+
"github.com/in-toto/go-witness/signer/file"
2932
"github.com/in-toto/witness/options"
3033
"github.com/stretchr/testify/assert"
3134
"github.com/stretchr/testify/require"
32-
"github.com/testifysec/go-witness/cryptoutil"
33-
"github.com/testifysec/go-witness/signer"
34-
"github.com/testifysec/go-witness/signer/file"
3535
)
3636

3737
const (

cmd/run.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ import (
2020
"encoding/json"
2121
"fmt"
2222

23+
witness "github.com/in-toto/go-witness"
24+
"github.com/in-toto/go-witness/archivista"
25+
"github.com/in-toto/go-witness/attestation"
26+
"github.com/in-toto/go-witness/attestation/commandrun"
27+
"github.com/in-toto/go-witness/attestation/material"
28+
"github.com/in-toto/go-witness/attestation/product"
29+
"github.com/in-toto/go-witness/cryptoutil"
30+
"github.com/in-toto/go-witness/dsse"
31+
"github.com/in-toto/go-witness/log"
32+
"github.com/in-toto/go-witness/registry"
33+
"github.com/in-toto/go-witness/timestamp"
2334
"github.com/in-toto/witness/options"
2435
"github.com/spf13/cobra"
25-
witness "github.com/testifysec/go-witness"
26-
"github.com/testifysec/go-witness/archivista"
27-
"github.com/testifysec/go-witness/attestation"
28-
"github.com/testifysec/go-witness/attestation/commandrun"
29-
"github.com/testifysec/go-witness/attestation/material"
30-
"github.com/testifysec/go-witness/attestation/product"
31-
"github.com/testifysec/go-witness/cryptoutil"
32-
"github.com/testifysec/go-witness/dsse"
33-
"github.com/testifysec/go-witness/log"
34-
"github.com/testifysec/go-witness/registry"
35-
"github.com/testifysec/go-witness/timestamp"
3636
)
3737

3838
func RunCmd() *cobra.Command {

cmd/run_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ import (
2424
"path/filepath"
2525
"testing"
2626

27+
"github.com/in-toto/go-witness/cryptoutil"
28+
"github.com/in-toto/go-witness/dsse"
29+
"github.com/in-toto/go-witness/signer"
30+
"github.com/in-toto/go-witness/signer/file"
2731
"github.com/in-toto/witness/options"
2832
"github.com/stretchr/testify/assert"
2933
"github.com/stretchr/testify/require"
30-
"github.com/testifysec/go-witness/cryptoutil"
31-
"github.com/testifysec/go-witness/dsse"
32-
"github.com/testifysec/go-witness/signer"
33-
"github.com/testifysec/go-witness/signer/file"
3434
)
3535

3636
func TestRunRSAKeyPair(t *testing.T) {

cmd/sign.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import (
1919
"fmt"
2020
"os"
2121

22+
witness "github.com/in-toto/go-witness"
23+
"github.com/in-toto/go-witness/cryptoutil"
24+
"github.com/in-toto/go-witness/dsse"
25+
"github.com/in-toto/go-witness/timestamp"
2226
"github.com/in-toto/witness/options"
2327
"github.com/spf13/cobra"
24-
witness "github.com/testifysec/go-witness"
25-
"github.com/testifysec/go-witness/cryptoutil"
26-
"github.com/testifysec/go-witness/dsse"
27-
"github.com/testifysec/go-witness/timestamp"
2828
)
2929

3030
func SignCmd() *cobra.Command {

cmd/sign_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
"os"
2323
"testing"
2424

25+
"github.com/in-toto/go-witness/cryptoutil"
2526
"github.com/in-toto/witness/options"
2627
"github.com/stretchr/testify/assert"
2728
"github.com/stretchr/testify/require"
28-
"github.com/testifysec/go-witness/cryptoutil"
2929
)
3030

3131
func Test_runSignPolicyRSA(t *testing.T) {

cmd/verify.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ import (
2222
"fmt"
2323
"os"
2424

25+
witness "github.com/in-toto/go-witness"
26+
"github.com/in-toto/go-witness/archivista"
27+
"github.com/in-toto/go-witness/cryptoutil"
28+
"github.com/in-toto/go-witness/dsse"
29+
"github.com/in-toto/go-witness/log"
30+
"github.com/in-toto/go-witness/source"
2531
"github.com/in-toto/witness/options"
2632
"github.com/spf13/cobra"
27-
witness "github.com/testifysec/go-witness"
28-
"github.com/testifysec/go-witness/archivista"
29-
"github.com/testifysec/go-witness/cryptoutil"
30-
"github.com/testifysec/go-witness/dsse"
31-
"github.com/testifysec/go-witness/log"
32-
"github.com/testifysec/go-witness/source"
3333
)
3434

3535
func VerifyCmd() *cobra.Command {

cmd/verify_test.go

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ import (
2828
"testing"
2929
"time"
3030

31+
witness "github.com/in-toto/go-witness"
32+
"github.com/in-toto/go-witness/attestation/commandrun"
33+
"github.com/in-toto/go-witness/cryptoutil"
34+
"github.com/in-toto/go-witness/dsse"
35+
"github.com/in-toto/go-witness/policy"
36+
"github.com/in-toto/go-witness/signer"
37+
"github.com/in-toto/go-witness/signer/file"
3138
"github.com/in-toto/witness/options"
3239
"github.com/stretchr/testify/require"
33-
witness "github.com/testifysec/go-witness"
34-
"github.com/testifysec/go-witness/attestation/commandrun"
35-
"github.com/testifysec/go-witness/cryptoutil"
36-
"github.com/testifysec/go-witness/dsse"
37-
"github.com/testifysec/go-witness/policy"
38-
"github.com/testifysec/go-witness/signer"
39-
"github.com/testifysec/go-witness/signer/file"
40+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4041
)
4142

4243
func TestRunVerifyCA(t *testing.T) {
@@ -313,7 +314,7 @@ func makepolicy(t *testing.T, functionary policy.Functionary, publicKey policy.P
313314
}
314315

315316
p := policy.Policy{
316-
Expires: time.Now().Add(1 * time.Hour),
317+
Expires: metav1.Time{Time: time.Now().Add(1 * time.Hour)},
317318
PublicKeys: map[string]policy.PublicKey{},
318319
Steps: map[string]policy.Step{},
319320
}
@@ -351,14 +352,8 @@ func createTestRSAKey() (cryptoutil.Signer, cryptoutil.Verifier, []byte, []byte,
351352
}
352353

353354
pemBytes := pem.EncodeToMemory(&pem.Block{Type: "PUBLIC KEY", Bytes: keyBytes})
354-
if err != nil {
355-
return nil, nil, nil, nil, err
356-
}
357355

358356
privKeyBytes := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privKey)})
359-
if err != nil {
360-
return nil, nil, nil, nil, err
361-
}
362357

363358
return signer, verifier, pemBytes, privKeyBytes, nil
364359
}

0 commit comments

Comments
 (0)