[pp/exec] Restrict --exec template usage to safe conversions (#16883)
Challenge Tests / Challenge tests (ubuntu-latest, 3.10) (push) Has been cancelled
Challenge Tests / Challenge tests (ubuntu-latest, 3.11) (push) Has been cancelled
Challenge Tests / Challenge tests (ubuntu-latest, 3.12) (push) Has been cancelled
Challenge Tests / Challenge tests (ubuntu-latest, 3.13) (push) Has been cancelled
Challenge Tests / Challenge tests (ubuntu-latest, 3.14) (push) Has been cancelled
Challenge Tests / Challenge tests (ubuntu-latest, 3.15) (push) Has been cancelled
Challenge Tests / Challenge tests (ubuntu-latest, pypy-3.11) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, 3.10) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, 3.11) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, 3.12) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, 3.13) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, 3.14) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, 3.15) (push) Has been cancelled
Challenge Tests / Challenge tests (windows-latest, pypy-3.11) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Core Tests / Core tests (ubuntu-latest, 3.11) (push) Has been cancelled
Core Tests / Core tests (ubuntu-latest, 3.12) (push) Has been cancelled
Core Tests / Core tests (ubuntu-latest, 3.13) (push) Has been cancelled
Core Tests / Core tests (ubuntu-latest, 3.14) (push) Has been cancelled
Core Tests / Core tests (ubuntu-latest, 3.15) (push) Has been cancelled
Core Tests / Core tests (ubuntu-latest, pypy-3.11) (push) Has been cancelled
Core Tests / Core tests (windows-latest, 3.10) (push) Has been cancelled
Core Tests / Core tests (windows-latest, 3.11) (push) Has been cancelled
Core Tests / Core tests (windows-latest, 3.12) (push) Has been cancelled
Core Tests / Core tests (windows-latest, 3.13) (push) Has been cancelled
Core Tests / Core tests (windows-latest, 3.14) (push) Has been cancelled
Core Tests / Core tests (windows-latest, 3.15) (push) Has been cancelled
Core Tests / Core tests (windows-latest, pypy-3.11) (push) Has been cancelled
Quick Test / Core test (push) Has been cancelled
Quick Test / Code check (push) Has been cancelled
Release (master) / Publish GitHub release (push) Has been cancelled
Test and lint workflows / Check workflows (push) Has been cancelled
Test and lint workflows / Run zizmor (push) Has been cancelled
Release (master) / Publish to PyPI (push) Has been cancelled
Update wiki / Update wiki (push) Has been cancelled
Release (nightly) / Check for new commits (push) Has been cancelled
Release (nightly) / Publish GitHub release (push) Has been cancelled
Release (nightly) / Publish to PyPI (push) Has been cancelled

Authored by: bashonly
This commit is contained in:
bashonly
2026-06-06 21:24:53 +00:00
committed by GitHub
parent 7aac95eae6
commit 5faffa999f
7 changed files with 103 additions and 15 deletions
+10 -1
View File
@@ -5,8 +5,17 @@ from ..utils import Popen, PostProcessingError, shell_quote, variadic
class ExecPP(PostProcessor):
def __init__(self, downloader, exec_cmd):
PostProcessor.__init__(self, downloader)
# Need to set exec_cmd attribute before set_downloader is called by PostProcessor.__init__
self.exec_cmd = variadic(exec_cmd)
PostProcessor.__init__(self, downloader)
def set_downloader(self, downloader):
super().set_downloader(downloader)
# Validate safety of exec commands
params = getattr(self._downloader, 'params', None)
if params and 'allow-unsafe-exec-expansion' not in params['compat_opts']:
for cmd in self.exec_cmd:
_ = self._downloader.prepare_outtmpl(cmd, {}, _exec=True)
def parse_cmd(self, cmd, info):
tmpl, tmpl_dict = self._downloader.prepare_outtmpl(cmd, info)