test(convert_to_pdfa): assert -- terminates option parsing before file paths
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/5223074c-1ebf-4fc0-bf80-0de8462c16a2
This commit is contained in:
@@ -38,6 +38,11 @@ class TestConvertPdfToPdfa:
|
||||
assert "pdfa-2" in cmd
|
||||
assert "--quiet" in cmd
|
||||
assert "--invalidate-digital-signatures" in cmd
|
||||
# "--" must be present to terminate option parsing and prevent paths
|
||||
# starting with "-" from being interpreted as flags (command injection guard)
|
||||
assert "--" in cmd
|
||||
assert cmd.index("--") < cmd.index("/input.pdf")
|
||||
assert cmd.index("--") < cmd.index("/output.pdf")
|
||||
assert "/input.pdf" in cmd
|
||||
assert "/output.pdf" in cmd
|
||||
|
||||
@@ -72,6 +77,8 @@ class TestConvertPdfToPdfa:
|
||||
_convert_pdf_to_pdfa("/input.pdf", "/output.pdf", fmt)
|
||||
cmd = mock_run.call_args[0][0]
|
||||
assert f"pdfa-{fmt}" in cmd
|
||||
assert "--" in cmd
|
||||
assert cmd.index("--") < cmd.index("/input.pdf")
|
||||
|
||||
def test_invalid_pdfa_format_rejected(self):
|
||||
"""Test that invalid PDF/A format values are rejected."""
|
||||
|
||||
Reference in New Issue
Block a user