Skip to content

Commit

Permalink
fix: fix upload file security issue (#1063)
Browse files Browse the repository at this point in the history
* fix: fix upload file security issue

* fix: fix
  • Loading branch information
qianxi0410 committed Aug 25, 2022
1 parent 7b0b426 commit 411d767
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions object/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 411d767

Please sign in to comment.