The security advisory points to a stored XSS vulnerability in CKAN's markdown processing. The provided commit 112affffa74b14fc97c54abcf18315df97114917 directly addresses this issue. The analysis of the patch reveals that two functions, markdown_extract and render_markdown in ckan/lib/helpers.py, were using a regular expression (RE_MD_HTML_TAGS) to strip HTML tags from user-provided content after it was processed by the markdown library. This regex was insufficient and could be bypassed, allowing for the injection of malicious scripts.
The patch replaces the vulnerable regex-based sanitization with calls to bleach.clean(), a library specifically designed for robust HTML sanitization. The changes clearly show the vulnerable code being replaced in both functions. Therefore, markdown_extract and render_markdown are the identified vulnerable functions that would be involved in a runtime trace when this XSS vulnerability is triggered.