Do not allow \ or @ in URL

This commit is contained in:
Alexandre Iooss 2020-10-16 21:23:13 +02:00
parent fcfe69143f
commit 73a2adc055
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import (
"log"
"net"
"net/http"
"regexp"
"strings"
"github.com/markbates/pkger"
@ -17,6 +18,11 @@ import (
"gitlab.crans.org/nounous/ghostream/stream/webrtc"
)
var (
// Precompile regex
validPath = regexp.MustCompile("^/[a-z0-9_-]*$")
)
// Handle WebRTC session description exchange via POST
func viewerPostHandler(w http.ResponseWriter, r *http.Request) {
// Limit response body to 128KB

View File

@ -7,7 +7,6 @@ import (
"log"
"net/http"
"os"
"regexp"
"strings"
"github.com/markbates/pkger"
@ -42,9 +41,6 @@ var (
// Preload templates
templates *template.Template
// Precompile regex
validPath = regexp.MustCompile("^/[a-z0-9@_\\-]*/?$")
)
// Load templates with pkger