Skip to content

SEC: Block shell escapes in latex and ps commands#31282

Merged
WeatherGod merged 1 commit intomatplotlib:mainfrom
scottshambaugh:tex_no_shell
Mar 13, 2026
Merged

SEC: Block shell escapes in latex and ps commands#31282
WeatherGod merged 1 commit intomatplotlib:mainfrom
scottshambaugh:tex_no_shell

Conversation

@scottshambaugh
Copy link
Copy Markdown
Contributor

@scottshambaugh scottshambaugh commented Mar 11, 2026

PR summary

See the discussion in #31249

This blocks our LaTeX and ps commands from arbitrary code execution in the shell:

AI Disclosure

Claude used for the audit (found a few more spots to hit!), code manually reviewed

PR checklist

@scottshambaugh scottshambaugh added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Mar 11, 2026
@tacaswell
Copy link
Copy Markdown
Member

Looks like the -R0 came in in 2006 via c0d6110 (in the SVN days!).

@tacaswell tacaswell added this to the v3.11.0 milestone Mar 11, 2026
@scottshambaugh
Copy link
Copy Markdown
Contributor Author

It's possible switching away from -R0 breaks something, but we should fix it some other way should that be the case.

Copy link
Copy Markdown
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am indifferent to settling on one or two - on latex cli args or leaving as-is.

@scottshambaugh scottshambaugh added the Security Hardening Proactive security hardening. Existing vulnerabilities should be reported per our security policy label Mar 12, 2026
@WeatherGod
Copy link
Copy Markdown
Member

In principle, I approve these changes, but I don't know if the test failure is one of the spurious failures or actually related to these changes.

@tacaswell
Copy link
Copy Markdown
Member

Someone must have re-run them, I'm only seeing a codecov failures but it is short an upload so I am not worried.

@WeatherGod WeatherGod merged commit 8ff895d into matplotlib:main Mar 13, 2026
63 of 67 checks passed
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend: pgf backend: ps Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. Security Hardening Proactive security hardening. Existing vulnerabilities should be reported per our security policy status: needs manual backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants