Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions .github/actions/run-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.16-alpine3.14
FROM golang:1.16-alpine3.15

RUN apk add gcc pkgconfig libc-dev make
RUN apk add --no-cache libgit2-dev~=1.1
RUN apk add --no-cache libgit2-dev~=1.3

# Use the GitHub Actions uid:gid combination for proper fs permissions
RUN addgroup -g 116 -S test && adduser -u 1001 -S -g test test
USER test

ENTRYPOINT ["/bin/sh", "-c"]
ENTRYPOINT ["/bin/sh", "-c"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/google/go-containerregistry v0.6.0
github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20210610160139-c086c7f16d4e
github.com/jinzhu/gorm v1.9.12 // indirect
github.com/libgit2/git2go/v31 v31.4.14
github.com/libgit2/git2go/v33 v33.0.4
github.com/matthewmcnew/archtest v0.0.0-20191014222827-a111193b50ad
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
github.com/pkg/errors v0.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,8 @@ github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.1/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/libgit2/git2go/v31 v31.4.14 h1:6GOd3965D9e/+gjxCwZF4eQ+vB9kKB4yKFqdQr6XZ2E=
github.com/libgit2/git2go/v31 v31.4.14/go.mod h1:c/rkJcBcUFx6wHaT++UwNpKvIsmPNqCeQ/vzO4DrEec=
github.com/libgit2/git2go/v33 v33.0.4 h1:37xovFBzibhDEdQRLbfWwx3a44JhOIY06UICn2teenc=
github.com/libgit2/git2go/v33 v33.0.4/go.mod h1:KdpqkU+6+++4oHna/MIOgx4GCQ92IPCdpVRMRI80J+4=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/build/v1alpha2/builder_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v1alpha2
import (
"context"
"fmt"

"knative.dev/pkg/apis"

"github.com/pivotal/kpack/pkg/apis/build/v1alpha1"
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/build/v1alpha2/source_resolver_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v1alpha2
import (
"context"
"fmt"

"knative.dev/pkg/apis"

"github.com/pivotal/kpack/pkg/apis/build/v1alpha1"
Expand Down
26 changes: 15 additions & 11 deletions pkg/git/certificate_check_callback.go
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
package git

import (
git2go "github.com/libgit2/git2go/v31"

"log"

git2go "github.com/libgit2/git2go/v33"
"github.com/pkg/errors"
)

func certificateCheckCallback(logger *log.Logger) git2go.CertificateCheckCallback {
return func(cert *git2go.Certificate, valid bool, hostname string) git2go.ErrorCode {
return func(cert *git2go.Certificate, valid bool, hostname string) error {
if valid {
return git2go.ErrOk
return nil
}

if cert.Kind == git2go.CertificateX509 {
if cert.X509 != nil {
err := cert.X509.VerifyHostname(hostname)
if err != nil {
logger.Println("host name could not be verified")
return git2go.ErrAuth
msg := "host name could not be verified"
logger.Println(msg)
return errors.Wrap(err, msg)
}
}
} else if cert.Kind == git2go.CertificateHostkey {
if cert.Hostkey.Kind == git2go.HostkeyMD5 {
if !isByteArrayEmpty(cert.Hostkey.HashMD5[:]) {
logger.Println("invalid host key MD5")
return git2go.ErrAuth
msg := "invalid host key MD5"
logger.Println(msg)
return errors.New(msg)
}
} else if cert.Hostkey.Kind == git2go.HostkeySHA1 {
if !isByteArrayEmpty(cert.Hostkey.HashSHA1[:]) {
logger.Println("invalid host key SHA1")
return git2go.ErrAuth
msg := "invalid host key SHA1"
logger.Println(msg)
return errors.New(msg)
}
}
}

return git2go.ErrorCodeOK
return nil
}

}
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path"

"github.com/BurntSushi/toml"
git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/git/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"

"github.com/BurntSushi/toml"
git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/pkg/errors"
"github.com/sclevine/spec"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/git_keychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sort"
"strings"

git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/pkg/errors"
giturls "github.com/whilp/git-urls"
"golang.org/x/crypto/ssh"
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/git_keychain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path"
"testing"

git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/sclevine/spec"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/k8s_git_keychain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"encoding/pem"
"testing"

git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/sclevine/spec"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/proxy.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package git

import (
git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
giturls "github.com/whilp/git-urls"
"golang.org/x/net/http/httpproxy"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/sclevine/spec"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/git/remote_git_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"strings"

git2go "github.com/libgit2/git2go/v31"
git2go "github.com/libgit2/git2go/v33"
"github.com/pkg/errors"

corev1alpha1 "github.com/pivotal/kpack/pkg/apis/core/v1alpha1"
Expand Down