@@ -169,19 +169,24 @@ func parseBatchSpec(schema string, data []byte) (*BatchSpec, error) {
169169
170170 for i , step := range spec .Steps {
171171 for _ , mount := range step .Mount {
172- if strings .Contains (mount .Path , invalidMountCharacters ) {
172+ if strings .ContainsAny (mount .Path , invalidMountCharacters ) {
173173 errs = errors .Append (errs , NewValidationError (errors .Newf ("step %d mount path contains invalid characters" , i + 1 )))
174174 }
175- if strings .Contains (mount .Mountpoint , invalidMountCharacters ) {
175+ if strings .ContainsAny (mount .Mountpoint , invalidMountCharacters ) {
176176 errs = errors .Append (errs , NewValidationError (errors .Newf ("step %d mount mountpoint contains invalid characters" , i + 1 )))
177177 }
178178 }
179+ for name := range step .Files {
180+ if strings .ContainsAny (name , invalidMountCharacters ) {
181+ errs = errors .Append (errs , NewValidationError (errors .Newf ("step %d files target path contains invalid characters" , i + 1 )))
182+ }
183+ }
179184 }
180185
181186 return & spec , errs
182187}
183-
184- const invalidMountCharacters = ","
188+ // docker uses Golang's `encoding/csv` library to parse arguments passed to `--mount`
189+ const invalidMountCharacters = ",\" \n \r "
185190
186191func (on * OnQueryOrRepository ) String () string {
187192 if on .RepositoriesMatchingQuery != "" {
0 commit comments