Skip to content

Commit

Permalink
Add check for illegal upload-artifact@v4 filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuswhybrow committed Apr 27, 2024
1 parent e69cd5c commit ccf08b3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/utils/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path"
"path/filepath"
"slices"
"strings"
"sync"

"github.com/marcuswhybrow/ray-peat-rodeo/internal/global"
Expand Down Expand Up @@ -50,6 +51,17 @@ var builtFilesMutex sync.RWMutex
func MakeFile(outPath string) (*os.File, string) {
buildPath := path.Join(global.BUILD_OUTPUT, outPath)
parent := filepath.Dir(buildPath)
illegalChars := "\":<>|*?\r\n"

if strings.ContainsAny(outPath, illegalChars) {
log.Fatalf("Failed to create build file '%v': "+
"name contains an illegal character. "+
"Illegal characters include: %v",
outPath,
illegalChars,
)

}

err := os.MkdirAll(parent, 0755)
if err != nil {
Expand Down

0 comments on commit ccf08b3

Please sign in to comment.