mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
fix: fix upload file security issue (#1063)
* fix: fix upload file security issue * fix: fix
This commit is contained in:
parent
7b0b426a76
commit
411d76798d
@ -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) {
|
||||
// check fullFilePath is there security issue
|
||||
if strings.Contains(fullFilePath, "..") {
|
||||
return "", "", fmt.Errorf("the fullFilePath: %s is not allowed", fullFilePath)
|
||||
}
|
||||
|
||||
var fileUrl string
|
||||
var objectKey string
|
||||
var err error
|
||||
|
Loading…
x
Reference in New Issue
Block a user