Skip to content

Commit

Permalink
Check that shell access is unrestricted before attempting shell escape
Browse files Browse the repository at this point in the history
Closes #365.
  • Loading branch information
Witiko committed Nov 15, 2023
1 parent c109d22 commit ad81d0d
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -32565,7 +32565,51 @@ end
\ExplSyntaxOn
\cs_new:Npn
\markdownLuaExecute
{ \luabridgeExecute }
#1
{
\int_compare:nNnT
{ \g_luabridge_method_int }
=
{ \c_luabridge_method_shell_int }
{
\sys_if_shell_unrestricted:F
{
\sys_if_shell:TF
{
\msg_error:nn
{ markdown }
{ restricted-shell-access }
}
{
\msg_error:nn
{ markdown }
{ disabled-shell-access }
}
}
}
\luabridge_now:e
{ #1 }
}
\cs_generate_variant:Nn
\msg_new:nnnn
{ nnnV }
\tl_set:Nn
\l_tmpa_tl
{
You~may~need~to~run~TeX~with~the~--shell-escape~or~the~
--enable-write18~flag,~or~write~shell_escape=t~in~the~
texmf.cnf~file.
}
\msg_new:nnnV
{ markdown }
{ restricted-shell-access }
{ Shell~escape~is~restricted }
\l_tmpa_tl
\msg_new:nnnV
{ markdown }
{ disabled-shell-access }
{ Shell~escape~is~disabled }
\l_tmpa_tl
\ExplSyntaxOff
% \end{macrocode}
% \begin{markdown}
Expand Down

0 comments on commit ad81d0d

Please sign in to comment.