mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
Clean Path on routing to mitigate directory traversal, bump version to 0.4.1
This commit is contained in:
parent
49569b306a
commit
74b0382ab6
@ -22,7 +22,7 @@ var (
|
||||
prefetch, proxyMode bool
|
||||
remoteRaw = "remote-raw"
|
||||
config Config
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
releaseUrl = "https://github.com/webp-sh/webp_server_go/releases/latest/download/"
|
||||
)
|
||||
|
||||
|
@ -16,6 +16,10 @@ import (
|
||||
func convert(c *fiber.Ctx) error {
|
||||
//basic vars
|
||||
var reqURI, _ = url.QueryUnescape(c.Path()) // /mypic/123.jpg
|
||||
|
||||
// delete ../ in reqURI to mitigate directory traversal
|
||||
reqURI = path.Clean(reqURI)
|
||||
|
||||
var rawImageAbs string
|
||||
if proxyMode {
|
||||
rawImageAbs = config.ImgPath + reqURI
|
||||
|
Loading…
x
Reference in New Issue
Block a user