T09 · Insecure Skill Coding Practices
- Location
scripts/export-html.py:48- Finding
Stored HTML and JavaScript Injection in Exported Books
- Content
View full analysis
{line[3:]}') elif line.startswith('### '): html_lines.append(f'{line[4:]}
') elif line.startswith('#### '): html_lines.append(f'{line[5:]}
') # Convert emphasis elif '**' in line or '__' in line: # Simple bold conversion line = line.replace('**', '').replace('__', '') # Need to close tags properly in real implementation html_lines.append(f'{line}
') # Convert italics elif '*' in line or '_' in line: line = line.replace('*', '').replace('_', '') html_lines.append(f'{line}
') # Empty line elif line.strip() == '': html_lines.append('
') # Regular paragraph else: html_lines.append(f'{line}
') return '\n'.join(html_lines) ``` Additional unescaped interpolation occurs when chapter metadata and discovery values are added to the final document: ```python # Generate table of contents toc_items = [] for chapter in chapters: toc_items.append(f'- {chapter["title"]}
') toc_html = '\n'.join(toc_items) # Generate chapter HTML chapter_html = ...[truncated 2888 chars]- Remediation
View remediation
``` 7. Add automated tests using hostile values in chapter text, headings, title, genre, and author fields. Test payloads should include `
