Skip to content

Commit

Permalink
Merge pull request #6 from CMCC-Foundation/no-shell
Browse files Browse the repository at this point in the history
Adding #nosec to trusted subprocess lines
  • Loading branch information
atakeigor authored Dec 10, 2024
2 parents f9e3654 + 2b5c3df commit de30697
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ def run_medslik_sim(self, simdir, simname, separate_slicks=False):
# Compile and start running (replacing `cd` with `cwd`)
compile_script = "MODEL_SRC/compile.sh"
run_script = "RUN.sh"
subprocess.run(["sh", compile_script], check=True, cwd=os.path.join(model_dir, "RUN"))
subprocess.run(["./" + run_script], check=True, cwd=os.path.join(model_dir, "RUN"))
subprocess.run(["sh", compile_script], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec
subprocess.run(["./" + run_script], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec

else:
# Handle separate slicks
Expand All @@ -391,8 +391,8 @@ def run_medslik_sim(self, simdir, simname, separate_slicks=False):
# Compile and start running
compile_script = "MODEL_SRC/compile.sh"
run_script = "RUN.sh"
subprocess.run(["sh", compile_script], check=True, cwd=os.path.join(model_dir, "RUN"))
subprocess.run(["./" + run_script], check=True, cwd=os.path.join(model_dir, "RUN"))
subprocess.run(["sh", compile_script], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec
subprocess.run(["./" + run_script], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec

# Copy output files (replacing `cp -r`)
output_dest = os.path.join(simdir, simname, "out_files")
Expand Down
4 changes: 2 additions & 2 deletions src/plot/plot_mdk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def create_gif(self):
{self.out_figures}/oil_concentration_{self.config['simulation']['name']}.gif"
],
# shell=True,
)
) # nosec

def plot_pyngl(
self,
Expand Down Expand Up @@ -210,7 +210,7 @@ def plot_pyngl(
],
# shell=True,
check=True,
)
) # nosec


if __name__ == "__main__":
Expand Down

0 comments on commit de30697

Please sign in to comment.