소스 검색

Mask challenge password after it has been read

Herman Slatman 5 년 전
부모
커밋
fa100a5138
1개의 변경된 파일과 7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      authority/provisioner/scep.go

+ 7 - 1
authority/provisioner/scep.go

@@ -20,6 +20,8 @@ type SCEP struct {
 	Options           *Options `json:"options,omitempty"`
 	Options           *Options `json:"options,omitempty"`
 	Claims            *Claims  `json:"claims,omitempty"`
 	Claims            *Claims  `json:"claims,omitempty"`
 	claimer           *Claimer
 	claimer           *Claimer
+
+	secretChallengePassword string
 }
 }
 
 
 // GetID returns the provisioner unique identifier.
 // GetID returns the provisioner unique identifier.
@@ -73,6 +75,10 @@ func (s *SCEP) Init(config Config) (err error) {
 		return err
 		return err
 	}
 	}
 
 
+	// Mask the actual challenge value, so it won't be marshalled
+	s.secretChallengePassword = s.ChallengePassword
+	s.ChallengePassword = "*** redacted ***"
+
 	// TODO: add other, SCEP specific, options?
 	// TODO: add other, SCEP specific, options?
 
 
 	return err
 	return err
@@ -95,7 +101,7 @@ func (s *SCEP) AuthorizeSign(ctx context.Context, token string) ([]SignOption, e
 
 
 // GetChallengePassword returns the challenge password
 // GetChallengePassword returns the challenge password
 func (s *SCEP) GetChallengePassword() string {
 func (s *SCEP) GetChallengePassword() string {
-	return s.ChallengePassword
+	return s.secretChallengePassword
 }
 }
 
 
 // GetCapabilities returns the CA capabilities
 // GetCapabilities returns the CA capabilities