fix: sanitize os.system() shell injection in manimgl scene templates

os.system(f"manimgl {__file__} ClassName") interpolates the script's own
path into a shell string. These templates are meant to be copied and
renamed per-scene by an agent, so a scene/folder name containing shell
metacharacters is a real injection path, not just malformed input.

Switched to subprocess.run() with an argument list (no shell=True), so
there's nothing left for a shell to interpret regardless of what the
path contains. Same fix applied in both duplicate locations
(.claude/skills and .agents/skills) since the files are identical.

Reviewed scripts/lib/tts.mjs's child_process usage as part of the same
report -- not included in this PR, it already passes args as a real
array with no shell:true anywhere in the call chain, so it isn't
actually exploitable.
This commit is contained in:
Chris Brown
2026-07-21 11:26:42 -05:00
parent db91727598
commit 85a63471a2
6 changed files with 12 additions and 12 deletions

View File

@@ -254,5 +254,5 @@ class LightingTemplate(Scene):
if __name__ == "__main__":
import os
os.system(f"manimgl {__file__} ThreeDSceneTemplate")
import subprocess
subprocess.run(["manimgl", __file__, "ThreeDSceneTemplate"])

View File

@@ -130,5 +130,5 @@ class AnimationShowcase(Scene):
if __name__ == "__main__":
# This allows you to run: python basic_scene.py
# (though using manimgl is recommended)
import os
os.system(f"manimgl {__file__} BasicSceneTemplate")
import subprocess
subprocess.run(["manimgl", __file__, "BasicSceneTemplate"])

View File

@@ -329,5 +329,5 @@ class MatrixTemplate(Scene):
if __name__ == "__main__":
import os
os.system(f"manimgl {__file__} MathSceneTemplate")
import subprocess
subprocess.run(["manimgl", __file__, "MathSceneTemplate"])

View File

@@ -254,5 +254,5 @@ class LightingTemplate(Scene):
if __name__ == "__main__":
import os
os.system(f"manimgl {__file__} ThreeDSceneTemplate")
import subprocess
subprocess.run(["manimgl", __file__, "ThreeDSceneTemplate"])

View File

@@ -130,5 +130,5 @@ class AnimationShowcase(Scene):
if __name__ == "__main__":
# This allows you to run: python basic_scene.py
# (though using manimgl is recommended)
import os
os.system(f"manimgl {__file__} BasicSceneTemplate")
import subprocess
subprocess.run(["manimgl", __file__, "BasicSceneTemplate"])

View File

@@ -329,5 +329,5 @@ class MatrixTemplate(Scene):
if __name__ == "__main__":
import os
os.system(f"manimgl {__file__} MathSceneTemplate")
import subprocess
subprocess.run(["manimgl", __file__, "MathSceneTemplate"])