Skip to content

Commit

Permalink
Mask challenge password after it has been read
Browse files Browse the repository at this point in the history
  • Loading branch information
hslatman committed Apr 16, 2021
1 parent 0487686 commit 9787728
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion authority/provisioner/scep.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type SCEP struct {
Options *Options `json:"options,omitempty"`
Claims *Claims `json:"claims,omitempty"`
claimer *Claimer

secretChallengePassword string
}

// GetID returns the provisioner unique identifier.
Expand Down Expand Up @@ -73,6 +75,10 @@ func (s *SCEP) Init(config Config) (err error) {
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?

return err
Expand All @@ -95,7 +101,7 @@ func (s *SCEP) AuthorizeSign(ctx context.Context, token string) ([]SignOption, e

// GetChallengePassword returns the challenge password
func (s *SCEP) GetChallengePassword() string {
return s.ChallengePassword
return s.secretChallengePassword
}

// GetCapabilities returns the CA capabilities
Expand Down

0 comments on commit 9787728

Please sign in to comment.