mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-28 04:05:21 +08:00
improve (crypto): derivate secret_key for each usage to reduce attack surface in the worst case scenario
This commit is contained in:
@ -261,7 +261,7 @@ func ShareProofGetAlreadyVerified(req *http.Request) []Proof {
|
||||
if len(cookieValue) > 500 {
|
||||
return p
|
||||
}
|
||||
j, err := DecryptString(SECRET_KEY, cookieValue)
|
||||
j, err := DecryptString(SECRET_KEY_DERIVATE_FOR_PROOF, cookieValue)
|
||||
if err != nil {
|
||||
return p
|
||||
}
|
||||
@ -306,7 +306,7 @@ func shareProofAreEquivalent(ref Proof, p Proof) bool {
|
||||
}
|
||||
for _, chunk := range strings.Split(ref.Value, ",") {
|
||||
chunk = strings.Trim(chunk, " ")
|
||||
if p.Id == Hash(ref.Key + "::" + chunk) {
|
||||
if p.Id == Hash(ref.Key + "::" + chunk, 20) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user