1+ // There are some commands in here that are susceptible to injection. However, cog
2+ // is a vehicle to let people run their own code... so why go through the hassle of
3+ // injection? Cog is not run with any more permissions than the user code.
4+ //
5+ //nolint:gosec
16package checkpointer
27
38import (
@@ -113,7 +118,7 @@ func (c *checkpointer) Checkpoint(ctx context.Context, cogletCmd *exec.Cmd) erro
113118 return errNoCheckpointDir
114119 }
115120
116- err := os .MkdirAll (filepath .Join (c .checkpointDir , checkpointSubdirName ), 0o666 ) //nolint:gosec // coglet needs to write here
121+ err := os .MkdirAll (filepath .Join (c .checkpointDir , checkpointSubdirName ), 0o666 )
117122 if err != nil {
118123 return err
119124 }
@@ -137,7 +142,7 @@ func (c *checkpointer) Checkpoint(ctx context.Context, cogletCmd *exec.Cmd) erro
137142 cudaCmd := strings .TrimSpace (string (data ))
138143
139144 // Write said command to a file for later
140- err = os .WriteFile (filepath .Join (c .checkpointDir , cudaCmdFileName ), []byte (cudaCmd ), 0o644 ) //nolint:gosec
145+ err = os .WriteFile (filepath .Join (c .checkpointDir , cudaCmdFileName ), []byte (cudaCmd ), 0o644 )
141146 if err != nil {
142147 return err
143148 }
@@ -200,7 +205,7 @@ func (c *checkpointer) Restore(ctx context.Context) (*exec.Cmd, func(context.Con
200205 if err != nil {
201206 // If this command failed, we want to best effort try to kill the started process,
202207 // since we'll start a new one
203- restoreCmd .Process .Kill () //nolint:errcheck
208+ restoreCmd .Process .Kill () //nolint:errcheck // This is just best effort
204209
205210 return err
206211 }
@@ -210,7 +215,7 @@ func (c *checkpointer) Restore(ctx context.Context) (*exec.Cmd, func(context.Con
210215 if err := cmd .Run (); err != nil {
211216 // If this command failed, we want to best effort try to kill the started process,
212217 // since we'll start a new one
213- restoreCmd .Process .Kill () //nolint:errcheck
218+ restoreCmd .Process .Kill () //nolint:errcheck // This is just best effort
214219
215220 return err
216221 }
@@ -219,7 +224,7 @@ func (c *checkpointer) Restore(ctx context.Context) (*exec.Cmd, func(context.Con
219224 if err != nil {
220225 // If this command failed, we want to best effort try to kill the started process,
221226 // since we'll start a new one
222- restoreCmd .Process .Kill () //nolint:errcheck
227+ restoreCmd .Process .Kill () //nolint:errcheck // This is just best effort
223228
224229 return err
225230 }
0 commit comments