loofah 2.20.0 → 2.21.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "set"
3
4
 
4
5
  module Loofah
@@ -47,973 +48,973 @@ module Loofah
47
48
  # </html5_license>
48
49
  module SafeList
49
50
  ACCEPTABLE_ELEMENTS = Set.new([
50
- "a",
51
- "abbr",
52
- "acronym",
53
- "address",
54
- "area",
55
- "article",
56
- "aside",
57
- "audio",
58
- "b",
59
- "bdi",
60
- "bdo",
61
- "big",
62
- "blockquote",
63
- "br",
64
- "button",
65
- "canvas",
66
- "caption",
67
- "center",
68
- "cite",
69
- "code",
70
- "col",
71
- "colgroup",
72
- "command",
73
- "datalist",
74
- "dd",
75
- "del",
76
- "details",
77
- "dfn",
78
- "dir",
79
- "div",
80
- "dl",
81
- "dt",
82
- "em",
83
- "fieldset",
84
- "figcaption",
85
- "figure",
86
- "font",
87
- "footer",
88
- "form",
89
- "h1",
90
- "h2",
91
- "h3",
92
- "h4",
93
- "h5",
94
- "h6",
95
- "header",
96
- "hr",
97
- "i",
98
- "img",
99
- "input",
100
- "ins",
101
- "kbd",
102
- "label",
103
- "legend",
104
- "li",
105
- "main",
106
- "map",
107
- "mark",
108
- "menu",
109
- "meter",
110
- "nav",
111
- "ol",
112
- "optgroup",
113
- "option",
114
- "output",
115
- "p",
116
- "pre",
117
- "q",
118
- "s",
119
- "samp",
120
- "section",
121
- "select",
122
- "small",
123
- "span",
124
- "strike",
125
- "strong",
126
- "sub",
127
- "summary",
128
- "sup",
129
- "table",
130
- "tbody",
131
- "td",
132
- "textarea",
133
- "tfoot",
134
- "th",
135
- "thead",
136
- "time",
137
- "tr",
138
- "tt",
139
- "u",
140
- "ul",
141
- "var",
142
- "video",
143
- "wbr",
144
- ])
51
+ "a",
52
+ "abbr",
53
+ "acronym",
54
+ "address",
55
+ "area",
56
+ "article",
57
+ "aside",
58
+ "audio",
59
+ "b",
60
+ "bdi",
61
+ "bdo",
62
+ "big",
63
+ "blockquote",
64
+ "br",
65
+ "button",
66
+ "canvas",
67
+ "caption",
68
+ "center",
69
+ "cite",
70
+ "code",
71
+ "col",
72
+ "colgroup",
73
+ "command",
74
+ "datalist",
75
+ "dd",
76
+ "del",
77
+ "details",
78
+ "dfn",
79
+ "dir",
80
+ "div",
81
+ "dl",
82
+ "dt",
83
+ "em",
84
+ "fieldset",
85
+ "figcaption",
86
+ "figure",
87
+ "font",
88
+ "footer",
89
+ "form",
90
+ "h1",
91
+ "h2",
92
+ "h3",
93
+ "h4",
94
+ "h5",
95
+ "h6",
96
+ "header",
97
+ "hr",
98
+ "i",
99
+ "img",
100
+ "input",
101
+ "ins",
102
+ "kbd",
103
+ "label",
104
+ "legend",
105
+ "li",
106
+ "main",
107
+ "map",
108
+ "mark",
109
+ "menu",
110
+ "meter",
111
+ "nav",
112
+ "ol",
113
+ "optgroup",
114
+ "option",
115
+ "output",
116
+ "p",
117
+ "pre",
118
+ "q",
119
+ "s",
120
+ "samp",
121
+ "section",
122
+ "select",
123
+ "small",
124
+ "span",
125
+ "strike",
126
+ "strong",
127
+ "sub",
128
+ "summary",
129
+ "sup",
130
+ "table",
131
+ "tbody",
132
+ "td",
133
+ "textarea",
134
+ "tfoot",
135
+ "th",
136
+ "thead",
137
+ "time",
138
+ "tr",
139
+ "tt",
140
+ "u",
141
+ "ul",
142
+ "var",
143
+ "video",
144
+ "wbr",
145
+ ])
145
146
 
146
147
  MATHML_ELEMENTS = Set.new([
147
- "annotation",
148
- "annotation-xml",
149
- "maction",
150
- "math",
151
- "menclose",
152
- "merror",
153
- "mfenced",
154
- "mfrac",
155
- "mi",
156
- "mmultiscripts",
157
- "mn",
158
- "mo",
159
- "mover",
160
- "mpadded",
161
- "mphantom",
162
- "mprescripts",
163
- "mroot",
164
- "mrow",
165
- "ms",
166
- "mspace",
167
- "msqrt",
168
- "mstyle",
169
- "msub",
170
- "msubsup",
171
- "msup",
172
- "mtable",
173
- "mtd",
174
- "mtext",
175
- "mtr",
176
- "munder",
177
- "munderover",
178
- "none",
179
- "semantics",
180
- ])
148
+ "annotation",
149
+ "annotation-xml",
150
+ "maction",
151
+ "math",
152
+ "menclose",
153
+ "merror",
154
+ "mfenced",
155
+ "mfrac",
156
+ "mi",
157
+ "mmultiscripts",
158
+ "mn",
159
+ "mo",
160
+ "mover",
161
+ "mpadded",
162
+ "mphantom",
163
+ "mprescripts",
164
+ "mroot",
165
+ "mrow",
166
+ "ms",
167
+ "mspace",
168
+ "msqrt",
169
+ "mstyle",
170
+ "msub",
171
+ "msubsup",
172
+ "msup",
173
+ "mtable",
174
+ "mtd",
175
+ "mtext",
176
+ "mtr",
177
+ "munder",
178
+ "munderover",
179
+ "none",
180
+ "semantics",
181
+ ])
181
182
 
182
183
  SVG_ELEMENTS = Set.new([
183
- "a",
184
- "altGlyph",
185
- "animate",
186
- "animateColor",
187
- "animateMotion",
188
- "animateTransform",
189
- "circle",
190
- "clipPath",
191
- "cursor",
192
- "defs",
193
- "desc",
194
- "ellipse",
195
- "feGaussianBlur",
196
- "feImage",
197
- "filter",
198
- "font-face",
199
- "font-face-name",
200
- "font-face-src",
201
- "foreignObject",
202
- "g",
203
- "glyph",
204
- "hkern",
205
- "line",
206
- "linearGradient",
207
- "marker",
208
- "mask",
209
- "metadata",
210
- "missing-glyph",
211
- "mpath",
212
- "path",
213
- "pattern",
214
- "polygon",
215
- "polyline",
216
- "radialGradient",
217
- "rect",
218
- "set",
219
- "stop",
220
- "svg",
221
- "switch",
222
- "symbol",
223
- "text",
224
- "textPath",
225
- "title",
226
- "tref",
227
- "tspan",
228
- "use",
229
- ])
184
+ "a",
185
+ "altGlyph",
186
+ "animate",
187
+ "animateColor",
188
+ "animateMotion",
189
+ "animateTransform",
190
+ "circle",
191
+ "clipPath",
192
+ "cursor",
193
+ "defs",
194
+ "desc",
195
+ "ellipse",
196
+ "feGaussianBlur",
197
+ "feImage",
198
+ "filter",
199
+ "font-face",
200
+ "font-face-name",
201
+ "font-face-src",
202
+ "foreignObject",
203
+ "g",
204
+ "glyph",
205
+ "hkern",
206
+ "line",
207
+ "linearGradient",
208
+ "marker",
209
+ "mask",
210
+ "metadata",
211
+ "missing-glyph",
212
+ "mpath",
213
+ "path",
214
+ "pattern",
215
+ "polygon",
216
+ "polyline",
217
+ "radialGradient",
218
+ "rect",
219
+ "set",
220
+ "stop",
221
+ "svg",
222
+ "switch",
223
+ "symbol",
224
+ "text",
225
+ "textPath",
226
+ "title",
227
+ "tref",
228
+ "tspan",
229
+ "use",
230
+ ])
230
231
 
231
232
  ACCEPTABLE_ATTRIBUTES = Set.new([
232
- "abbr",
233
- "accept",
234
- "accept-charset",
235
- "accesskey",
236
- "action",
237
- "align",
238
- "alt",
239
- "axis",
240
- "border",
241
- "cellpadding",
242
- "cellspacing",
243
- "char",
244
- "charoff",
245
- "charset",
246
- "checked",
247
- "cite",
248
- "class",
249
- "clear",
250
- "color",
251
- "cols",
252
- "colspan",
253
- "compact",
254
- "contenteditable",
255
- "coords",
256
- "datetime",
257
- "dir",
258
- "disabled",
259
- "enctype",
260
- "for",
261
- "frame",
262
- "headers",
263
- "height",
264
- "href",
265
- "hreflang",
266
- "hspace",
267
- "id",
268
- "ismap",
269
- "label",
270
- "lang",
271
- "longdesc",
272
- "loop",
273
- "loopcount",
274
- "loopend",
275
- "loopstart",
276
- "maxlength",
277
- "media",
278
- "method",
279
- "multiple",
280
- "name",
281
- "nohref",
282
- "noshade",
283
- "nowrap",
284
- "poster",
285
- "preload",
286
- "prompt",
287
- "readonly",
288
- "rel",
289
- "rev",
290
- "rows",
291
- "rowspan",
292
- "rules",
293
- "scope",
294
- "selected",
295
- "shape",
296
- "size",
297
- "span",
298
- "src",
299
- "start",
300
- "style",
301
- "summary",
302
- "tabindex",
303
- "target",
304
- "title",
305
- "type",
306
- "usemap",
307
- "valign",
308
- "value",
309
- "vspace",
310
- "width",
311
- "xml:lang",
312
- ])
233
+ "abbr",
234
+ "accept",
235
+ "accept-charset",
236
+ "accesskey",
237
+ "action",
238
+ "align",
239
+ "alt",
240
+ "axis",
241
+ "border",
242
+ "cellpadding",
243
+ "cellspacing",
244
+ "char",
245
+ "charoff",
246
+ "charset",
247
+ "checked",
248
+ "cite",
249
+ "class",
250
+ "clear",
251
+ "color",
252
+ "cols",
253
+ "colspan",
254
+ "compact",
255
+ "contenteditable",
256
+ "coords",
257
+ "datetime",
258
+ "dir",
259
+ "disabled",
260
+ "enctype",
261
+ "for",
262
+ "frame",
263
+ "headers",
264
+ "height",
265
+ "href",
266
+ "hreflang",
267
+ "hspace",
268
+ "id",
269
+ "ismap",
270
+ "label",
271
+ "lang",
272
+ "longdesc",
273
+ "loop",
274
+ "loopcount",
275
+ "loopend",
276
+ "loopstart",
277
+ "maxlength",
278
+ "media",
279
+ "method",
280
+ "multiple",
281
+ "name",
282
+ "nohref",
283
+ "noshade",
284
+ "nowrap",
285
+ "poster",
286
+ "preload",
287
+ "prompt",
288
+ "readonly",
289
+ "rel",
290
+ "rev",
291
+ "rows",
292
+ "rowspan",
293
+ "rules",
294
+ "scope",
295
+ "selected",
296
+ "shape",
297
+ "size",
298
+ "span",
299
+ "src",
300
+ "start",
301
+ "style",
302
+ "summary",
303
+ "tabindex",
304
+ "target",
305
+ "title",
306
+ "type",
307
+ "usemap",
308
+ "valign",
309
+ "value",
310
+ "vspace",
311
+ "width",
312
+ "xml:lang",
313
+ ])
313
314
 
