@tellescope/utilities 1.255.18 → 1.256.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -204,6 +204,58 @@ export declare const sanitize_html_for_cms: (html: string) => string;
204
204
  * for that surface rather than loosening this shared function.
205
205
  */
206
206
  export declare const sanitize_user_html: (html: string) => string;
207
+ /**
208
+ * Sandbox forced onto an `<iframe>` by {@link sanitize_user_html_with_iframes} when its author did
209
+ * not supply one.
210
+ *
211
+ * `allow-same-origin` is required in practice: without it the frame gets an opaque origin, where
212
+ * `localStorage` access throws and the embed's own CSP `'self'` matches nothing. Real embeds break —
213
+ * a Loom embed renders as a blank box, verified in Chrome. Since the sanitizer requires an absolute
214
+ * cross-origin `https` src, granting it gives the frame nothing an unsandboxed frame wouldn't have.
215
+ *
216
+ * What is deliberately withheld matters more than what is granted. Above all `allow-top-navigation`:
217
+ * a hostile embed cannot navigate the patient's page elsewhere. Also withheld: `allow-downloads`,
218
+ * `allow-modals`, `allow-pointer-lock`, `allow-orientation-lock`, `allow-top-navigation-by-user-activation`.
219
+ */
220
+ export declare const DEFAULT_IFRAME_SANDBOX = "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation";
221
+ /**
222
+ * Same as {@link sanitize_user_html}, but additionally permits `<iframe>` so authored content can
223
+ * embed video, scheduling widgets, etc. `sanitize_user_html` remains the default — only reach for
224
+ * this variant on a surface that specifically needs framing.
225
+ *
226
+ * Preconditions for any new caller:
227
+ * - **Admin/staff-authored HTML only.** Never use this for patient-authored content (form answers
228
+ * where `answerIsHTML`, chat messages, community posts) or for inbound email.
229
+ * - **Any patient-derived substring templated into the HTML must be entity-escaped first** — see
230
+ * `escapeHTMLValues` on {@link replace_form_field_template_values}. Otherwise "admin-authored"
231
+ * isn't actually true and a patient can inject a frame into an admin's description.
232
+ *
233
+ * How the frame is contained — the two controls work together, do not weaken either alone:
234
+ *
235
+ * 1. `src` must be an absolute `https://host` URL. Relative, protocol-relative (`//host`),
236
+ * `javascript:`, `data:` and `srcdoc` frames are dropped, so the frame is always cross-origin
237
+ * and the same-origin policy alone already prevents it from touching this document. Note that
238
+ * sanitize-html does NOT reject protocol-relative iframe srcs on its own when
239
+ * `allowProtocolRelative` is set, so that check lives in `transformTags` below.
240
+ * 2. {@link DEFAULT_IFRAME_SANDBOX} is forced when the author supplied none. Critically it withholds
241
+ * `allow-top-navigation`, so a hostile or compromised embed cannot redirect the patient's page to
242
+ * a phishing site — the realistic threat for an embed in a patient-facing form. It also withholds
243
+ * downloads, modals, pointer-lock, plugins and orientation-lock. It is therefore strictly more
244
+ * restrictive than rendering the same cross-origin iframe with no sandbox at all.
245
+ *
246
+ * It DOES grant `allow-same-origin`, which for a cross-origin `src` grants nothing a normal
247
+ * unsandboxed frame wouldn't already have (its own origin, its own storage) — see
248
+ * DEFAULT_IFRAME_SANDBOX for why that is necessary in practice. `allow-same-origin` would only be
249
+ * dangerous for a *same-origin* `src`, since such a frame could script this document; control 1 is
250
+ * what rules that out, which is why the src check must not be relaxed.
251
+ *
252
+ * An author-supplied `sandbox` is honored verbatim as an escape hatch (including `sandbox=""`, the
253
+ * most restrictive value), so a surface can tighten or loosen per embed.
254
+ *
255
+ * Current callers: the live form's field description (`Forms/forms.tsx`, `Forms/forms.v2.tsx`).
256
+ * The read-only submitted-response views intentionally stay on `sanitize_user_html`.
257
+ */
258
+ export declare const sanitize_user_html_with_iframes: (html: string) => string;
207
259
  export declare const query_string_for_object: (query: Indexable) => string;
