Skip to content

🔒️ Validate downloaded font content before writing to cache#6

Merged
sjquant merged 6 commits into
mainfrom
claude/review-next-task-qqoBG
Apr 1, 2026
Merged

🔒️ Validate downloaded font content before writing to cache#6
sjquant merged 6 commits into
mainfrom
claude/review-next-task-qqoBG

Conversation

@sjquant
Copy link
Copy Markdown
Owner

@sjquant sjquant commented Apr 1, 2026

Summary

  • Validate downloaded font bytes against known magic signatures (TTF, OTF, TTC, WOFF, WOFF2) before writing to cache
  • Raise RenderingError with a clear message when content is not a valid font — no partial cache file is written
  • Also updates TASKS.md: marks gradient/grain features done, removes the GrainLayer tasks that were dropped

Test plan

  • test_should_raise_error_when_font_data_is_not_a_valid_font — non-font bytes raise RenderingError
  • test_should_not_write_cache_file_when_font_data_is_invalid — cache dir stays empty on bad input
  • test_should_accept_valid_font_magic_bytes (parametrized × 6) — all valid signatures accepted
  • Existing webfont download tests still pass with updated fake font data

https://claude.ai/code/session_01UCAexPKGo4yjaf3cMNVwGG

@sjquant sjquant changed the title chore: update TASKS.md — mark gradient/grain features done, remove GrainLayer tasks fix: validate downloaded font content before writing to cache Apr 1, 2026
@sjquant sjquant force-pushed the claude/review-next-task-qqoBG branch from d9758ac to 48e4fb9 Compare April 1, 2026 14:44
@sjquant sjquant changed the title fix: validate downloaded font content before writing to cache 🔒️ Validate downloaded font content before writing to cache Apr 1, 2026
@sjquant sjquant merged commit 7cecf3e into main Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants