- Repro case:
return markdown.markdown(post, output='html5')
- Expected behavior: Error or warning
- Actual behavior: Typo is ignored
For a while I had the code return markdown.markdown(post, output='html5'), which seemed to be working OK. However, it turns out that was a typo -- I should have been using output_format. Normally, the runtime would catch this, but instead **kwargs are collected and passed to the Markdown class, where keys are retrieved as needed.
It's not a security issue in this library, as far as I can tell, but this pattern has lead to security issues elsewhere. (Imagine if there were a safe_output kwarg that someone typo'd.)
I think this could be as simple as having a known-keys set that the kwargs dict's keys are checked against before processing. I'd be happy to contribute a PR if this would be an acceptable approach.
return markdown.markdown(post, output='html5')For a while I had the code
return markdown.markdown(post, output='html5'), which seemed to be working OK. However, it turns out that was a typo -- I should have been usingoutput_format. Normally, the runtime would catch this, but instead**kwargsare collected and passed to theMarkdownclass, where keys are retrieved as needed.It's not a security issue in this library, as far as I can tell, but this pattern has lead to security issues elsewhere. (Imagine if there were a
safe_outputkwarg that someone typo'd.)I think this could be as simple as having a known-keys set that the kwargs dict's keys are checked against before processing. I'd be happy to contribute a PR if this would be an acceptable approach.