208
260
  export declare const PROD_API_URL = "https://api.tellescope.com";
209
261
  export declare const STAGING_API_URL = "https://staging-api.tellescope.com";
@@ -291,6 +343,9 @@ export declare const MM_DD_YYYY_to_YYYY_MM_DD: (MMDDYYYY: string, delimiter?: st
291
343
  export declare const get_recent_engagement_date: (e: Enduser) => Date | undefined;
292
344
  export declare const get_recent_outbound_communication_date: (e: Enduser) => Date | undefined;
293
345
  export declare const URIDecodeEmail: (content: string, verbose?: boolean) => string;
346
+ export declare const decode_email_for_display: (content: string, { inbound }: {
347
+ inbound?: boolean | undefined;
348
+ }) => string;
294
349
  export declare const mfa_is_enabled: (u: {
295
350
  mfa?: User['mfa'];
296
351
  }) => boolean;
@@ -360,6 +415,16 @@ export declare const replace_form_field_template_values: (s: string, options: {
360
415
  enduser?: Partial<Enduser> | undefined;
361
416
  responses?: FormResponseValue[] | undefined;
362
417
  escapeNewlinesAsHTMLBreaks?: boolean | undefined;
418
+ /**
419
+ * Entity-escape the substituted `{{enduser.*}}` values. Set this whenever the result is
420
+ * rendered through a sanitizer that permits iframes ({@link sanitize_user_html_with_iframes}):
421
+ * these values come from the patient's own intake answers / enduser record, so without escaping
422
+ * a patient could inject a frame into an otherwise admin-authored description.
423
+ *
424
+ * Off by default because most callers substitute into plain text rendered by React (which
425
+ * escapes already), where escaping here would corrupt the output — e.g. a name containing `&`.
426
+ */
427
+ escapeHTMLValues?: boolean | undefined;
363
428
  }) => string;
364
429
  export declare const replace_sms_template_values: (s: string, sms?: Omit<SMSMessage, 'id'> | null) => string;
365
430
  export declare const get_secret_names: (s: string) => string[];
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAA6B,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAiF,iBAAiB,EAAE,uBAAuB,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAsB,YAAY,EAAE,gBAAgB,EAAW,QAAQ,EAAE,wBAAwB,EAAE,UAAU,EAAE,cAAc,EAAsD,IAAI,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAGvsB,OAAO,EAAE,QAAQ,EAAE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AI,WAiCrH,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC;uBAQ3B,MAAM;gBACb,MAAM;YACV,MAAM;;;uBAEyB,MAAM;;mBAAkC,MAAM;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;;cAC1F,MAAM;MACd,OAmFH,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,eAC/B,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,eACrC,IAAI,MAAM,CAAC,KACvB,MAAM,EA2DR,CAAA;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE;IAAE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;IAAC,SAAS,EAAE,IAAI,CAAA;CAAE,EAAE,EACrE,QAAQ,CAAC,EAAE,IAAI,GACd,MAAM,CAmBR;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CASjD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAE7D"}
package/lib/cjs/utils.js CHANGED
@@ -49,9 +49,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
49
49
  };
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.fullMonth_day_year = exports.calculate_date_difference_for_set_fields = exports.calculate_days_between_dates_from_enduser = exports.resolve_date_value = exports.calculate_days_between_dates = exports.parse_date_string = exports.mm_dd_yyyy = exports.yyyy_mm_dd_numeric = exports.yyyy_mm_dd = exports.formatted_date_hh_mm = exports.get_add_to_gcal_link = exports.formatted_date = exports.get_time_values = exports.MONTHS = exports.MONTHS_FULL = exports.sorted_records = exports.wait = exports.findFirstUnansweredField = exports.throwFunction = exports.ensure_https_url = exports.to_absolute_url = exports.build_portal_link_string = exports.build_content_link_string = exports.build_file_link_string = exports.build_form_group_link_string = exports.build_form_link_string = exports.build_link_string = exports.getTemplatedData = exports.parse_link_template = exports.map_object = exports.format_stripe_subscription_interval = exports.truncate_string = exports.defined_fields = exports.user_is_active = exports.user_display_name = exports.objects_equivalent = exports.to_object_id = exports.url_safe_path = exports.is_whitespace = exports.matching_fields = exports.is_object = exports.filter_object = exports.is_defined = exports.is_truthy = exports.object_is_empty = exports.first_letter_lowercase = exports.first_letter_capitalized = exports.user_is_locked_out = exports.user_is_admin = exports.ObjectId = void 0;
52
- exports.URIDecodeEmail = exports.get_recent_outbound_communication_date = exports.get_recent_engagement_date = exports.MM_DD_YYYY_to_YYYY_MM_DD = exports.YYYY_MM_DD_to_MM_DD_YYYY = exports.getLocalTimezone = exports.string_matches_key_or_value = exports.evaluate_conditional_logic_for_enduser_fields = exports.UPCOMING_EVENT_COUNT_KEY = exports.get_enduser_field_value_for_key = exports.age_for_dob_mmddyyyy = exports.replace_keys_and_values_in_object = exports.get_conditional_logic_values = exports.evaluate_conditional_logic_for_medication_title = exports.evaluate_string_field_comparison = exports.evaluate_conditional_logic = exports.shuffle_array_in_place = exports.plaintext_for_managed_content_record = exports.sanitize_html = exports.timezone_for_enduser = exports.safeJSONParse = exports.payment_cost_to_string = exports.read_local_storage = exports.update_local_storage = exports.is_organization_owner = exports.form_response_value_to_string = exports.is_table_input_response = exports.user_has_record_access = exports.is_suborganization = exports.matches_organization = exports.getDefaultPortalURL = exports.getPublicFileURL = exports.getOrgnizationFaviconURL = exports.getOrgnizationLogoURL = exports.getBuiltInPublicFileName = exports.getGoogleClientAPIKey = exports.getGoogleClientId = exports.getApiURL = exports.getEnvironment = exports.TEST_API_URL = exports.STAGING_API_URL = exports.PROD_API_URL = exports.query_string_for_object = exports.sanitize_user_html = exports.sanitize_html_for_cms = exports.sanitize_html_with_links = exports.remove_image_tags = exports.remove_style_tags = exports.remove_script_tags = exports.time_for_calendar_event = void 0;
53
- exports.INVALID_PREPOPULATION_TYPES = exports.add_value_for_dotted_key = exports.value_for_dotted_key = exports.get_flattened_fields = exports.skip_due_date_as_needed = exports.is_full_iso_string_heuristic = exports.display_time_for_seconds = exports.replace_enduser_template_values = exports.replace_secret_values = exports.get_secret_names = exports.replace_sms_template_values = exports.replace_form_field_template_values = exports.replace_order_template_values = exports.replace_medication_template_values = exports.replace_calendar_event_template_values = exports.replace_purchase_template_values = exports.replace_tag_template_values_for_enduser = exports.append_current_utm_params = exports.get_utm_params = exports.is_out_of_office = exports.color_for_classification = exports.classification_for_vital = exports.SMS_UNSUBSCRIBE_KEYWORDS = exports.satisfies_vital_comparison = exports.field_can_autosubmit = exports.field_can_autoadvance = exports.decodeJWT = exports.validate_organization_for_develop_health = exports.validate_user_for_develop_health = exports.validate_enduser_for_develop_health = exports.validate_enduser_for_script_sure = exports.validate_enduser_for_dose_spot = exports.validate_enduser_for_smart_meter = exports.validate_enduser_for_gogo = exports.json_error_string = exports.validate_enduser_for_candid = exports.validate_provider_for_candid = exports.validate_organization_for_candid = exports.validate_insurance_for_eligibility = exports.weighted_round_robin = exports.responses_satisfy_conditions = exports.calculate_bmi_from_responses = exports.calculate_bmi = exports.FORM_LOGIC_URL_PARAMETER = exports.FORM_LOGIC_CALCULATED_FIELDS = exports.calculate_form_scoring = exports.batch_array = exports.capture_is_supported = exports.get_next_reminder_timestamp = exports.mfa_is_enabled = void 0;
54
- exports.constructT2BaseURL = exports.formatDuration = exports.calculateTimeTrackDuration = exports.validate_custom_field_references = exports.slot_violates_calendar_event_limits = exports.replace_form_response_template_values = exports.resolve_integration_id = exports.replace_snippet_template_values = exports.get_snippet_keys = exports.emit_gtm_event = exports.get_care_team_primary = exports.is_checkbox_custom_field_value = exports.enrich_doxy_url = exports.to_human_readable_phone_number = exports.get_canvas_id = exports.should_show_unsubmitted_form_response_for_interval = exports.enduser_insurance_string = exports.enduser_address_string = exports.is_timezone = exports.downloadFile = exports.get_prepopulated_responses = void 0;
52
+ exports.get_recent_engagement_date = exports.MM_DD_YYYY_to_YYYY_MM_DD = exports.YYYY_MM_DD_to_MM_DD_YYYY = exports.getLocalTimezone = exports.string_matches_key_or_value = exports.evaluate_conditional_logic_for_enduser_fields = exports.UPCOMING_EVENT_COUNT_KEY = exports.get_enduser_field_value_for_key = exports.age_for_dob_mmddyyyy = exports.replace_keys_and_values_in_object = exports.get_conditional_logic_values = exports.evaluate_conditional_logic_for_medication_title = exports.evaluate_string_field_comparison = exports.evaluate_conditional_logic = exports.shuffle_array_in_place = exports.plaintext_for_managed_content_record = exports.sanitize_html = exports.timezone_for_enduser = exports.safeJSONParse = exports.payment_cost_to_string = exports.read_local_storage = exports.update_local_storage = exports.is_organization_owner = exports.form_response_value_to_string = exports.is_table_input_response = exports.user_has_record_access = exports.is_suborganization = exports.matches_organization = exports.getDefaultPortalURL = exports.getPublicFileURL = exports.getOrgnizationFaviconURL = exports.getOrgnizationLogoURL = exports.getBuiltInPublicFileName = exports.getGoogleClientAPIKey = exports.getGoogleClientId = exports.getApiURL = exports.getEnvironment = exports.TEST_API_URL = exports.STAGING_API_URL = exports.PROD_API_URL = exports.query_string_for_object = exports.sanitize_user_html_with_iframes = exports.DEFAULT_IFRAME_SANDBOX = exports.sanitize_user_html = exports.sanitize_html_for_cms = exports.sanitize_html_with_links = exports.remove_image_tags = exports.remove_style_tags = exports.remove_script_tags = exports.time_for_calendar_event = void 0;
53
+ exports.get_flattened_fields = exports.skip_due_date_as_needed = exports.is_full_iso_string_heuristic = exports.display_time_for_seconds = exports.replace_enduser_template_values = exports.replace_secret_values = exports.get_secret_names = exports.replace_sms_template_values = exports.replace_form_field_template_values = exports.replace_order_template_values = exports.replace_medication_template_values = exports.replace_calendar_event_template_values = exports.replace_purchase_template_values = exports.replace_tag_template_values_for_enduser = exports.append_current_utm_params = exports.get_utm_params = exports.is_out_of_office = exports.color_for_classification = exports.classification_for_vital = exports.SMS_UNSUBSCRIBE_KEYWORDS = exports.satisfies_vital_comparison = exports.field_can_autosubmit = exports.field_can_autoadvance = exports.decodeJWT = exports.validate_organization_for_develop_health = exports.validate_user_for_develop_health = exports.validate_enduser_for_develop_health = exports.validate_enduser_for_script_sure = exports.validate_enduser_for_dose_spot = exports.validate_enduser_for_smart_meter = exports.validate_enduser_for_gogo = exports.json_error_string = exports.validate_enduser_for_candid = exports.validate_provider_for_candid = exports.validate_organization_for_candid = exports.validate_insurance_for_eligibility = exports.weighted_round_robin = exports.responses_satisfy_conditions = exports.calculate_bmi_from_responses = exports.calculate_bmi = exports.FORM_LOGIC_URL_PARAMETER = exports.FORM_LOGIC_CALCULATED_FIELDS = exports.calculate_form_scoring = exports.batch_array = exports.capture_is_supported = exports.get_next_reminder_timestamp = exports.mfa_is_enabled = exports.decode_email_for_display = exports.URIDecodeEmail = exports.get_recent_outbound_communication_date = void 0;
54
+ exports.constructT2BaseURL = exports.formatDuration = exports.calculateTimeTrackDuration = exports.validate_custom_field_references = exports.slot_violates_calendar_event_limits = exports.replace_form_response_template_values = exports.resolve_integration_id = exports.replace_snippet_template_values = exports.get_snippet_keys = exports.emit_gtm_event = exports.get_care_team_primary = exports.is_checkbox_custom_field_value = exports.enrich_doxy_url = exports.to_human_readable_phone_number = exports.get_canvas_id = exports.should_show_unsubmitted_form_response_for_interval = exports.enduser_insurance_string = exports.enduser_address_string = exports.is_timezone = exports.downloadFile = exports.get_prepopulated_responses = exports.INVALID_PREPOPULATION_TYPES = exports.add_value_for_dotted_key = exports.value_for_dotted_key = void 0;
55
55
  var types_models_1 = require("@tellescope/types-models");
56
56
  var constants_1 = require("@tellescope/constants");
57
57
  var sanitize_html_1 = __importDefault(require("sanitize-html"));
@@ -832,6 +832,154 @@ var sanitize_user_html = function (html) {
832
832
  });
833
833
  };
834
834
  exports.sanitize_user_html = sanitize_user_html;
835
+ /**
836
+ * Sandbox forced onto an `<iframe>` by {@link sanitize_user_html_with_iframes} when its author did
837
+ * not supply one.
838
+ *
839
+ * `allow-same-origin` is required in practice: without it the frame gets an opaque origin, where
840
+ * `localStorage` access throws and the embed's own CSP `'self'` matches nothing. Real embeds break —
841
+ * a Loom embed renders as a blank box, verified in Chrome. Since the sanitizer requires an absolute
842
+ * cross-origin `https` src, granting it gives the frame nothing an unsandboxed frame wouldn't have.
843
+ *
844
+ * What is deliberately withheld matters more than what is granted. Above all `allow-top-navigation`:
845
+ * a hostile embed cannot navigate the patient's page elsewhere. Also withheld: `allow-downloads`,
846
+ * `allow-modals`, `allow-pointer-lock`, `allow-orientation-lock`, `allow-top-navigation-by-user-activation`.
847
+ */
848
+ exports.DEFAULT_IFRAME_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation';
849
+ /**
850
+ * Same as {@link sanitize_user_html}, but additionally permits `<iframe>` so authored content can
851
+ * embed video, scheduling widgets, etc. `sanitize_user_html` remains the default — only reach for
852
+ * this variant on a surface that specifically needs framing.
853
+ *
854
+ * Preconditions for any new caller:
855
+ * - **Admin/staff-authored HTML only.** Never use this for patient-authored content (form answers
856
+ * where `answerIsHTML`, chat messages, community posts) or for inbound email.
857
+ * - **Any patient-derived substring templated into the HTML must be entity-escaped first** — see
858
+ * `escapeHTMLValues` on {@link replace_form_field_template_values}. Otherwise "admin-authored"
859
+ * isn't actually true and a patient can inject a frame into an admin's description.
860
+ *
861
+ * How the frame is contained — the two controls work together, do not weaken either alone:
862
+ *
863
+ * 1. `src` must be an absolute `https://host` URL. Relative, protocol-relative (`//host`),
864
+ * `javascript:`, `data:` and `srcdoc` frames are dropped, so the frame is always cross-origin
865
+ * and the same-origin policy alone already prevents it from touching this document. Note that
866
+ * sanitize-html does NOT reject protocol-relative iframe srcs on its own when
867
+ * `allowProtocolRelative` is set, so that check lives in `transformTags` below.
868
+ * 2. {@link DEFAULT_IFRAME_SANDBOX} is forced when the author supplied none. Critically it withholds
869
+ * `allow-top-navigation`, so a hostile or compromised embed cannot redirect the patient's page to
870
+ * a phishing site — the realistic threat for an embed in a patient-facing form. It also withholds
871
+ * downloads, modals, pointer-lock, plugins and orientation-lock. It is therefore strictly more
872
+ * restrictive than rendering the same cross-origin iframe with no sandbox at all.
873
+ *
874
+ * It DOES grant `allow-same-origin`, which for a cross-origin `src` grants nothing a normal
875
+ * unsandboxed frame wouldn't already have (its own origin, its own storage) — see
876
+ * DEFAULT_IFRAME_SANDBOX for why that is necessary in practice. `allow-same-origin` would only be
877
+ * dangerous for a *same-origin* `src`, since such a frame could script this document; control 1 is
878
+ * what rules that out, which is why the src check must not be relaxed.
879
+ *
880
+ * An author-supplied `sandbox` is honored verbatim as an escape hatch (including `sandbox=""`, the
881
+ * most restrictive value), so a surface can tighten or loosen per embed.
882
+ *
883
+ * Current callers: the live form's field description (`Forms/forms.tsx`, `Forms/forms.v2.tsx`).
884
+ * The read-only submitted-response views intentionally stay on `sanitize_user_html`.
885
+ */
886
+ var sanitize_user_html_with_iframes = function (html) {
887
+ if (typeof html !== 'string' || !html)
888
+ return '';
889
+ return (0, sanitize_html_1.default)(html, {
890
+ allowedTags: [
891
+ // text & inline
892
+ 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd',
893
+ 'mark', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup',
894
+ 'time', 'u', 'var', 'wbr', 'del', 'ins', 'abbr',
895
+ // block & structure
896
+ 'address', 'article', 'aside', 'blockquote', 'caption', 'details', 'summary', 'div',
897
+ 'figcaption', 'figure', 'footer', 'header', 'hgroup', 'hr', 'main', 'nav', 'p', 'pre',
898
+ 'section',
899
+ // headings
900
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
901
+ // lists
902
+ 'dd', 'dl', 'dt', 'li', 'ol', 'ul',
903
+ // tables
904
+ 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr',
905
+ // media (still no object/embed — those can execute arbitrary plugin content)
906
+ 'img', 'audio', 'video', 'source', 'picture', 'track',
907
+ 'iframe',
908
+ ],
909
+ allowedAttributes: {
910
+ // NOTE: `id`/`name` are intentionally omitted — caller-controlled id/name enable DOM
911
+ // clobbering (shadowing document/global properties) and duplicate-id breakage, with no
912
+ // legitimate need in rendered user content.
913
+ '*': [
914
+ 'style', 'class', 'title', 'dir', 'lang', 'align', 'valign', 'width', 'height',
915
+ 'color', 'bgcolor', 'aria-*', 'data-*', 'role',
916
+ ],
917
+ a: ['href', 'target', 'rel'],
918
+ img: ['src', 'srcset', 'sizes', 'alt', 'loading', 'decoding'],
919
+ audio: ['controls', 'src', 'preload', 'loop', 'muted'],
920
+ video: ['controls', 'src', 'poster', 'preload', 'loop', 'muted', 'playsinline'],
921
+ source: ['src', 'srcset', 'type', 'media', 'sizes'],
922
+ track: ['src', 'kind', 'srclang', 'label', 'default'],
923
+ // No `srcdoc` (an inline document is arbitrary markup) and no `name` (named-window
924
+ // clobbering). `sandbox`/`referrerpolicy` MUST be listed here: transformTags runs BEFORE
925
+ // attribute filtering, so the values forced below are filtered too and would be dropped.
926
+ iframe: [
927
+ 'src', 'sandbox', 'referrerpolicy', 'allow', 'allowfullscreen', 'frameborder', 'loading',
928
+ ],
929
+ col: ['span'],
930
+ colgroup: ['span'],
931
+ td: ['colspan', 'rowspan', 'headers'],
932
+ th: ['colspan', 'rowspan', 'headers', 'scope'],
933
+ ol: ['start', 'reversed', 'type'],
934
+ time: ['datetime'],
935
+ data: ['value'],
936
+ del: ['datetime'],
937
+ ins: ['datetime'],
938
+ },
939
+ // Only safe protocols. javascript:/vbscript: are not listed and are stripped.
940
+ allowedSchemes: ['http', 'https', 'mailto', 'tel'],
941
+ allowedSchemesByTag: {
942
+ img: ['http', 'https', 'data'],
943
+ source: ['http', 'https', 'data'],
944
+ video: ['http', 'https', 'data'],
945
+ audio: ['http', 'https', 'data'],
946
+ iframe: ['https'],
947
+ },
948
+ allowedSchemesAppliedToAttributes: ['href', 'src', 'srcset'],
949
+ allowProtocolRelative: true,
950
+ allowIframeRelativeUrls: false,
951
+ transformTags: {
952
+ // Harden external links against reverse-tabnabbing.
953
+ a: function (tagName, attribs) {
954
+ var href = attribs.href || '';
955
+ if (href.startsWith('http://') || href.startsWith('https://')) {
956
+ return { tagName: tagName, attribs: __assign(__assign({}, attribs), { target: '_blank', rel: 'noopener noreferrer' }) };
957
+ }
958
+ return { tagName: tagName, attribs: attribs };
959
+ },
960
+ iframe: function (tagName, attribs) {
961
+ var _a;
962
+ // Strip the characters browsers ignore in URLs, matching sanitize-html's own naughtyHref.
963
+ var src = (attribs.src || '').replace(/[\x00-\x20]+/g, '');
964
+ // Absolute https with a non-empty host, only. Dropping `src` hands the element to
965
+ // exclusiveFilter below, which removes it along with its fallback content.
966
+ if (!/^https:\/\/[^\s/?#\\]+/i.test(src))
967
+ return { tagName: tagName, attribs: {} };
968
+ return {
969
+ tagName: tagName,
970
+ attribs: __assign(__assign({}, attribs), { src: src,
971
+ // `??` rather than `||`: sandbox="" serializes as a bare `sandbox`, which is the MOST
972
+ // restrictive value, so an explicit empty string must be honored rather than replaced.
973
+ sandbox: (_a = attribs.sandbox) !== null && _a !== void 0 ? _a : exports.DEFAULT_IFRAME_SANDBOX, referrerpolicy: attribs.referrerpolicy || 'strict-origin-when-cross-origin' }),
974
+ };
975
+ },
976
+ },
977
+ // Removes src-less iframes AND their fallback content. Returning a non-allowlisted tagName from
978
+ // transformTags does NOT do this — sanitize-html drops the tag but emits the text inside it.
979
+ exclusiveFilter: function (frame) { return frame.tag === 'iframe' && !frame.attribs.src; },
980
+ });
981
+ };
982
+ exports.sanitize_user_html_with_iframes = sanitize_user_html_with_iframes;
835
983
  var query_string_for_object = function (query) {
836
984
  var queryString = '';
837
985
  if (query && !(0, exports.object_is_empty)(query)) {
@@ -1623,7 +1771,7 @@ var URIReplacements = {
1623
1771
  "=28": "(",
1624
1772
  "=29": ")",
1625
1773
  "=2A": "*",
1626
- "=2B": "=+",
1774
+ "=2B": "+",
1627
1775
  "=2C": ",",
1628
1776
  "=2D": "-",
1629
1777
  "=2E": ".",
@@ -1962,6 +2110,8 @@ var URIReplacements = {
1962
2110
  "=FF": "",
1963
2111
  "=C3=BF": "", // "ÿ"
1964
2112
  };
2113
+ // raw quoted-printable decoder - display code must go through decode_email_for_display instead,
2114
+ // which only applies this to inbound bodies (outbound bodies are never QP encoded)
1965
2115
  var URIDecodeEmail = function (content, verbose) { return (content
1966
2116
  .replace(/=\s/gi, '')
1967
2117
  .replaceAll("\r\n", '')
@@ -1984,6 +2134,16 @@ var URIDecodeEmail = function (content, verbose) { return (content
1984
2134
  return toReturn;
1985
2135
  })); };
1986
2136
  exports.URIDecodeEmail = URIDecodeEmail;
2137
+ /* Outbound email bodies are stored exactly as handed to the mail provider (worker/app.js
2138
+ handleOutgoingEmail persists message.htmlmessage verbatim; SES/Gmail/Outlook/Paubox apply
2139
+ their own transfer encoding), so they are never quoted-printable encoded. Only inbound MIME
2140
+ bodies, parsed by worker/modules/email_parser.js, can be. Decoding an outbound body corrupts
2141
+ it: `?id=500044` -> `?idP0044`, `&sid=3El` -> `&sid>l`. */
2142
+ var decode_email_for_display = function (content, _a) {
2143
+ var inbound = _a.inbound;
2144
+ return (inbound === true ? (0, exports.URIDecodeEmail)(content) : content);
2145
+ };
2146
+ exports.decode_email_for_display = decode_email_for_display;
1987
2147
  var mfa_is_enabled = function (u) {
1988
2148
  var _a, _b;
1989
2149
  return (!!((_a = u === null || u === void 0 ? void 0 : u.mfa) === null || _a === void 0 ? void 0 : _a.email) || !!((_b = u === null || u === void 0 ? void 0 : u.mfa) === null || _b === void 0 ? void 0 : _b.authenticator));
@@ -2985,13 +3145,20 @@ var replace_order_template_values = function (s, order) {
2985
3145
  return replaced;
2986
3146
  };
2987
3147
  exports.replace_order_template_values = replace_order_template_values;
3148
+ // Entity-escapes a value being spliced into an HTML string. `&` must be replaced first.
3149
+ var escape_html_text = function (s) { return s
3150
+ .replace(/&/g, '&amp;')
3151
+ .replace(/</g, '&lt;')
3152
+ .replace(/>/g, '&gt;')
3153
+ .replace(/"/g, '&quot;')
3154
+ .replace(/'/g, '&#39;'); };
2988
3155
  var replace_form_field_template_values = function (s, options) {
2989
3156
  var _a, _b, _d, _e, _f, _g, _h, _j;
2990
3157
  if (!s)
2991
3158
  return s;
2992
3159
  if (typeof s !== 'string')
2993
3160
  return s;
2994
- var enduser = options.enduser, _k = options.responses, responses = _k === void 0 ? [] : _k, escapeNewlinesAsHTMLBreaks = options.escapeNewlinesAsHTMLBreaks;
3161
+ var enduser = options.enduser, _k = options.responses, responses = _k === void 0 ? [] : _k, escapeNewlinesAsHTMLBreaks = options.escapeNewlinesAsHTMLBreaks, escapeHTMLValues = options.escapeHTMLValues;
2995
3162
  var i = 0;
2996
3163
  var start = 0;
2997
3164
  var templates = [];
@@ -3074,6 +3241,11 @@ var replace_form_field_template_values = function (s, options) {
3074
3241
  replacement = value;
3075
3242
  }
3076
3243
  }
3244
+ // Must run before the newline conversion below, or the injected breaks are escaped too
3245
+ // and render as literal '&lt;br /&gt;'.
3246
+ if (escapeHTMLValues) {
3247
+ replacement = escape_html_text(replacement);
3248
+ }
3077
3249
  if (escapeNewlinesAsHTMLBreaks) {
3078
3250
  replacement = replacement.replace(/\r\n|\r|\n|\\n/g, '<br />');
3079
3251
  }