security: remediate vulnerabilities and issues from codebase audit
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m15s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m15s
This commit is contained in:
parent
b60a09196a
commit
fb3f3a3393
15 changed files with 465 additions and 208 deletions
|
|
@ -208,13 +208,11 @@ func UnzipAsync(taskID string, sourceFull, destFolder string) {
|
|||
|
||||
for i, f := range r.File {
|
||||
// Prevent Zip Slip vulnerability
|
||||
cleanPath := filepath.Clean(f.Name)
|
||||
if strings.HasPrefix(cleanPath, "..") {
|
||||
fpath := filepath.Join(destFolder, f.Name)
|
||||
if !strings.HasPrefix(fpath, filepath.Clean(destFolder)+string(os.PathSeparator)) {
|
||||
continue // Skip malicious paths
|
||||
}
|
||||
|
||||
fpath := filepath.Join(destFolder, cleanPath)
|
||||
|
||||
if f.FileInfo().IsDir() {
|
||||
os.MkdirAll(fpath, os.ModePerm)
|
||||
continue
|
||||
|
|
|
|||
Reference in a new issue