-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[makeotf] prevent bash and python code execution #877
Conversation
3c88641
to
493b528
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good overall but I need to do a few real usage tests to better validate the change related to the fdkutils call.
python/afdko/makeotf.py
Outdated
|
||
fdkutils.runShellCmdLogging(commandString) | ||
success = fdkutils.run_shell_command(params, suppress_output=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a closer look, the output cannot be suppressed because it suppresses all the errors and warnings issued by makeotfexe. Run this for example:
makeotf -f makeotf_data/input/cidfont.ps
This is why I wanted to run a few commands first; the test suite doesn't tell the full story.
- new routines do not set `shell=True` - several updates related to command handling differences (list of strings vs single string, int vs string args) - updated a few test cases related to command result differences (ints vs strings)
- don't use `eval()` - use `.isnumeric()` rather than `try`/`except`
returns head.fontRevision value from supplied font_path
- add `suppress_output` option to `run_shell_command()` to prevent unexpected blank lines in captured output - update version #
- use `run_shell_command` instead of discarding output of `get_shell_command_output` - update version #
…he console messages
30c9d36
to
a515254
Compare
subprocess
withshell=True
which allows shell code execution (closes [makeotf] bash code in style name is executed #780 )eval()
andexec()
which allow Python code execution