1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-06-17 22:37:33 +02:00

Fix path before signature check

This commit is contained in:
DarthSim
2022-09-15 22:36:47 +06:00
parent 30f744e116
commit 0dc16ba76b
2 changed files with 4 additions and 8 deletions

View File

@ -217,14 +217,10 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
))
}
if err := security.VerifySignature(signature, path); err != nil {
// Some proxy servers may normalize URL and make signature invalid.
// Try to fix the path and repeat the check
path = fixPath(path)
path = fixPath(path)
if err = security.VerifySignature(signature, path); err != nil {
sendErrAndPanic(ctx, "security", ierrors.New(403, err.Error(), "Forbidden"))
}
if err := security.VerifySignature(signature, path); err != nil {
sendErrAndPanic(ctx, "security", ierrors.New(403, err.Error(), "Forbidden"))
}
po, imageURL, err := options.ParsePath(path, r.Header)