links.
"""
safe = (
"Hello world. "
"Learn more.
"
""
)
body = await self._create_page_body(client, admin_token, "xss-safe", safe)
assert "" in body
assert "" in body
assert "" in body
async def test_blog_post_body_sanitized(self, client: AsyncClient, admin_token: str):
"""ASVS 5.2.1 — Blog post bodies go through the same nh3 sanitization."""
resp = await client.post(
"/api/v1/posts",
json={
"title": "XSS Post",
"slug": "xss-post-sanitize",
"body": 'Content
',
"published": True,
},
headers={"Authorization": f"Bearer {admin_token}"},
)
assert resp.status_code == 201
assert "updated
'},
headers={"Authorization": f"Bearer {admin_token}"},
)
assert resp.status_code == 200
assert "