diff --git a/packages/manager/.changeset/pr-13404-fixed-1771343065083.md b/packages/manager/.changeset/pr-13404-fixed-1771343065083.md new file mode 100644 index 00000000000..ca3850c7668 --- /dev/null +++ b/packages/manager/.changeset/pr-13404-fixed-1771343065083.md @@ -0,0 +1,5 @@ +--- +"@linode/manager": Fixed +--- + +Fix html injection vuln in open Support Ticket and Quotas Increase Form ([#13404](https://github.com/linode/manager/pull/13404)) diff --git a/packages/manager/src/features/Account/Quotas/QuotasIncreaseForm.tsx b/packages/manager/src/features/Account/Quotas/QuotasIncreaseForm.tsx index dff1302854d..f130a0bbdb8 100644 --- a/packages/manager/src/features/Account/Quotas/QuotasIncreaseForm.tsx +++ b/packages/manager/src/features/Account/Quotas/QuotasIncreaseForm.tsx @@ -14,6 +14,7 @@ import * as React from 'react'; import { Controller, FormProvider, useForm } from 'react-hook-form'; import { Markdown } from 'src/components/Markdown/Markdown'; +import { SUPPORT_TICKET_SANITIZE_OPTIONS } from 'src/features/Support/sanitizeOptions'; import { getQuotaIncreaseFormSchema, getQuotaIncreaseMessage } from './utils'; @@ -254,7 +255,10 @@ export const QuotasIncreaseForm = (props: QuotasIncreaseFormProps) => { {summary} {' '} - + ({ @@ -52,7 +54,10 @@ export const TicketDetailText = (props: Props) => { return ( - + {truncatedText !== text && ( tags and other potentially dangerous HTML elements + * - Preserves: Text content when removing disallowed tags + * + * Rationale: + * - Users expect Markdown formatting support for better readability + * - Links are blocked to prevent phishing/social engineering attacks + * - Sanitization happens at render time (not on submit) to preserve original content + */ +export const SUPPORT_TICKET_SANITIZE_OPTIONS: SanitizeOptions = { + ALLOWED_TAGS: [ + // Text formatting + 'strong', + 'b', + 'em', + 'i', + 'u', + 'del', + 's', + // Code blocks + 'code', + 'pre', + 'span', + // Lists + 'ul', + 'ol', + 'li', + // Structure + 'p', + 'br', + 'hr', + 'blockquote', + // Headers + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + // Tables + 'table', + 'thead', + 'tbody', + 'tr', + 'th', + 'td', + // NO tags - links are blocked to prevent phishing + ], + ALLOWED_ATTR: ['class', 'style'], // Only for syntax highlighting in code blocks + KEEP_CONTENT: true, // Preserve text when removing disallowed tags +};