Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion cliv2/cmd/cliv2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func logHeaderAuthorizationInfo(

err := networkAccess.AddHeaders(apiRequest)
if err != nil {
return authorization, oauthEnabled, userAgent
debugLogger.Print(err)
}

authHeader := apiRequest.Header.Get("Authorization")
Expand All @@ -370,6 +370,8 @@ func logHeaderAuthorizationInfo(
token, err := auth.GetOAuthToken(config)
if token != nil && err == nil {
tokenDetails = fmt.Sprintf(" (type=oauth; expiry=%v)", token.Expiry.UTC())
temp := sha256.Sum256([]byte(token.AccessToken))
tokenShaSum = hex.EncodeToString(temp[0:16]) + "[...]"
}
}

Expand Down
7 changes: 4 additions & 3 deletions cliv2/internal/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import (

"github.com/google/uuid"

"github.com/snyk/cli/cliv2/internal/constants"
"github.com/snyk/cli/cliv2/internal/utils"
"github.com/snyk/go-application-framework/pkg/networking/certs"
"github.com/snyk/go-httpauth/pkg/httpauth"

"github.com/snyk/cli/cliv2/internal/constants"
"github.com/snyk/cli/cliv2/internal/utils"

"github.com/elazarl/goproxy"
"github.com/elazarl/goproxy/ext/auth"
)
Expand Down Expand Up @@ -136,7 +137,7 @@ func (p *WrapperProxy) ProxyInfo() *ProxyInfo {
func (p *WrapperProxy) replaceVersionHandler(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
err := p.addHeaderFunc(r)
if err != nil {
p.DebugLogger.Printf("Failed to add header")
p.DebugLogger.Printf("Failed to add header: %s", err)
}

return r, nil
Expand Down