mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-02 05:54:21 +01:00
single commit and bumping go-git version
This commit is contained in:
1 parent
3b45fb91e3
commit
15dedda59a
48 files changed
+1453
-390
No files matched your search
+21
-1
@@ -4,6 +4,7 @@ package http
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -151,6 +152,18 @@ func (s *session) ModifyEndpointIfRedirect(res *http.Response) {
|
||||
return
|
||||
}
|
||||
|
||||
h, p, err := net.SplitHostPort(r.URL.Host)
|
||||
if err != nil {
|
||||
h = r.URL.Host
|
||||
}
|
||||
if p != "" {
|
||||
port, err := strconv.Atoi(p)
|
||||
if err == nil {
|
||||
s.endpoint.Port = port
|
||||
}
|
||||
}
|
||||
s.endpoint.Host = h
|
||||
|
||||
s.endpoint.Protocol = r.URL.Scheme
|
||||
s.endpoint.Path = r.URL.Path[:len(r.URL.Path)-len(infoRefsPath)]
|
||||
}
|
||||
@@ -201,7 +214,14 @@ func (a *BasicAuth) String() string {
|
||||
return fmt.Sprintf("%s - %s:%s", a.Name(), a.Username, masked)
|
||||
}
|
||||
|
||||
// TokenAuth implements the go-git http.AuthMethod and transport.AuthMethod interfaces
|
||||
// TokenAuth implements an http.AuthMethod that can be used with http transport
|
||||
// to authenticate with HTTP token authentication (also known as bearer
|
||||
// authentication).
|
||||
//
|
||||
// IMPORTANT: If you are looking to use OAuth tokens with popular servers (e.g.
|
||||
// GitHub, Bitbucket, GitLab) you should use BasicAuth instead. These servers
|
||||
// use basic HTTP authentication, with the OAuth token as user or password.
|
||||
// Check the documentation of your git server for details.
|
||||
type TokenAuth struct {
|
||||
Token string
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/cache"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/storer"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing/transport"
|
||||
"gopkg.in/src-d/go-git.v4/storage/filesystem"
|
||||
@@ -43,7 +44,7 @@ func (l *fsLoader) Load(ep *transport.Endpoint) (storer.Storer, error) {
|
||||
return nil, transport.ErrRepositoryNotFound
|
||||
}
|
||||
|
||||
return filesystem.NewStorage(fs)
|
||||
return filesystem.NewStorage(fs, cache.NewObjectLRUDefault()), nil
|
||||
}
|
||||
|
||||
// MapLoader is a Loader that uses a lookup map of storer.Storer by
|
||||
|
||||
+8
-6
@@ -236,7 +236,7 @@ func (a *PublicKeysCallback) ClientConfig() (*ssh.ClientConfig, error) {
|
||||
// NewKnownHostsCallback returns ssh.HostKeyCallback based on a file based on a
|
||||
// known_hosts file. http://man.openbsd.org/sshd#SSH_KNOWN_HOSTS_FILE_FORMAT
|
||||
//
|
||||
// If files is empty, the list of files will be read from the SSH_KNOWN_HOSTS
|
||||
// If list of files is empty, then it will be read from the SSH_KNOWN_HOSTS
|
||||
// environment variable, example:
|
||||
// /home/foo/custom_known_hosts_file:/etc/custom_known/hosts_file
|
||||
//
|
||||
@@ -244,13 +244,15 @@ func (a *PublicKeysCallback) ClientConfig() (*ssh.ClientConfig, error) {
|
||||
// ~/.ssh/known_hosts
|
||||
// /etc/ssh/ssh_known_hosts
|
||||
func NewKnownHostsCallback(files ...string) (ssh.HostKeyCallback, error) {
|
||||
files, err := getDefaultKnownHostsFiles()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var err error
|
||||
|
||||
if len(files) == 0 {
|
||||
if files, err = getDefaultKnownHostsFiles(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
files, err = filterKnownHostsFiles(files...)
|
||||
if err != nil {
|
||||
if files, err = filterKnownHostsFiles(files...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user