Language: TypeScript
Label: safe
CWE: CWE-167 \u2014 Improper Handling of Additional Special Element
The product receives input from an upstream component, but it does not handle or incorrectly handles when an additional unexpected special element is provided.

Code:
export function renderMarkdown(input: string | undefined | null, inline: boolean) {
    if (!input) {
        return '';
    }

    input = escapeHTML(input);

    if (inline) {
        return marked(input, { renderer: RENDERER_INLINE });
    } else {
        return marked(input, { renderer: RENDERER_DEFAULT });
    }
}