314
315
  MATHML_ATTRIBUTES = Set.new([
315
- "actiontype",
316
- "align",
317
- "close",
318
- "columnalign",
319
- "columnlines",
320
- "columnspacing",
321
- "columnspan",
322
- "depth",
323
- "dir",
324
- "display",
325
- "displaystyle",
326
- "encoding",
327
- "equalcolumns",
328
- "equalrows",
329
- "fence",
330
- "fontstyle",
331
- "fontweight",
332
- "frame",
333
- "height",
334
- "href",
335
- "linethickness",
336
- "lquote",
337
- "lspace",
338
- "mathbackground",
339
- "mathcolor",
340
- "mathsize",
341
- "mathvariant",
342
- "maxsize",
343
- "minsize",
344
- "notation",
345
- "open",
346
- "other",
347
- "rowalign",
348
- "rowlines",
349
- "rowspacing",
350
- "rowspan",
351
- "rquote",
352
- "rspace",
353
- "scriptlevel",
354
- "selection",
355
- "separator",
356
- "separators",
357
- "stretchy",
358
- "width",
359
- "xlink:href",
360
- "xlink:show",
361
- "xlink:type",
362
- "xmlns",
363
- "xmlns:xlink",
364
- ])
316
+ "actiontype",
317
+ "align",
318
+ "close",
319
+ "columnalign",
320
+ "columnlines",
321
+ "columnspacing",
322
+ "columnspan",
323
+ "depth",
324
+ "dir",
325
+ "display",
326
+ "displaystyle",
327
+ "encoding",
328
+ "equalcolumns",
329
+ "equalrows",
330
+ "fence",
331
+ "fontstyle",
332
+ "fontweight",
333
+ "frame",
334
+ "height",
335
+ "href",
336
+ "linethickness",
337
+ "lquote",
338
+ "lspace",
339
+ "mathbackground",
340
+ "mathcolor",
341
+ "mathsize",
342
+ "mathvariant",
343
+ "maxsize",
344
+ "minsize",
345
+ "notation",
346
+ "open",
347
+ "other",
348
+ "rowalign",
349
+ "rowlines",
350
+ "rowspacing",
351
+ "rowspan",
352
+ "rquote",
353
+ "rspace",
354
+ "scriptlevel",
355
+ "selection",
356
+ "separator",
357
+ "separators",
358
+ "stretchy",
359
+ "width",
360
+ "xlink:href",
361
+ "xlink:show",
362
+ "xlink:type",
363
+ "xmlns",
364
+ "xmlns:xlink",
365
+ ])
365
366
 
366
367
  SVG_ATTRIBUTES = Set.new([
367
- "accent-height",
368
- "accumulate",
369
- "additive",
370
- "alphabetic",
371
- "arabic-form",
372
- "ascent",
373
- "attributeName",
374
- "attributeType",
375
- "baseProfile",
376
- "bbox",
377
- "begin",
378
- "calcMode",
379
- "cap-height",
380
- "class",
381
- "clip-path",
382
- "clip-rule",
383
- "color",
384
- "color-interpolation-filters",
385
- "color-profile",
386
- "color-rendering",
387
- "content",
388
- "cursor",
389
- "cx",
390
- "cy",
391
- "d",
392
- "descent",
393
- "display",
394
- "dur",
395
- "dx",
396
- "dy",
397
- "end",
398
- "fill",
399
- "fill-opacity",
400
- "fill-rule",
401
- "filter",
402
- "filterRes",
403
- "filterUnits",
404
- "font-family",
405
- "font-size",
406
- "font-stretch",
407
- "font-style",
408
- "font-variant",
409
- "font-weight",
410
- "fx",
411
- "fy",
412
- "g1",
413
- "g2",
414
- "glyph-name",
415
- "gradientUnits",
416
- "hanging",
417
- "height",
418
- "horiz-adv-x",
419
- "horiz-origin-x",
420
- "id",
421
- "ideographic",
422
- "k",
423
- "keyPoints",
424
- "keySplines",
425
- "keyTimes",
426
- "lang",
427
- "marker",
428
- "marker-end",
429
- "marker-mid",
430
- "marker-start",
431
- "markerHeight",
432
- "markerUnits",
433
- "markerWidth",
434
- "mask",
435
- "maskContentUnits",
436
- "maskUnits",
437
- "mathematical",
438
- "max",
439
- "method",
440
- "min",
441
- "name",
442
- "offset",
443
- "opacity",
444
- "orient",
445
- "origin",
446
- "overline-position",
447
- "overline-thickness",
448
- "panose-1",
449
- "path",
450
- "pathLength",
451
- "patternContentUnits",
452
- "patternTransform",
453
- "patternUnits",
454
- "points",
455
- "preserveAspectRatio",
456
- "primitiveUnits",
457
- "r",
458
- "refX",
459
- "refY",
460
- "repeatCount",
461
- "repeatDur",
462
- "requiredExtensions",
463
- "requiredFeatures",
464
- "restart",
465
- "rotate",
466
- "rx",
467
- "ry",
468
- "slope",
469
- "spacing",
470
- "startOffset",
471
- "stdDeviation",
472
- "stemh",
473
- "stemv",
474
- "stop-color",
475
- "stop-opacity",
476
- "strikethrough-position",
477
- "strikethrough-thickness",
478
- "stroke",
479
- "stroke-dasharray",
480
- "stroke-dashoffset",
481
- "stroke-linecap",
482
- "stroke-linejoin",
483
- "stroke-miterlimit",
484
- "stroke-opacity",
485
- "stroke-width",
486
- "systemLanguage",
487
- "target",
488
- "text-anchor",
489
- "transform",
490
- "type",
491
- "u1",
492
- "u2",
493
- "underline-position",
494
- "underline-thickness",
495
- "unicode",
496
- "unicode-range",
497
- "units-per-em",
498
- "version",
499
- "viewBox",
500
- "visibility",
501
- "width",
502
- "widths",
503
- "x",
504
- "x-height",
505
- "x1",
506
- "x2",
507
- "xlink:actuate",
508
- "xlink:arcrole",
509
- "xlink:href",
510
- "xlink:role",
511
- "xlink:show",
512
- "xlink:title",
513
- "xlink:type",
514
- "xml:base",
515
- "xml:lang",
516
- "xml:space",
517
- "xmlns",
518
- "xmlns:xlink",
519
- "y",
520
- "y1",
521
- "y2",
522
- "zoomAndPan",
523
- ])
368
+ "accent-height",
369
+ "accumulate",
370
+ "additive",
371
+ "alphabetic",
372
+ "arabic-form",
373
+ "ascent",
374
+ "attributeName",
375
+ "attributeType",
376
+ "baseProfile",
377
+ "bbox",
378
+ "begin",
379
+ "calcMode",
380
+ "cap-height",
381
+ "class",
382
+ "clip-path",
383
+ "clip-rule",
384
+ "color",
385
+ "color-interpolation-filters",
386
+ "color-profile",
387
+ "color-rendering",
388
+ "content",
389
+ "cursor",
390
+ "cx",
391
+ "cy",
392
+ "d",
393
+ "descent",
394
+ "display",
395
+ "dur",
396
+ "dx",
397
+ "dy",
398
+ "end",
399
+ "fill",
400
+ "fill-opacity",
401
+ "fill-rule",
402
+ "filter",
403
+ "filterRes",
404
+ "filterUnits",
405
+ "font-family",
406
+ "font-size",
407
+ "font-stretch",
408
+ "font-style",
409
+ "font-variant",
410
+ "font-weight",
411
+ "fx",
412
+ "fy",
413
+ "g1",
414
+ "g2",
415
+ "glyph-name",
416
+ "gradientUnits",
417
+ "hanging",
418
+ "height",
419
+ "horiz-adv-x",
420
+ "horiz-origin-x",
421
+ "id",
422
+ "ideographic",
423
+ "k",
424
+ "keyPoints",
425
+ "keySplines",
426
+ "keyTimes",
427
+ "lang",
428
+ "marker",
429
+ "marker-end",
430
+ "marker-mid",
431
+ "marker-start",
432
+ "markerHeight",
433
+ "markerUnits",
434
+ "markerWidth",
435
+ "mask",
436
+ "maskContentUnits",
437
+ "maskUnits",
438
+ "mathematical",
439
+ "max",
440
+ "method",
441
+ "min",
442
+ "name",
443
+ "offset",
444
+ "opacity",
445
+ "orient",
446
+ "origin",
447
+ "overline-position",
448
+ "overline-thickness",
449
+ "panose-1",
450
+ "path",
451
+ "pathLength",
452
+ "patternContentUnits",
453
+ "patternTransform",
454
+ "patternUnits",
455
+ "points",
456
+ "preserveAspectRatio",
457
+ "primitiveUnits",
458
+ "r",
459
+ "refX",
460
+ "refY",
461
+ "repeatCount",
462
+ "repeatDur",
463
+ "requiredExtensions",
464
+ "requiredFeatures",
465
+ "restart",
466
+ "rotate",
467
+ "rx",
468
+ "ry",
469
+ "slope",
470
+ "spacing",
471
+ "startOffset",
472
+ "stdDeviation",
473
+ "stemh",
474
+ "stemv",
475
+ "stop-color",
476
+ "stop-opacity",
477
+ "strikethrough-position",
478
+ "strikethrough-thickness",
479
+ "stroke",
480
+ "stroke-dasharray",
481
+ "stroke-dashoffset",
482
+ "stroke-linecap",
483
+ "stroke-linejoin",
484
+ "stroke-miterlimit",
485
+ "stroke-opacity",
486
+ "stroke-width",
487
+ "systemLanguage",
488
+ "target",
489
+ "text-anchor",
490
+ "transform",
491
+ "type",
492
+ "u1",
493
+ "u2",
494
+ "underline-position",
495
+ "underline-thickness",
496
+ "unicode",
497
+ "unicode-range",
498
+ "units-per-em",
499
+ "version",
500
+ "viewBox",
501
+ "visibility",
502
+ "width",
503
+ "widths",
504
+ "x",
505
+ "x-height",
506
+ "x1",
507
+ "x2",
508
+ "xlink:actuate",
509
+ "xlink:arcrole",
510
+ "xlink:href",
511
+ "xlink:role",
512
+ "xlink:show",
513
+ "xlink:title",
514
+ "xlink:type",
515
+ "xml:base",
516
+ "xml:lang",
517
+ "xml:space",
518
+ "xmlns",
519
+ "xmlns:xlink",
520
+ "y",
521
+ "y1",
522
+ "y2",
523
+ "zoomAndPan",
524
+ ])
524
525
 
