mirror of
https://github.com/owncast/owncast.git
synced 2024-11-24 21:59:43 +03:00
Use subtle.ConstantTimeCompare instead of simple string compare. Closes #2489
This commit is contained in:
parent
3894f410d2
commit
cd874cda93
1 changed files with 4 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package rtmp
|
package rtmp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/subtle"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -89,5 +90,7 @@ func secretMatch(configStreamKey string, path string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
streamingKey := path[len(prefix):] // Remove $prefix
|
streamingKey := path[len(prefix):] // Remove $prefix
|
||||||
return streamingKey == configStreamKey
|
|
||||||
|
matches := subtle.ConstantTimeCompare([]byte(streamingKey), []byte(configStreamKey)) == 1
|
||||||
|
return matches
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue