T09 · Insecure Skill Coding Practices
- Location
scripts/table_maker.py:19- Finding
Unescaped Table Values Permit Markdown Content Injection
- Content
View full analysis
- Remediation
View remediation
` only if HTML is explicitly acceptable; otherwise replace them with spaces or escaped textual sequences. 4. Consider disabling or escaping raw HTML when output may be rendered by systems that permit embedded HTML. 5. Document that generated Markdown must still be sanitized if it is rendered in a security-sensitive web context. 6. Add tests covering pipes, multiline values, backslashes, links, images, and raw HTML in both headers and cells. For example: ```python def escape_md_cell(value): value = str(value) value = value.replace('\\', '\\\\') value = value.replace('|', '\\|') value = value.replace('\r\n', ' ') value = value.replace('\r', ' ') value = value.replace('\n', ' ') return value ``` Call `escape_md_cell` for every header and cell before width calculation and output generation. If generated files are rendered on a website, also apply a trusted Markdown/HTML sanitizer configured to reject unsafe HTML and URL schemes. ]]>