525
526
  ARIA_ATTRIBUTES = Set.new([
526
- "aria-activedescendant",
527
- "aria-atomic",
528
- "aria-autocomplete",
529
- "aria-braillelabel",
530
- "aria-brailleroledescription",
531
- "aria-busy",
532
- "aria-checked",
533
- "aria-colcount",
534
- "aria-colindex",
535
- "aria-colindextext",
536
- "aria-colspan",
537
- "aria-controls",
538
- "aria-current",
539
- "aria-describedby",
540
- "aria-description",
541
- "aria-details",
542
- "aria-disabled",
543
- "aria-dropeffect",
544
- "aria-errormessage",
545
- "aria-expanded",
546
- "aria-flowto",
547
- "aria-grabbed",
548
- "aria-haspopup",
549
- "aria-hidden",
550
- "aria-invalid",
551
- "aria-keyshortcuts",
552
- "aria-label",
553
- "aria-labelledby",
554
- "aria-level",
555
- "aria-live",
556
- "aria-multiline",
557
- "aria-multiselectable",
558
- "aria-orientation",
559
- "aria-owns",
560
- "aria-placeholder",
561
- "aria-posinset",
562
- "aria-pressed",
563
- "aria-readonly",
564
- "aria-relevant",
565
- "aria-required",
566
- "aria-roledescription",
567
- "aria-rowcount",
568
- "aria-rowindex",
569
- "aria-rowindextext",
570
- "aria-rowspan",
571
- "aria-selected",
572
- "aria-setsize",
573
- "aria-sort",
574
- "aria-valuemax",
575
- "aria-valuemin",
576
- "aria-valuenow",
577
- "aria-valuetext",
578
- "role",
579
- ])
527
+ "aria-activedescendant",
528
+ "aria-atomic",
529
+ "aria-autocomplete",
530
+ "aria-braillelabel",
531
+ "aria-brailleroledescription",
532
+ "aria-busy",
533
+ "aria-checked",
534
+ "aria-colcount",
535
+ "aria-colindex",
536
+ "aria-colindextext",
537
+ "aria-colspan",
538
+ "aria-controls",
539
+ "aria-current",
540
+ "aria-describedby",
541
+ "aria-description",
542
+ "aria-details",
543
+ "aria-disabled",
544
+ "aria-dropeffect",
545
+ "aria-errormessage",
546
+ "aria-expanded",
547
+ "aria-flowto",
548
+ "aria-grabbed",
549
+ "aria-haspopup",
550
+ "aria-hidden",
551
+ "aria-invalid",
552
+ "aria-keyshortcuts",
553
+ "aria-label",
554
+ "aria-labelledby",
555
+ "aria-level",
556
+ "aria-live",
557
+ "aria-multiline",
558
+ "aria-multiselectable",
559
+ "aria-orientation",
560
+ "aria-owns",
561
+ "aria-placeholder",
562
+ "aria-posinset",
563
+ "aria-pressed",
564
+ "aria-readonly",
565
+ "aria-relevant",
566
+ "aria-required",
567
+ "aria-roledescription",
568
+ "aria-rowcount",
569
+ "aria-rowindex",
570
+ "aria-rowindextext",
571
+ "aria-rowspan",
572
+ "aria-selected",
573
+ "aria-setsize",
574
+ "aria-sort",
575
+ "aria-valuemax",
576
+ "aria-valuemin",
577
+ "aria-valuenow",
578
+ "aria-valuetext",
579
+ "role",
580
+ ])
580
581
 
581
582
  ATTR_VAL_IS_URI = Set.new([
582
- "action",
583
- "cite",
584
- "href",
585
- "longdesc",
586
- "poster",
587
- "preload",
588
- "src",
589
- "xlink:href",
590
- "xml:base",
591
- ])
583
+ "action",
584
+ "cite",
585
+ "href",
586
+ "longdesc",
587
+ "poster",
588
+ "preload",
589
+ "src",
590
+ "xlink:href",
591
+ "xml:base",
592
+ ])
592
593
 
593
594
  SVG_ATTR_VAL_ALLOWS_REF = Set.new([
594
- "clip-path",
595
- "color-profile",
596
- "cursor",
597
- "fill",
598
- "filter",
599
- "marker",
600
- "marker-end",
601
- "marker-mid",
602
- "marker-start",
603
- "mask",
604
- "stroke",
605
- ])
595
+ "clip-path",
596
+ "color-profile",
597
+ "cursor",
598
+ "fill",
599
+ "filter",
600
+ "marker",
601
+ "marker-end",
602
+ "marker-mid",
603
+ "marker-start",
604
+ "mask",
605
+ "stroke",
606
+ ])
606
607
 
607
608
  SVG_ALLOW_LOCAL_HREF = Set.new([
608
- "altGlyph",
609
- "animate",
610
- "animateColor",
611
- "animateMotion",
612
- "animateTransform",
613
- "cursor",
614
- "feImage",
615
- "filter",
616
- "linearGradient",
617
- "pattern",
618
- "radialGradient",
619
- "set",
620
- "textpath",
621
- "tref",
622
- "use",
623
- ])
609
+ "altGlyph",
610
+ "animate",
611
+ "animateColor",
612
+ "animateMotion",
613
+ "animateTransform",
614
+ "cursor",
615
+ "feImage",
616
+ "filter",
617
+ "linearGradient",
618
+ "pattern",
619
+ "radialGradient",
620
+ "set",
621
+ "textpath",
622
+ "tref",
623
+ "use",
624
+ ])
624
625
 
625
626
  ACCEPTABLE_CSS_PROPERTIES = Set.new([
626
- "azimuth",
627
- "align-content",
628
- "align-items",
629
- "align-self",
630
- "aspect-ratio",
631
- "background-color",
632
- "border-bottom-color",
633
- "border-collapse",
634
- "border-color",
635
- "border-left-color",
636
- "border-right-color",
637
- "border-top-color",
638
- "clear",
639
- "color",
640
- "cursor",
641
- "direction",
642
- "display",
643
- "elevation",
644
- "flex",
645
- "flex-basis",
646
- "flex-direction",
647
- "flex-flow",
648
- "flex-grow",
649
- "flex-shrink",
650
- "flex-wrap",
651
- "float",
652
- "font",
653
- "font-family",
654
- "font-size",
655
- "font-style",
656
- "font-variant",
657
- "font-weight",
658
- "height",
659
- "justify-content",
660
- "letter-spacing",
661
- "line-height",
662
- "list-style",
663
- "list-style-type",
664
- "max-width",
665
- "order",
666
- "overflow",
667
- "overflow-x",
668
- "overflow-y",
669
- "page-break-after",
670
- "page-break-before",
671
- "page-break-inside",
672
- "pause",
673
- "pause-after",
674
- "pause-before",
675
- "pitch",
676
- "pitch-range",
677
- "richness",
678
- "speak",
679
- "speak-header",
680
- "speak-numeral",
681
- "speak-punctuation",
682
- "speech-rate",
683
- "stress",
684
- "text-align",
685
- "text-decoration",
686
- "text-indent",
687
- "unicode-bidi",
688
- "vertical-align",
689
- "voice-family",
690
- "volume",
691
- "white-space",
692
- "width",
693
- ])
627
+ "azimuth",
628
+ "align-content",
629
+ "align-items",
630
+ "align-self",
631
+ "aspect-ratio",
632
+ "background-color",
633
+ "border-bottom-color",
634
+ "border-collapse",
635
+ "border-color",
636
+ "border-left-color",
637
+ "border-right-color",
638
+ "border-top-color",
639
+ "clear",
640
+ "color",
641
+ "cursor",
642
+ "direction",
643
+ "display",
644
+ "elevation",
645
+ "flex",
646
+ "flex-basis",
647
+ "flex-direction",
648
+ "flex-flow",
649
+ "flex-grow",
650
+ "flex-shrink",
651
+ "flex-wrap",
652
+ "float",
653
+ "font",
654
+ "font-family",
655
+ "font-size",
656
+ "font-style",
657
+ "font-variant",
658
+ "font-weight",
659
+ "height",
660
+ "justify-content",
661
+ "letter-spacing",
662
+ "line-height",
663
+ "list-style",
664
+ "list-style-type",
665
+ "max-width",
666
+ "order",
667
+ "overflow",
668
+ "overflow-x",
669
+ "overflow-y",
670
+ "page-break-after",
671
+ "page-break-before",
672
+ "page-break-inside",
673
+ "pause",
674
+ "pause-after",
675
+ "pause-before",
676
+ "pitch",
677
+ "pitch-range",
678
+ "richness",
679
+ "speak",
680
+ "speak-header",
681
+ "speak-numeral",
682
+ "speak-punctuation",
683
+ "speech-rate",
684
+ "stress",
685
+ "text-align",
686
+ "text-decoration",
687
+ "text-indent",
688
+ "unicode-bidi",
689
+ "vertical-align",
690
+ "voice-family",
691
+ "volume",
692
+ "white-space",
693
+ "width",
694
+ ])
694
695
 
695
696
  ACCEPTABLE_CSS_KEYWORDS = Set.new([
696
- "!important",
697
- "auto",
698
- "block",
699
- "bold",
700
- "both",
701
- "bottom",
702
- "center",
703
- "collapse",
704
- "dashed",
705
- "dotted",
706
- "double",
707
- "groove",
708
- "hidden",
709
- "inherit",
710
- "initial",
711
- "inset",
712
- "italic",
713
- "left",
714
- "medium",
715
- "none",
716
- "normal",
717
- "nowrap",
718
- "outset",
719
- "pointer",
720
- "revert",
721
- "ridge",
722
- "right",
723
- "separate",
724
- "solid",
725
- "thick",
726
- "thin",
727
- "top",
728
- "transparent",
729
- "underline",
730
- "unset",
731
- ])
697
+ "!important",
698
+ "auto",
699
+ "block",
700
+ "bold",
701
+ "both",
702
+ "bottom",
703
+ "center",
704
+ "collapse",
705
+ "dashed",
706
+ "dotted",
707
+ "double",
708
+ "groove",
709
+ "hidden",
710
+ "inherit",
711
+ "initial",
712
+ "inset",
713
+ "italic",
714
+ "left",
715
+ "medium",
716
+ "none",
717
+ "normal",
718
+ "nowrap",
719
+ "outset",
720
+ "pointer",
721
+ "revert",
722
+ "ridge",
723
+ "right",
724
+ "separate",
725
+ "solid",
726
+ "thick",
727
+ "thin",
728
+ "top",
729
+ "transparent",
730
+ "underline",
731
+ "unset",
732
+ ])
732
733
 
733
734
  # https://www.w3.org/TR/css-color-3/#html4
734
735
  ACCEPTABLE_CSS_COLORS = Set.new([
735
- "aqua",
736
- "black",
737
- "blue",
738
- "fuchsia",
739
- "gray",
740
- "green",
741
- "lime",
742
- "maroon",
743
- "navy",
744
- "olive",
745
- "purple",
746
- "red",
747
- "silver",
748
- "teal",
749
- "white",
750
- "yellow",
751
- ])
736
+ "aqua",
737
+ "black",
738
+ "blue",
739
+ "fuchsia",
740
+ "gray",
741
+ "green",
742
+ "lime",
743
+ "maroon",
744
+ "navy",
745
+ "olive",
746
+ "purple",
747
+ "red",
748
+ "silver",
749
+ "teal",
750
+ "white",
751
+ "yellow",
752
+ ])
752
753
 
753
754
  # https://www.w3.org/TR/css-color-3/#svg-color
754
755
  ACCEPTABLE_CSS_EXTENDED_COLORS = Set.new([
755
- "aliceblue",
756
- "antiquewhite",
757
- "aqua",
758
- "aquamarine",
759
- "azure",
760
- "beige",
761
- "bisque",
762
- "black",
763
- "blanchedalmond",
764
- "blue",
765
- "blueviolet",
766
- "brown",
767
- "burlywood",
768
- "cadetblue",
769
- "chartreuse",
770
- "chocolate",
771
- "coral",
772
- "cornflowerblue",
773
- "cornsilk",
774
- "crimson",
775
- "cyan",
776
- "darkblue",
777
- "darkcyan",
778
- "darkgoldenrod",
779
- "darkgray",
780
- "darkgreen",
781
- "darkgrey",
782
- "darkkhaki",
783
- "darkmagenta",
784
- "darkolivegreen",
785
- "darkorange",
786
- "darkorchid",
787
- "darkred",
788
- "darksalmon",
789
- "darkseagreen",
790
- "darkslateblue",
791
- "darkslategray",
792
- "darkslategrey",
793
- "darkturquoise",
794
- "darkviolet",
795
- "deeppink",
796
- "deepskyblue",
797
- "dimgray",
798
- "dimgrey",
799
- "dodgerblue",
800
- "firebrick",
801
- "floralwhite",
802
- "forestgreen",
803
- "fuchsia",
804
- "gainsboro",
805
- "ghostwhite",
806
- "gold",
807
- "goldenrod",
808
- "gray",
809
- "green",
810
- "greenyellow",
811
- "grey",
812
- "honeydew",
813
- "hotpink",
814
- "indianred",
815
- "indigo",
816
- "ivory",
817
- "khaki",
818
- "lavender",
819
- "lavenderblush",
820
- "lawngreen",
821
- "lemonchiffon",
822
- "lightblue",
823
- "lightcoral",
824
- "lightcyan",
825
- "lightgoldenrodyellow",
826
- "lightgray",
827
- "lightgreen",
828
- "lightgrey",
829
- "lightpink",
830
- "lightsalmon",
831
- "lightseagreen",
832
- "lightskyblue",
833
- "lightslategray",
834
- "lightslategrey",
835
- "lightsteelblue",
836
- "lightyellow",
837
- "lime",
838
- "limegreen",
839
- "linen",
840
- "magenta",
841
- "maroon",
842
- "mediumaquamarine",
843
- "mediumblue",
844
- "mediumorchid",
845
- "mediumpurple",
846
- "mediumseagreen",
847
- "mediumslateblue",
848
- "mediumspringgreen",
849
- "mediumturquoise",
850
- "mediumvioletred",
851
- "midnightblue",
852
- "mintcream",
853
- "mistyrose",
854
- "moccasin",
855
- "navajowhite",
856
- "navy",
857
- "oldlace",
858
- "olive",
859
- "olivedrab",
860
- "orange",
861
- "orangered",
862
- "orchid",
863
- "palegoldenrod",
864
- "palegreen",
865
- "paleturquoise",
866
- "palevioletred",
867
- "papayawhip",
868
- "peachpuff",
869
- "peru",
870
- "pink",
871
- "plum",
872
- "powderblue",
873
- "purple",
874
- "red",
875
- "rosybrown",
876
- "royalblue",
877
- "saddlebrown",
878
- "salmon",
879
- "sandybrown",
880
- "seagreen",
881
- "seashell",
882
- "sienna",
883
- "silver",
884
- "skyblue",
885
- "slateblue",
886
- "slategray",
887
- "slategrey",
888
- "snow",
889
- "springgreen",
890
- "steelblue",
891
- "tan",
892
- "teal",
893
- "thistle",
894
- "tomato",
895
- "turquoise",
896
- "violet",
897
- "wheat",
898
- "white",
899
- "whitesmoke",
900
- "yellow",
901
- "yellowgreen",
902
- ])
756
+ "aliceblue",
757
+ "antiquewhite",
758
+ "aqua",
759
+ "aquamarine",
760
+ "azure",
761
+ "beige",
762
+ "bisque",
763
+ "black",
764
+ "blanchedalmond",
765
+ "blue",
766
+ "blueviolet",
767
+ "brown",
768
+ "burlywood",
769
+ "cadetblue",
770
+ "chartreuse",
771
+ "chocolate",
772
+ "coral",
773
+ "cornflowerblue",
774
+ "cornsilk",
775
+ "crimson",
776
+ "cyan",
777
+ "darkblue",
778
+ "darkcyan",
779
+ "darkgoldenrod",
780
+ "darkgray",
781
+ "darkgreen",
782
+ "darkgrey",
783
+ "darkkhaki",
784
+ "darkmagenta",
785
+ "darkolivegreen",
786
+ "darkorange",
787
+ "darkorchid",
788
+ "darkred",
789
+ "darksalmon",
790
+ "darkseagreen",
791
+ "darkslateblue",
792
+ "darkslategray",
793
+ "darkslategrey",
794
+ "darkturquoise",
795
+ "darkviolet",
796
+ "deeppink",
797
+ "deepskyblue",
798
+ "dimgray",
799
+ "dimgrey",
800
+ "dodgerblue",
801
+ "firebrick",
802
+ "floralwhite",
803
+ "forestgreen",
804
+ "fuchsia",
805
+ "gainsboro",
806
+ "ghostwhite",
807
+ "gold",
808
+ "goldenrod",
809
+ "gray",
810
+ "green",
811
+ "greenyellow",
812
+ "grey",
813
+ "honeydew",
814
+ "hotpink",
815
+ "indianred",
816
+ "indigo",
817
+ "ivory",
818
+ "khaki",
819
+ "lavender",
820
+ "lavenderblush",
821
+ "lawngreen",
822
+ "lemonchiffon",
823
+ "lightblue",
824
+ "lightcoral",
825
+ "lightcyan",
826
+ "lightgoldenrodyellow",
827
+ "lightgray",
828
+ "lightgreen",
829
+ "lightgrey",
830
+ "lightpink",
831
+ "lightsalmon",
832
+ "lightseagreen",
833
+ "lightskyblue",
834
+ "lightslategray",
835
+ "lightslategrey",
836
+ "lightsteelblue",
837
+ "lightyellow",
838
+ "lime",
839
+ "limegreen",
840
+ "linen",
841
+ "magenta",
842
+ "maroon",
843
+ "mediumaquamarine",
844
+ "mediumblue",
845
+ "mediumorchid",
846
+ "mediumpurple",
847
+ "mediumseagreen",
848
+ "mediumslateblue",
849
+ "mediumspringgreen",
850
+ "mediumturquoise",
851
+ "mediumvioletred",
852
+ "midnightblue",
853
+ "mintcream",
854
+ "mistyrose",
855
+ "moccasin",
856
+ "navajowhite",
857
+ "navy",
858
+ "oldlace",
859
+ "olive",
860
+ "olivedrab",
861
+ "orange",
862
+ "orangered",
863
+ "orchid",
864
+ "palegoldenrod",
865
+ "palegreen",
866
+ "paleturquoise",
867
+ "palevioletred",
868
+ "papayawhip",
869
+ "peachpuff",
870
+ "peru",
871
+ "pink",
872
+ "plum",
873
+ "powderblue",
874
+ "purple",
875
+ "red",
876
+ "rosybrown",
877
+ "royalblue",
878
+ "saddlebrown",
879
+ "salmon",
880
+ "sandybrown",
881
+ "seagreen",
882
+ "seashell",
883
+ "sienna",
884
+ "silver",
885
+ "skyblue",
886
+ "slateblue",
887
+ "slategray",
888
+ "slategrey",
889
+ "snow",
890
+ "springgreen",
891
+ "steelblue",
892
+ "tan",
893
+ "teal",
894
+ "thistle",
895
+ "tomato",
896
+ "turquoise",
897
+ "violet",
898
+ "wheat",
899
+ "white",
900
+ "whitesmoke",
901
+ "yellow",
902
+ "yellowgreen",
903
+ ])
903
904
 
904
905
  # see https://www.quackit.com/css/functions/
905
906
  # omit `url` and `image` from that list
906
907
  ACCEPTABLE_CSS_FUNCTIONS = Set.new([
907
- "attr",
908
- "blur",
909
- "brightness",
910
- "calc",
911
- "circle",
912
- "contrast",
913
- "counter",
914
- "counters",
915
- "cubic-bezier",
916
- "drop-shadow",
917
- "ellipse",
918
- "grayscale",
919
- "hsl",
920
- "hsla",
921
- "hue-rotate",
922
- "hwb",
923
- "inset",
924
- "invert",
925
- "linear-gradient",
926
- "matrix",
927
- "matrix3d",
928
- "opacity",
929
- "perspective",
930
- "polygon",
931
- "radial-gradient",
932
- "repeating-linear-gradient",
933
- "repeating-radial-gradient",
934
- "rgb",
935
- "rgba",
936
- "rotate",
937
- "rotate3d",
938
- "rotateX",
939
- "rotateY",
940
- "rotateZ",
941
- "saturate",
942
- "sepia",
943
- "scale",
944
- "scale3d",
945
- "scaleX",
946
- "scaleY",
947
- "scaleZ",
948
- "skew",
949
- "skewX",
950
- "skewY",
951
- "symbols",
952
- "translate",
953
- "translate3d",
954
- "translateX",
955
- "translateY",
956
- "translateZ",
957
- ])
908
+ "attr",
909
+ "blur",
910
+ "brightness",
911
+ "calc",
912
+ "circle",
913
+ "contrast",
914
+ "counter",
915
+ "counters",
916
+ "cubic-bezier",
917
+ "drop-shadow",
918
+ "ellipse",
919
+ "grayscale",
920
+ "hsl",
921
+ "hsla",
922
+ "hue-rotate",
923
+ "hwb",
924
+ "inset",
925
+ "invert",
926
+ "linear-gradient",
927
+ "matrix",
928
+ "matrix3d",
929
+ "opacity",
930
+ "perspective",
931
+ "polygon",
932
+ "radial-gradient",
933
+ "repeating-linear-gradient",
934
+ "repeating-radial-gradient",
935
+ "rgb",
936
+ "rgba",
937
+ "rotate",
938
+ "rotate3d",
939
+ "rotateX",
940
+ "rotateY",
941
+ "rotateZ",
942
+ "saturate",
943
+ "sepia",
944
+ "scale",
945
+ "scale3d",
946
+ "scaleX",
947
+ "scaleY",
948
+ "scaleZ",
949
+ "skew",
950
+ "skewX",
951
+ "skewY",
952
+ "symbols",
953
+ "translate",
954
+ "translate3d",
955
+ "translateX",
956
+ "translateY",
957
+ "translateZ",
958
+ ])
958
959
 
959
960
  SHORTHAND_CSS_PROPERTIES = Set.new([
960
- "background",
961
- "border",
962
- "margin",
963
- "padding",
964
- ])
961
+ "background",
962
+ "border",
963
+ "margin",
964
+ "padding",
965
+ ])
965
966
 
966
967
  ACCEPTABLE_SVG_PROPERTIES = Set.new([
967
- "fill",
968
- "fill-opacity",
969
- "fill-rule",
970
- "stroke",
971
- "stroke-width",
972
- "stroke-linecap",
973
- "stroke-linejoin",
974
- "stroke-opacity",
975
- ])
968
+ "fill",
969
+ "fill-opacity",
970
+ "fill-rule",
971
+ "stroke",
972
+ "stroke-width",
973
+ "stroke-linecap",
974
+ "stroke-linejoin",
975
+ "stroke-opacity",
976
+ ])
976
977
 
977
978
  PROTOCOL_SEPARATOR = /:|(&#0*58)|(&#x70)|(&#x0*3a)|(%|&#37;)3A/i
978
979
 
979
980
  ACCEPTABLE_PROTOCOLS = Set.new([
980
- "afs",
981
- "aim",
982
- "callto",
983
- "data",
984
- "ed2k",
985
- "fax",
986
- "feed",
987
- "ftp",
988
- "gopher",
989
- "http",
990
- "https",
991
- "irc",
992
- "line",
993
- "mailto",
994
- "modem",
995
- "news",
996
- "nntp",
997
- "rsync",
998
- "rtsp",
999
- "sftp",
1000
- "sms",
1001
- "ssh",
1002
- "tag",
1003
- "tel",
1004
- "telnet",
1005
- "urn",
1006
- "webcal",
1007
- "xmpp",
1008
- ])
981
+ "afs",
982
+ "aim",
983
+ "callto",
984
+ "data",
985
+ "ed2k",
986
+ "fax",
987
+ "feed",
988
+ "ftp",
989
+ "gopher",
990
+ "http",
991
+ "https",
992
+ "irc",
993
+ "line",
994
+ "mailto",
995
+ "modem",
996
+ "news",
997
+ "nntp",
998
+ "rsync",
999
+ "rtsp",
1000
+ "sftp",
1001
+ "sms",
1002
+ "ssh",
1003
+ "tag",
1004
+ "tel",
1005
+ "telnet",
1006
+ "urn",
1007
+ "webcal",
1008
+ "xmpp",
1009
+ ])
1009
1010
 
1010
1011
  ACCEPTABLE_URI_DATA_MEDIATYPES = Set.new([
1011
- "image/gif",
1012
- "image/jpeg",
1013
- "image/png",
1014
- "text/css",
1015
- "text/plain",
1016
- ])
1012
+ "image/gif",
1013
+ "image/jpeg",
1014
+ "image/png",
1015
+ "text/css",
1016
+ "text/plain",
1017
+ ])
1017
1018
 
1018
1019
  # subclasses may define their own versions of these constants
1019
1020
  ALLOWED_ELEMENTS = ACCEPTABLE_ELEMENTS + MATHML_ELEMENTS + SVG_ELEMENTS
@@ -1028,19 +1029,19 @@ module Loofah
1028
1029
  # TODO: remove VOID_ELEMENTS in a future major release
1029
1030
  # and put it in the tests (it is used only for testing, not for functional behavior)
1030
1031
  VOID_ELEMENTS = Set.new([
1031
- "area",
1032
- "br",
1033
- "hr",
1034
- "img",
1035
- "input",
1036
- ])
1032
+ "area",
1033
+ "br",
1034
+ "hr",
1035
+ "img",
1036
+ "input",
1037
+ ])
1037
1038
 
1038
1039
  # additional tags we should consider safe since we have libxml2 fixing up our documents.
1039
1040
  TAGS_SAFE_WITH_LIBXML2 = Set.new([
1040
- "body",
1041
- "head",
1042
- "html",
1043
- ])
1041
+ "body",
1042
+ "head",
1043
+ "html",
1044
+ ])
1044
1045
  ALLOWED_ELEMENTS_WITH_LIBXML2 = ALLOWED_ELEMENTS + TAGS_SAFE_WITH_LIBXML2
1045
1046
  end
1046
1047
 
@@ -1049,6 +1050,6 @@ module Loofah
1049
1050
  deprecate_constant :WhiteList
1050
1051
  end
1051
1052
 
1052
- ::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants ::Loofah::HTML5::SafeList
1053
+ ::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants(::Loofah::HTML5::SafeList)
1053
1054
  end
1054
1055
  end