T09 · Insecure Skill Coding Practices
- Location
scripts/build_pdf.py:83- Finding
Untrusted Markdown and Metadata Are Processed with Raw TeX Enabled
- Content
View full analysis
str: generated_at = datetime.now().strftime("%Y-%m-%d %H:%M:%S") lines = [ f"# {title}", "", f"- Source: {source_url}" if source_url else "- Source: (not provided)", f"- Generated: {generated_at}", "- Note: this guide focuses on usage, not implementation internals.", "", "\\newpage", "", ] return "\n".join(lines) def ensure_single_document(markdown_path: Path, title: str, source_url: str) -> Path: content = markdown_path.read_text(encoding="utf-8").strip() if not content.startswith("# "): content = f"# {title}\n\n{content}" if content else f"# {title}" first_lines = content.splitlines()[:8] source_line = f"Source: {source_url}" if source_url else None if source_line and source_line not in first_lines: content = content.replace(content.splitlines()[0], content.splitlines()[0] + f"\n\n{source_line}", 1) build_dir = markdown_path.parent / ".build-pdf" build_dir.mkdir(parents=True, exist_ok=True) combined = build_dir / f"{markdown_path.stem}.combined.md" combined.write_text(build_cover(title, source_url) + "\n\n" + content + "\n", encoding="utf-8") return combined ``` ```python for font in fonts: command = [ pandoc, str(combined_md), "--from", "markdown+raw_tex+pipe_tables+task_lists", "--pdf-engine", engine_path, "--toc", "--toc-depth", str(toc_depth), "--number-sections", "-V", f"mainfont={font}", "-V", "fontsize=11pt", "-V", "geometry:margin=1in", "-V", "papersize:a4", "-V", "colorlinks=true", ...[truncated 3078 chars]- Remediation
View remediation
