chore: do not save input file

the user invokes the input already got the input but those content could be sensitive to another user who received this bundle
This commit is contained in:
York Chen
2023-11-01 16:34:35 -04:00
parent d9314797c7
commit 6af77ad1ce

View File

@@ -79,15 +79,10 @@ func (c *CollectHostRun) Collect(progressChan chan<- interface{}) (map[string][]
if err != nil {
return nil, errors.New("failed to created temp dir for host run input")
}
for inFilename, inFileContent := range runHostCollector.Input {
if strings.Contains(inFileContent, "/") {
for inFilename := range runHostCollector.Input {
if strings.Contains(inFilename, "/") {
return nil, errors.New("Input filename contains '/'")
}
cmdInputFilePath := filepath.Join(cmdInputTempDir, inFilename)
err = os.WriteFile(cmdInputFilePath, []byte(inFileContent), 0644)
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("failed to write input file: %s to temp directory", inFilename))
}
}
cmd.Env = append(cmd.Env,
fmt.Sprintf("TS_INPUT_DIR=%s", cmdInputTempDir),