Revert "internal/config: Cache csrf secret"
This reverts commit dfb97405ed.
This commit is contained in:
parent
dfb97405ed
commit
50dc4f3a2e
1 changed files with 9 additions and 15 deletions
|
|
@ -7,7 +7,6 @@ import (
|
|||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/tkw1536/pkglib/lazy"
|
||||
"github.com/tkw1536/pkglib/reflectx"
|
||||
"github.com/tkw1536/pkglib/yamlx"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
|
@ -47,9 +46,6 @@ type Config struct {
|
|||
|
||||
// ConfigPath is the path this configuration was loaded from (if any)
|
||||
ConfigPath string `yaml:"-"`
|
||||
|
||||
// csrfSecret holds the cached csrf secret
|
||||
csrfSecret lazy.Lazy[[]byte]
|
||||
}
|
||||
|
||||
func zeroSensitive(v reflect.Value) {
|
||||
|
|
@ -117,7 +113,6 @@ func Marshal(config *Config, previous []byte) ([]byte, error) {
|
|||
|
||||
// CSRFSecret return the csrfSecret derived from the session secret
|
||||
func (config *Config) CSRFSecret() []byte {
|
||||
return config.csrfSecret.Get(func() []byte {
|
||||
// take the hash of the secret
|
||||
h := fnv.New32a()
|
||||
h.Write([]byte(config.SessionSecret))
|
||||
|
|
@ -129,5 +124,4 @@ func (config *Config) CSRFSecret() []byte {
|
|||
secret := make([]byte, 32)
|
||||
rand.Read(secret)
|
||||
return secret
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue