Browse Source

Use subtle.ConstantTimeCompare instead of simple string compare. Closes #2489

pull/2478/head
Gabe Kangas 3 years ago
parent
commit
cd874cda93
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
  1. 5
      core/rtmp/utils.go

5
core/rtmp/utils.go

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package rtmp
import (
"crypto/subtle"
"encoding/json"
"errors"
"fmt"
@ -89,5 +90,7 @@ func secretMatch(configStreamKey string, path string) bool { @@ -89,5 +90,7 @@ func secretMatch(configStreamKey string, path string) bool {
}
streamingKey := path[len(prefix):] // Remove $prefix
return streamingKey == configStreamKey
matches := subtle.ConstantTimeCompare([]byte(streamingKey), []byte(configStreamKey)) == 1
return matches
}

Loading…
Cancel
Save