Skip to content

security: sanitize descriptionHtml before set:html injection in PageTitle.astro #728

@coderabbitai

Description

@coderabbitai

Summary

The descriptionHtml field (added in #727) is rendered via Astro's set:html directive in src/components/overrides/PageTitle.astro (connector and non-connector branches) without any HTML sanitization. It is only typed as z.string().optional() in src/content.config.ts.

While current values in src/data/agent-connectors/description-html.json and MDX frontmatter are benign, any future value containing scripts, event handlers, or unsafe URLs (javascript:, data:) would be injected as-is.

Risk

XSS via frontmatter or data-file values if unsafe HTML is introduced in the future.

Suggested Fix

Sanitize descriptionHtml before rendering — allow only safe tags/attributes (e.g., <a> with http/https hrefs) using a vetted library such as DOMPurify or sanitize-html. Optionally enforce the allowlist at ingest time in the content schema as well.

References

/cc @saif-at-scalekit

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions