Skip to content
Merged
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.10.2
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
github.com/stretchr/testify v1.12.1
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
github.com/xeipuuv/gojsonschema v1.2.0
github.com/zalando/go-keyring v0.2.8
Expand Down Expand Up @@ -74,6 +74,7 @@ require (
github.com/urfave/cli/v2 v2.27.7 // indirect
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
go.opentelemetry.io/otel/log v1.47.0 // indirect
golang.org/x/image v0.41.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.3 // indirect
)
Expand Down Expand Up @@ -295,12 +296,12 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 // indirect
go.opentelemetry.io/otel v1.45.0 // indirect
go.opentelemetry.io/otel/metric v1.45.0 // indirect
go.opentelemetry.io/otel/trace v1.45.0 // indirect
go.opentelemetry.io/otel v1.47.0 // indirect
go.opentelemetry.io/otel/metric v1.47.0 // indirect
go.opentelemetry.io/otel/trace v1.47.0 // indirect
go.uber.org/mock v0.6.0 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect
golang.org/x/mod v0.41.0 // indirect
golang.org/x/net v0.62.0 // indirect
Expand Down
27 changes: 14 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand All @@ -971,8 +971,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
Expand Down Expand Up @@ -1061,8 +1061,8 @@ go.opentelemetry.io/contrib/exporters/autoexport v0.67.0 h1:4fnRcNpc6YFtG3zsFw9a
go.opentelemetry.io/contrib/exporters/autoexport v0.67.0/go.mod h1:qTvIHMFKoxW7HXg02gm6/Wofhq5p3Ib/A/NNt1EoBSQ=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0 h1:CqXxU8VOmDefoh0+ztfGaymYbhdB/tT3zs79QaZTNGY=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0/go.mod h1:BuhAPThV8PBHBvg8ZzZ/Ok3idOdhWIodywz2xEcRbJo=
go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU=
go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ=
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.18.0 h1:deI9UQMoGFgrg5iLPgzueqFPHevDl+28YKfSpPTI6rY=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.18.0/go.mod h1:PFx9NgpNUKXdf7J4Q3agRxMs3Y07QhTCVipKmLsMKnU=
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.19.0 h1:HIBTQ3VO5aupLKjC90JgMqpezVXwFuq6Ryjn0/izoag=
Expand All @@ -1085,18 +1085,18 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.42.0 h1:lSZHgNHfbmQTPf
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.42.0/go.mod h1:so9ounLcuoRDu033MW/E0AD4hhUjVqswrMF5FoZlBcw=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.42.0 h1:s/1iRkCKDfhlh1JF26knRneorus8aOwVIDhvYx9WoDw=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.42.0/go.mod h1:UI3wi0FXg1Pofb8ZBiBLhtMzgoTm1TYkMvn71fAqDzs=
go.opentelemetry.io/otel/log v0.19.0 h1:KUZs/GOsw79TBBMfDWsXS+KZ4g2Ckzksd1ymzsIEbo4=
go.opentelemetry.io/otel/log v0.19.0/go.mod h1:5DQYeGmxVIr4n0/BcJvF4upsraHjg6vudJJpnkL6Ipk=
go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M=
go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s=
go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI=
go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw=
go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY=
go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU=
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
go.opentelemetry.io/otel/sdk/log v0.19.0 h1:scYVLqT22D2gqXItnWiocLUKGH9yvkkeql5dBDiXyko=
go.opentelemetry.io/otel/sdk/log v0.19.0/go.mod h1:vFBowwXGLlW9AvpuF7bMgnNI95LiW10szrOdvzBHlAg=
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag=
go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc=
go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM=
go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
Expand All @@ -1109,8 +1109,9 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
17 changes: 17 additions & 0 deletions internal/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ func NewAstCLI(
if err != nil {
return err
}
if !skipsProxyAuthTypeValidation(cmd) {
err = wrappers.ValidateProxyAuthType()
if err != nil {
return err
}
}
// Need to check the __complete command to allow correct behavior of the autocomplete
if len(args) > 0 && cmd.Name() != params.Help && cmd.Name() != "__complete" {
_ = cmd.Help()
Expand Down Expand Up @@ -295,6 +301,17 @@ var extraFilter = map[string]map[string]string{
"sort": {},
}

// skipsProxyAuthTypeValidation identifies commands that must remain accessible to fix or inspect invalid proxy settings.
func skipsProxyAuthTypeValidation(cmd *cobra.Command) bool {
for c := cmd; c != nil; c = c.Parent() {
switch c.Name() {
case "configure", "version", "completion", params.Help, "__complete", "__completeNoDesc":
return true
}
}
return false
}

func PrintConfiguration() {
logger.PrintfIfVerbose("CLI Version: %s", params.Version)
logger.PrintIfVerbose("CLI Configuration:")
Expand Down
155 changes: 155 additions & 0 deletions internal/commands/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,158 @@ func TestOptionalFlag(t *testing.T) {
err := executeTestCommand(cmd, baseArgs...)
assert.NilError(t, err)
}

const (
classicProxyAddress = "http://classic.company.com:8080"
invalidProxyAuthType = "NotARealAuthType"
invalidProxyAuthErrMsg = "invalid proxy authentication type"
supportedProxyAuthMsg = "basic, ntlm, kerberos, kerberos-native"
)

func TestProxyAuthType_SupportedValues_Pass(t *testing.T) {
supported := []string{
"basic", "ntlm", "kerberos", "kerberos-native",
"BASIC", "NTLM", "Ntlm", "Kerberos", "KERBEROS-NATIVE",
}
for _, value := range supported {
t.Run(value, func(t *testing.T) {
execCmdNilAssertion(t, "utils", "env", "--proxy-auth-type", value)
})
}
}

func TestProxyAuthType_EmptyOrUnset_Pass(t *testing.T) {
execCmdNilAssertion(t, "utils", "env")
execCmdNilAssertion(t, "utils", "env", "--proxy-auth-type", "")
}
Comment thread
cx-atish-jadhav marked this conversation as resolved.
Resolved

func TestProxyAuthType_InvalidFlagValue_Fails(t *testing.T) {
err := execCmdNotNilAssertion(t, "utils", "env", "--proxy-auth-type", invalidProxyAuthType)
assertError(t, err, invalidProxyAuthErrMsg)
assertError(t, err, `"`+invalidProxyAuthType+`"`)
assertError(t, err, supportedProxyAuthMsg)
assertError(t, err, "--"+params.ProxyTypeFlag)
}

func TestProxyAuthType_InvalidFlagValue_WithIgnoreProxy_Fails(t *testing.T) {
err := execCmdNotNilAssertion(t, "utils", "env", "--ignore-proxy", "--proxy-auth-type", invalidProxyAuthType)
assertError(t, err, invalidProxyAuthErrMsg)
}

func TestProxyAuthType_ValidFlagValue_WithIgnoreProxy_Pass(t *testing.T) {
execCmdNilAssertion(t, "utils", "env", "--ignore-proxy", "--proxy-auth-type", "NTLM")
}

func TestProxyAuthType_InvalidEnvVar_Fails(t *testing.T) {
_ = viper.BindEnv(params.ProxyTypeKey, params.ProxyTypeEnv)
t.Setenv(params.ProxyTypeEnv, invalidProxyAuthType)
err := execCmdNotNilAssertion(t, "utils", "env")
assertError(t, err, invalidProxyAuthErrMsg)
assertError(t, err, params.ProxyTypeEnv)
}

func TestProxyAuthType_UppercaseEnvVar_Pass(t *testing.T) {
_ = viper.BindEnv(params.ProxyTypeKey, params.ProxyTypeEnv)
t.Setenv(params.ProxyTypeEnv, "NTLM")
execCmdNilAssertion(t, "utils", "env")
}

func writeProxyAuthConfigFile(t *testing.T, value string) string {
t.Helper()
configPath := filepath.Join(t.TempDir(), "checkmarxcli.yaml")
content := fmt.Sprintf("%s: %s\n", params.ProxyTypeKey, value)
assert.NilError(t, os.WriteFile(configPath, []byte(content), 0o600))
return configPath
}

func TestProxyAuthType_InvalidConfigFileValue_Fails(t *testing.T) {
configPath := writeProxyAuthConfigFile(t, invalidProxyAuthType)
err := execCmdNotNilAssertion(t, "utils", "env", "--config-file-path", configPath)
assertError(t, err, invalidProxyAuthErrMsg)
assertError(t, err, params.ProxyTypeKey)
}

func TestProxyAuthType_UppercaseConfigFileValue_Pass(t *testing.T) {
configPath := writeProxyAuthConfigFile(t, "KERBEROS")
execCmdNilAssertion(t, "utils", "env", "--config-file-path", configPath)
}

func TestProxyAuthType_ProxyAddressIsNotValidated(t *testing.T) {
addresses := []string{
classicProxyAddress,
"http://user:pass@proxy.example.com:3128",
"proxy.example.com:8080",
}
for _, address := range addresses {
t.Run(address, func(t *testing.T) {
execCmdNilAssertion(t, "utils", "env", "--proxy", address)
execCmdNilAssertion(t, "utils", "env", "--proxy", address, "--proxy-auth-type", "NTLM")
})
}
}

func TestProxyAuthType_InvalidTypeWithValidProxyAddress_ReportsAuthType(t *testing.T) {
err := execCmdNotNilAssertion(t, "utils", "env", "--proxy", classicProxyAddress, "--proxy-auth-type", invalidProxyAuthType)
assertError(t, err, invalidProxyAuthErrMsg)
assert.Assert(t, !strings.Contains(err.Error(), "classic.company.com"), "error must not blame the proxy address")
}

func commandChain(names ...string) *cobra.Command {
parent := &cobra.Command{Use: "cx"}
for _, name := range names {
child := &cobra.Command{Use: name}
parent.AddCommand(child)
parent = child
}
return parent
}

func TestSkipsProxyAuthTypeValidation(t *testing.T) {
exempt := [][]string{
{"configure"}, {"configure", "set"}, {"configure", "show"}, {"version"}, {"help"},
{"completion"}, {"utils", "completion"}, {"__complete"}, {"__completeNoDesc"},
}
for _, names := range exempt {
t.Run("exempt "+strings.Join(names, " "), func(t *testing.T) {
assert.Assert(t, skipsProxyAuthTypeValidation(commandChain(names...)))
})
}

validated := [][]string{
{"scan", "create"}, {"auth", "validate"}, {"utils", "env"}, {"project", "list"}, {"results", "show"},
}
for _, names := range validated {
t.Run("validated "+strings.Join(names, " "), func(t *testing.T) {
assert.Assert(t, !skipsProxyAuthTypeValidation(commandChain(names...)))
})
}
}

func TestProxyAuthType_InvalidConfigFileValue_DoesNotBlockRecoveryCommands(t *testing.T) {
configPath := writeProxyAuthConfigFile(t, invalidProxyAuthType)
recoveryCommands := [][]string{{"version"}, {"help"}, {"configure", "show"}}
for _, args := range recoveryCommands {
t.Run(strings.Join(args, " "), func(t *testing.T) {
execCmdNilAssertion(t, append(args, "--config-file-path", configPath)...)
})
}
}

func TestProxyAuthType_InvalidEnvVar_DoesNotBlockVersion(t *testing.T) {
_ = viper.BindEnv(params.ProxyTypeKey, params.ProxyTypeEnv)
t.Setenv(params.ProxyTypeEnv, invalidProxyAuthType)
execCmdNilAssertion(t, "version")
}

func TestProxyAuthType_ConfigureSetRepairsInvalidPersistedValue(t *testing.T) {
configPath := writeProxyAuthConfigFile(t, invalidProxyAuthType)

err := execCmdNotNilAssertion(t, "utils", "env", "--config-file-path", configPath)
assertError(t, err, invalidProxyAuthErrMsg)

execCmdNilAssertion(
t, "configure", "set", "--prop-name", params.ProxyTypeKey, "--prop-value", "basic", "--config-file-path", configPath,
)

execCmdNilAssertion(t, "utils", "env", "--config-file-path", configPath)
}
35 changes: 33 additions & 2 deletions internal/wrappers/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/url"
"os"
"runtime"
"slices"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -51,8 +52,17 @@ const (
defaultDialerDuration = 30 * time.Second
)

const (
basicProxyToken = "basic"
Comment thread
cx-atish-jadhav marked this conversation as resolved.
Resolved
kerberosNativeProxyToken = "kerberos-native"
invalidProxyAuthTypeFmt = "invalid proxy authentication type %q: supported types are %s " +
"(set via --%s, %s or the %s config key)"
)

var (
credentialsMutex sync.Mutex

supportedProxyAuthTypes = []string{basicProxyToken, ntlmProxyToken, kerberosProxyToken, kerberosNativeProxyToken}
)

type ClientCredentialsInfo struct {
Expand Down Expand Up @@ -151,8 +161,25 @@ func setAgentNameAndOrigin(req *http.Request, isAuth bool) {
}
}

func normalizeProxyAuthType(proxyAuthType string) string {
return strings.ToLower(strings.TrimSpace(proxyAuthType))
}

// ValidateProxyAuthType validates the configured proxy authentication type. An empty value defaults to basic.
func ValidateProxyAuthType() error {
configured := viper.GetString(commonParams.ProxyTypeKey)
normalized := normalizeProxyAuthType(configured)
if normalized == "" || slices.Contains(supportedProxyAuthTypes, normalized) {
return nil
}
return errors.Errorf(
invalidProxyAuthTypeFmt, configured, strings.Join(supportedProxyAuthTypes, ", "),
commonParams.ProxyTypeFlag, commonParams.ProxyTypeEnv, commonParams.ProxyTypeKey,
)
}

func GetClient(timeout uint) *http.Client {
proxyTypeStr := viper.GetString(commonParams.ProxyTypeKey)
proxyTypeStr := normalizeProxyAuthType(viper.GetString(commonParams.ProxyTypeKey))
proxyStr := viper.GetString(commonParams.ProxyKey)
ignoreProxy := viper.GetBool(commonParams.IgnoreProxyKey)

Expand All @@ -163,9 +190,13 @@ func GetClient(timeout uint) *http.Client {
client = ntmlProxyClient(timeout, proxyStr)
} else if proxyTypeStr == kerberosProxyToken {
client = kerberosProxyClient(timeout, proxyStr)
} else if proxyTypeStr == "kerberos-native" {
} else if proxyTypeStr == kerberosNativeProxyToken {
Comment thread
cx-atish-jadhav marked this conversation as resolved.
Resolved
client = kerberosNativeProxyClient(timeout, proxyStr)
} else {
// Unknown values are rejected by the root PersistentPreRunE; commands that skip it end up here.
if proxyTypeStr != "" && proxyTypeStr != basicProxyToken {
logger.PrintIfVerbose(fmt.Sprintf("Unrecognized proxy authentication type %q, falling back to basic", proxyTypeStr))
}
client = basicProxyClient(timeout, proxyStr)
}

Expand Down
Loading
Loading