mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-09 20:52:57 +08:00
fix: fix upload file security issue (#1063)
* fix: fix upload file security issue * fix: fix
This commit is contained in:
@@ -103,6 +103,11 @@ func uploadFile(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffe
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer) (string, string, error) {
|
func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer) (string, string, error) {
|
||||||
|
// check fullFilePath is there security issue
|
||||||
|
if strings.Contains(fullFilePath, "..") {
|
||||||
|
return "", "", fmt.Errorf("the fullFilePath: %s is not allowed", fullFilePath)
|
||||||
|
}
|
||||||
|
|
||||||
var fileUrl string
|
var fileUrl string
|
||||||
var objectKey string
|
var objectKey string
|
||||||
var err error
|
var err error
|
||||||
|
Reference in New Issue
Block a user