revert: secrets as []byte instead of string

Signed-off-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
Jan Larwig
2025-11-16 22:38:42 +01:00
parent aaf1889b97
commit 810f629ee8
16 changed files with 42 additions and 40 deletions
+2 -2
View File
@@ -9,12 +9,12 @@ import (
)
var _ = Describe("Common", func() {
var validSecretSourceValue string
var validSecretSourceValue []byte
const validSecretSourceEnv = "OAUTH2_PROXY_TEST_SECRET_SOURCE_ENV"
var validSecretSourceFile string
BeforeEach(func() {
validSecretSourceValue = "This is a secret source value"
validSecretSourceValue = []byte("This is a secret source value")
Expect(os.Setenv(validSecretSourceEnv, "This is a secret source env")).To(Succeed())
tmp, err := os.CreateTemp("", "oauth2-proxy-secret-source-test")
Expect(err).ToNot(HaveOccurred())
+2
View File
@@ -51,9 +51,11 @@ func validateHeaderValue(_ string, value options.HeaderValue) []string {
func validateHeaderValueClaimSource(claim options.ClaimSource) []string {
msgs := []string{}
if claim.Claim == "" {
msgs = append(msgs, "claim should not be empty")
}
if claim.BasicAuthPassword != nil {
msgs = append(msgs, prefixValues("invalid basicAuthPassword: ", validateSecretSource(*claim.BasicAuthPassword))...)
}
+2 -2
View File
@@ -30,7 +30,7 @@ var _ = Describe("Headers", func() {
Values: []options.HeaderValue{
{
SecretSource: &options.SecretSource{
Value: base64.StdEncoding.EncodeToString([]byte("secret")),
Value: []byte(base64.StdEncoding.EncodeToString([]byte("secret"))),
},
},
},
@@ -43,7 +43,7 @@ var _ = Describe("Headers", func() {
ClaimSource: &options.ClaimSource{
Claim: "email",
BasicAuthPassword: &options.SecretSource{
Value: base64.StdEncoding.EncodeToString([]byte("secret")),
Value: []byte(base64.StdEncoding.EncodeToString([]byte("secret"))),
},
},
},