Repository navigation
feat(seo): add OpenGraph metadata renderer, slug sanitizer, and sitemap generator - #32
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Statement & Protocol Vulnerabilities
Dynamic website generation engines must protect against XSS injection via user-supplied profile titles, ensure uniform slug generation across international Unicode characters, and adhere strictly to RFC 3986 URL semantics and W3C Sitemap standards. Unescaped quotes or malicious tags in OpenGraph attributes can break HTML parsing or expose DOM clobbering vulnerabilities.
This PR introduces:
src/buildsite/seo_sanitizer.py: Hardened OpenGraph / Twitter<meta>tag renderer with universal attribute escaping, NFKD Unicode slug sanitization, and W3C sitemap XML generator.pythonpath = ["src"]inpyproject.tomlfor standard module resolution.tests/test_seo_sanitizer.pyandtests/test_metadata_and_profile.py.Resilient Architecture & Protocol Defenses
Protocol Invariants:
Cafécafe,Crèmecreme), converting non-ASCII glyphs safely into URL-safe ASCII kebab-case tokens without crashing or dropping words.<meta>properties (og:title,og:description,og:image,twitter:card) are sanitized usinghtml.escape(..., quote=True)to prevent attribute breakout attacks (" autofocus onfocus=...).https://protocol scheme and optionally enforce permitted domain namespaces.Verification Run
Executed via pytest runner: