Skip to content

Commit

Permalink
update for go 1.21, update packages, sectestdata and CI. (#399)
Browse files Browse the repository at this point in the history
Also fix gosec "G601: Implicit memory aliasing in for loop." lint errors in tests.
  • Loading branch information
cosnicolaou authored Dec 18, 2023
1 parent 831800d commit 3dce6c1
Show file tree
Hide file tree
Showing 61 changed files with 946 additions and 668 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.18.x, 1.20.x]
go-version: [1.19.x, 1.21.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
go-version: 1.21.x
cache: true

- name: Install openssl
Expand Down
42 changes: 28 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,44 @@ go 1.18

require (
github.com/davecgh/go-spew v1.1.1
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/shirou/gopsutil/v3 v3.23.7
github.com/google/uuid v1.5.0
github.com/gorilla/websocket v1.5.1
github.com/shirou/gopsutil/v3 v3.23.11
github.com/vanadium/go-mdns-sd v0.0.0-20230219002252-724533cf06f5
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a
golang.org/x/crypto v0.12.0
golang.org/x/mod v0.12.0
golang.org/x/net v0.14.0
golang.org/x/crypto v0.16.0
golang.org/x/mod v0.14.0
golang.org/x/net v0.19.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/term v0.11.0
golang.org/x/text v0.12.0
v.io/x/lib v0.1.15
golang.org/x/term v0.15.0
golang.org/x/text v0.14.0
v.io/x/lib v0.1.17
v.io/x/ref/internal/logger v0.1.1
v.io/x/ref/lib/flags/sitedefaults v0.1.1
v.io/x/ref/test/compatibility/modules/simple v0.0.0-20220116222041-f948f3a44e0d
)

require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/sys v0.11.0 // indirect
go.opencensus.io v0.22.5 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)
139 changes: 139 additions & 0 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions v23/query/engine/internal/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ type execSelectErrorTest struct {
type execResolveFieldTest struct {
k string
v *vom.RawBytes
f queryparser.Field
f *queryparser.Field
r *vom.RawBytes
}

Expand Down Expand Up @@ -3501,7 +3501,7 @@ func TestResolveField(t *testing.T) {
{
custTable.rows[0].key,
custTable.rows[0].value,
queryparser.Field{
&queryparser.Field{
Segments: []queryparser.Segment{
{
Value: "k",
Expand All @@ -3515,7 +3515,7 @@ func TestResolveField(t *testing.T) {
{
custTable.rows[0].key,
custTable.rows[0].value,
queryparser.Field{
&queryparser.Field{
Segments: []queryparser.Segment{
{
Value: "v",
Expand All @@ -3537,7 +3537,7 @@ func TestResolveField(t *testing.T) {
}

for _, test := range basic {
r := internal.ResolveField(db, test.k, vdl.ValueOf(test.v), &test.f)
r := internal.ResolveField(db, test.k, vdl.ValueOf(test.v), test.f)
if !reflect.DeepEqual(r, vdl.ValueOf(test.r)) {
t.Errorf("got %v(%s), want %v(%s)", r, r.Type(), vdl.ValueOf(test.r), test.r.Type)
}
Expand Down
11 changes: 7 additions & 4 deletions v23/security/authorizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func testDefaultAuthorizer(t *testing.T, pali, pbob, pche, pdis security.Princip
// All tests are run as if "ali" is the local end and "bob" is the remote.
tests := []struct {
local, remote security.Blessings
call security.CallParams
call *security.CallParams
authorized bool
}{
{
Expand All @@ -102,7 +102,7 @@ func testDefaultAuthorizer(t *testing.T, pali, pbob, pche, pdis security.Princip
// ali talking to ali:friend
local: ali,
remote: B(ali, "friend", tpcav),
call: security.CallParams{RemoteDischarges: dismap},
call: &security.CallParams{RemoteDischarges: dismap},
authorized: true,
},
{
Expand All @@ -121,16 +121,19 @@ func testDefaultAuthorizer(t *testing.T, pali, pbob, pche, pdis security.Princip
// {ali, bob:friend, che:friend} talking to {bob:friend:spouse, che:family}
local: U(ali, A(bob, "friend"), A(che, "friend")),
remote: U(B(bob, "friend:spouse", tpcav), B(che, "family")),
call: security.CallParams{RemoteDischarges: dismap},
call: &security.CallParams{RemoteDischarges: dismap},
authorized: true,
},
}
for _, test := range tests {
if test.call == nil {
test.call = &security.CallParams{}
}
test.call.LocalPrincipal = pali
test.call.LocalBlessings = test.local
test.call.RemoteBlessings = test.remote
ctx, cancel := context.RootContext()
err := authorizer.Authorize(ctx, security.NewCall(&test.call))
err := authorizer.Authorize(ctx, security.NewCall(test.call))
if (err == nil) != test.authorized {
t.Errorf("call: %v. Got %v", test.call, err)
}
Expand Down
9 changes: 5 additions & 4 deletions v23/security/digest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ const (
MHcCAQEEIAYkd29NwBnAkhzARDwx+KhOiJLMDSAxf8E67Xug3SpIoAoGCCqGSM49
AwEHoUQDQgAEIHvCWOkEjvGQYwdTzASIDuYSByJ9qYVZ1Hw2ecbIqu2AS5Ms5EN/
NEcea36rZAOVnVyaU5GgPpYfgoLeCOnIRQ==
-----END EC PRIVATE KEY-----`
-----END EC PRIVATE KEY-----` // #nosec G101

ed25519KeyPEM = `-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIBxrp6nd9uI9qMPqn9EiZEMu/8AMSArRN3gJscvJnJuE
-----END PRIVATE KEY-----
`
` // #nosec G101

rsa2048PEM = `-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA2CjRtb1yRuGjeHTLe37/rjDZhHGaAAg8DcV85Hr5oJDgrez8
+RCEJy6eoYqv+Z1yD0Tg41fI3hoYzfes1xUV71ejHEcaeTzWrqJSFve9QM0Y0Mii
Expand All @@ -54,7 +55,7 @@ gHYIcHfTeZEMq3EXDBfoifN4JWXNbe8G4cDqCHoAm1wBmirdi05HPPlJq0tQ+avP
4RXend0CgYAtPrwmvJ+JZ5TKJsj0y176KwFR7TmsG6VZGd6RHcCP/yjGZowktSOt
GHep8kwXNgB4u+uZsKlHmNOjWpwwruMt+LmKD7IlbvCKlnQfIw6hmTYhp3tzCR8r
LUv800pKz/E490ugsQkHPd49EzwylxQEFliG7t4FwlMt8erdP3k/7A==
-----END RSA PRIVATE KEY-----`
-----END RSA PRIVATE KEY-----` // #nosec G101

rsa4096PEM = `-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEAw4HC1OivsinI+GPx5v950joDkh0bL8mrptyGymXe977QwvOB
Expand Down Expand Up @@ -107,7 +108,7 @@ HG/aCuC+jFWRN2CdzO4d+d/6wPtEhPLfkI6kLa97PBN/xCzc09Phspo1ojMdBfOv
3QSlcGjiKx8j4PJOA2i/Fs9KgAPVMLhlCFp1gRKYM7/08s/3EiZbFIeVcGmJGLSx
L/2aHj2343RcjS2KCH4DVisXuiB4CQKOiGz8bbKRTGyEfW39gEPYAyD3pREM
-----END RSA PRIVATE KEY-----
`
` // #nosec G101

rsa2048Sig = `QTsG6Hm7QckWjGvhA/HiKOhb5FGnH530ZJOnWAAkHXhS97TDC+aSVEhGS9lLKPALkf4fMODEo9PYufJQjOeVhBf8rgASIQJUb0qxLuigC5Gyvg+GiNfQhAOYvrQJjJeM0wGIFvr8JmMlbkj4+QdrtdQqzAtUq3jVMeaOvslIGHgoAqxoCcxCuKDjey21fYjmy9G7AWLsZVb4MCfCSwDGdhP3agtIuLYB2snkLKIiFAh4FJ0PdT1GPRWDkiXxxc3JWTdPHwu/AXS0Ibjk3RXQaVcRjkZwjPIr6dAN0pGp8MYkgMYjXHvccGPWDmZNWamwz/vCR1D6IUbYWFnI/WHgrg`

Expand Down
10 changes: 5 additions & 5 deletions v23/security/principal_blessings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,19 +376,19 @@ func testAddToRoots(t *testing.T, tpFunc func(t testing.TB) security.Principal,

tests := []struct {
add security.Blessings
root security.Certificate
root *security.Certificate
recognized []string
notRecognized []string
}{
{
add: aliceFriendSpouse,
root: security.Certificate{PublicKey: publicKeyBytes(p1)},
root: &security.Certificate{PublicKey: publicKeyBytes(p1)},
recognized: s{"alice:friend", "alice:friend:device", "alice:friend:device:app", "alice:friend:spouse", "alice:friend:spouse:friend"},
notRecognized: s{"alice:device", "bob", "bob:friend", "bob:friend:spouse"},
},
{
add: charlieFamilyDaughter,
root: security.Certificate{PublicKey: publicKeyBytes(p2)},
root: &security.Certificate{PublicKey: publicKeyBytes(p2)},
recognized: s{"charlie", "charlie:friend", "charlie:friend:device", "charlie:family", "charlie:family:daughter", "charlie:family:friend", "charlie:family:friend:device"},
notRecognized: s{"alice", "bob", "alice:family", "alice:family:daughter"},
},
Expand All @@ -403,15 +403,15 @@ func testAddToRoots(t *testing.T, tpFunc func(t testing.TB) security.Principal,
if tp.Roots().Recognized(test.root.PublicKey, b) != nil {
t.Errorf("added roots for: %v but did not recognize blessing: %v", test.add, b)
}
if tp.Roots().RecognizedCert(&test.root, b) != nil {
if tp.Roots().RecognizedCert(test.root, b) != nil {
t.Errorf("added roots for: %v but did not recognize blessing: %v", test.add, b)
}
}
for _, b := range test.notRecognized {
if tp.Roots().Recognized(test.root.PublicKey, b) == nil {
t.Errorf("added roots for: %v but recognized blessing: %v", test.add, b)
}
if tp.Roots().RecognizedCert(&test.root, b) == nil {
if tp.Roots().RecognizedCert(test.root, b) == nil {
t.Errorf("added roots for: %v but recognized blessing: %v", test.add, b)
}
}
Expand Down
14 changes: 7 additions & 7 deletions v23/vdl/value_encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,18 +492,18 @@ func TestEncodeToValueOptional(t *testing.T) {
}

for _, tc := range []struct {
input structTypeOptional
input *structTypeOptional
output string
}{
{structTypeOptional{}, `{A: nil, B: nil, C: nil, D: nil}`},
{structTypeOptional{
{&structTypeOptional{}, `{A: nil, B: nil, C: nil, D: nil}`},
{&structTypeOptional{
C: "hello",
D: &optionalStructType{A: 11, B: "world"},
},
`{A: nil, B: nil, C: "hello", D: {A: 11, B: "world"}}`},
} {

if err := Write(enc, tc.input); err != nil {
if err := Write(enc, *tc.input); err != nil {
t.Fatalf("val %v: %v", tc.input, err)
}
if got, want := value.String(), typeStr+tc.output; got != want {
Expand All @@ -514,12 +514,12 @@ func TestEncodeToValueOptional(t *testing.T) {
if err := Read(value.Decoder(), &w); err != nil {
t.Fatal(err)
}
if got, want := w, tc.input; !reflect.DeepEqual(got, want) {
if got, want := w, *tc.input; !reflect.DeepEqual(got, want) {
t.Errorf("got %v, want %v", got, want)
}

// optional version.
if err := Write(enc, &tc.input); err != nil {
if err := Write(enc, tc.input); err != nil {
t.Fatalf("val %v: %v", tc.input, err)
}
if got, want := value.String(), "?"+typeStr+"("+tc.output+")"; got != want {
Expand All @@ -529,7 +529,7 @@ func TestEncodeToValueOptional(t *testing.T) {
if err := Read(value.Decoder(), &w); err != nil {
t.Fatal(err)
}
if got, want := w, tc.input; !reflect.DeepEqual(got, want) {
if got, want := w, *tc.input; !reflect.DeepEqual(got, want) {
t.Errorf("got %v, want %v", got, want)
}
}
Expand Down
Loading

0 comments on commit 3dce6c1

Please sign in to comment.