@jupyterlab/apputils 4.6.0-alpha.1 → 4.6.0-alpha.3
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.
- package/lib/dialog.js +1 -0
- package/lib/dialog.js.map +1 -1
- package/lib/kernelstatuses.js +1 -1
- package/lib/kernelstatuses.js.map +1 -1
- package/lib/runningSessions.js +1 -1
- package/lib/runningSessions.js.map +1 -1
- package/lib/sanitizer.d.ts +8 -1
- package/lib/sanitizer.js +576 -544
- package/lib/sanitizer.js.map +1 -1
- package/package.json +11 -11
- package/src/dialog.tsx +1 -0
- package/src/kernelstatuses.tsx +2 -0
- package/src/runningSessions.tsx +1 -0
- package/src/sanitizer.ts +579 -544
- package/style/dialog.css +8 -2
package/lib/sanitizer.js
CHANGED
|
@@ -532,552 +532,575 @@ export class Sanitizer {
|
|
|
532
532
|
constructor() {
|
|
533
533
|
this._autolink = true;
|
|
534
534
|
this._allowNamedProperties = false;
|
|
535
|
-
this._generateOptions = () =>
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
'article',
|
|
544
|
-
'aside',
|
|
545
|
-
'audio',
|
|
546
|
-
'b',
|
|
547
|
-
'bdi',
|
|
548
|
-
'bdo',
|
|
549
|
-
'big',
|
|
550
|
-
'blockquote',
|
|
551
|
-
'br',
|
|
552
|
-
'button',
|
|
553
|
-
'canvas',
|
|
554
|
-
'caption',
|
|
555
|
-
'center',
|
|
556
|
-
'cite',
|
|
557
|
-
'code',
|
|
558
|
-
'col',
|
|
559
|
-
'colgroup',
|
|
560
|
-
'colspan',
|
|
561
|
-
'command',
|
|
562
|
-
'data',
|
|
563
|
-
'datalist',
|
|
564
|
-
'dd',
|
|
565
|
-
'del',
|
|
566
|
-
'details',
|
|
567
|
-
'dfn',
|
|
568
|
-
'dir',
|
|
569
|
-
'div',
|
|
570
|
-
'dl',
|
|
571
|
-
'dt',
|
|
572
|
-
'em',
|
|
573
|
-
'fieldset',
|
|
574
|
-
'figcaption',
|
|
575
|
-
'figure',
|
|
576
|
-
'font',
|
|
577
|
-
'footer',
|
|
578
|
-
'form',
|
|
579
|
-
'h1',
|
|
580
|
-
'h2',
|
|
581
|
-
'h3',
|
|
582
|
-
'h4',
|
|
583
|
-
'h5',
|
|
584
|
-
'h6',
|
|
585
|
-
'header',
|
|
586
|
-
'hgroup',
|
|
587
|
-
'hr',
|
|
588
|
-
'i',
|
|
589
|
-
// 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html
|
|
590
|
-
// , 'iframe'
|
|
591
|
-
'img',
|
|
592
|
-
'input',
|
|
593
|
-
'ins',
|
|
594
|
-
'kbd',
|
|
595
|
-
'label',
|
|
596
|
-
'legend',
|
|
597
|
-
'li',
|
|
598
|
-
'map',
|
|
599
|
-
'mark',
|
|
600
|
-
'menu',
|
|
601
|
-
'meter',
|
|
602
|
-
'nav',
|
|
603
|
-
'nobr',
|
|
604
|
-
'ol',
|
|
605
|
-
'optgroup',
|
|
606
|
-
'option',
|
|
607
|
-
'output',
|
|
608
|
-
'p',
|
|
609
|
-
'pre',
|
|
610
|
-
'progress',
|
|
611
|
-
'q',
|
|
612
|
-
'rowspan',
|
|
613
|
-
's',
|
|
614
|
-
'samp',
|
|
615
|
-
'section',
|
|
616
|
-
'select',
|
|
617
|
-
'small',
|
|
618
|
-
'source',
|
|
619
|
-
'span',
|
|
620
|
-
'strike',
|
|
621
|
-
'strong',
|
|
622
|
-
'sub',
|
|
623
|
-
'summary',
|
|
624
|
-
'sup',
|
|
625
|
-
'table',
|
|
626
|
-
'tbody',
|
|
627
|
-
'td',
|
|
628
|
-
'textarea',
|
|
629
|
-
'tfoot',
|
|
630
|
-
'th',
|
|
631
|
-
'thead',
|
|
632
|
-
'time',
|
|
633
|
-
'tr',
|
|
634
|
-
'track',
|
|
635
|
-
'tt',
|
|
636
|
-
'u',
|
|
637
|
-
'ul',
|
|
638
|
-
'var',
|
|
639
|
-
'video',
|
|
640
|
-
'wbr'
|
|
641
|
-
],
|
|
642
|
-
// Attributes that HTML tags are allowed to have, extracted from Google Caja.
|
|
643
|
-
// See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435
|
|
644
|
-
allowedAttributes: {
|
|
645
|
-
'*': [
|
|
646
|
-
'class',
|
|
647
|
-
'dir',
|
|
648
|
-
'draggable',
|
|
649
|
-
'hidden',
|
|
650
|
-
...(this._allowNamedProperties ? ['id'] : []),
|
|
651
|
-
'inert',
|
|
652
|
-
'itemprop',
|
|
653
|
-
'itemref',
|
|
654
|
-
'itemscope',
|
|
655
|
-
'lang',
|
|
656
|
-
'spellcheck',
|
|
657
|
-
'style',
|
|
658
|
-
'title',
|
|
659
|
-
'translate'
|
|
660
|
-
],
|
|
661
|
-
// 'rel' and 'target' were *not* allowed by Google Caja
|
|
662
|
-
a: [
|
|
663
|
-
'accesskey',
|
|
664
|
-
'coords',
|
|
665
|
-
'href',
|
|
666
|
-
'hreflang',
|
|
667
|
-
...(this._allowNamedProperties ? ['name'] : []),
|
|
668
|
-
'rel',
|
|
669
|
-
'shape',
|
|
670
|
-
'tabindex',
|
|
671
|
-
'target',
|
|
672
|
-
'type'
|
|
673
|
-
],
|
|
674
|
-
area: [
|
|
675
|
-
'accesskey',
|
|
676
|
-
'alt',
|
|
677
|
-
'coords',
|
|
678
|
-
'href',
|
|
679
|
-
'nohref',
|
|
680
|
-
'shape',
|
|
681
|
-
'tabindex'
|
|
682
|
-
],
|
|
683
|
-
// 'autoplay' was *not* allowed by Google Caja
|
|
684
|
-
audio: [
|
|
685
|
-
'autoplay',
|
|
686
|
-
'controls',
|
|
687
|
-
'loop',
|
|
688
|
-
'mediagroup',
|
|
689
|
-
'muted',
|
|
690
|
-
'preload',
|
|
691
|
-
'src'
|
|
692
|
-
],
|
|
693
|
-
bdo: ['dir'],
|
|
694
|
-
blockquote: ['cite'],
|
|
695
|
-
br: ['clear'],
|
|
696
|
-
button: [
|
|
697
|
-
'accesskey',
|
|
698
|
-
'data-commandlinker-args',
|
|
699
|
-
'data-commandlinker-command',
|
|
700
|
-
'disabled',
|
|
701
|
-
...(this._allowNamedProperties ? ['name'] : []),
|
|
702
|
-
'tabindex',
|
|
703
|
-
'type',
|
|
704
|
-
'value'
|
|
705
|
-
],
|
|
706
|
-
canvas: ['height', 'width'],
|
|
707
|
-
caption: ['align'],
|
|
708
|
-
col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
709
|
-
colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
710
|
-
command: [
|
|
711
|
-
'checked',
|
|
712
|
-
'command',
|
|
713
|
-
'disabled',
|
|
714
|
-
'icon',
|
|
715
|
-
'label',
|
|
716
|
-
'radiogroup',
|
|
717
|
-
'type'
|
|
718
|
-
],
|
|
719
|
-
data: ['value'],
|
|
720
|
-
del: ['cite', 'datetime'],
|
|
721
|
-
details: ['open'],
|
|
722
|
-
dir: ['compact'],
|
|
723
|
-
div: ['align'],
|
|
724
|
-
dl: ['compact'],
|
|
725
|
-
fieldset: ['disabled'],
|
|
726
|
-
font: ['color', 'face', 'size'],
|
|
727
|
-
form: [
|
|
728
|
-
'accept',
|
|
729
|
-
'autocomplete',
|
|
730
|
-
'enctype',
|
|
731
|
-
'method',
|
|
732
|
-
...(this._allowNamedProperties ? ['name'] : []),
|
|
733
|
-
'novalidate'
|
|
734
|
-
],
|
|
735
|
-
h1: ['align'],
|
|
736
|
-
h2: ['align'],
|
|
737
|
-
h3: ['align'],
|
|
738
|
-
h4: ['align'],
|
|
739
|
-
h5: ['align'],
|
|
740
|
-
h6: ['align'],
|
|
741
|
-
hr: ['align', 'noshade', 'size', 'width'],
|
|
742
|
-
iframe: [
|
|
743
|
-
'align',
|
|
744
|
-
'frameborder',
|
|
745
|
-
'height',
|
|
746
|
-
'marginheight',
|
|
747
|
-
'marginwidth',
|
|
748
|
-
'width'
|
|
749
|
-
],
|
|
750
|
-
img: [
|
|
751
|
-
'align',
|
|
752
|
-
'alt',
|
|
753
|
-
'border',
|
|
754
|
-
'height',
|
|
755
|
-
'hspace',
|
|
756
|
-
'ismap',
|
|
757
|
-
...(this._allowNamedProperties ? ['name'] : []),
|
|
758
|
-
'src',
|
|
759
|
-
'usemap',
|
|
760
|
-
'vspace',
|
|
761
|
-
'width'
|
|
762
|
-
],
|
|
763
|
-
input: [
|
|
764
|
-
'accept',
|
|
765
|
-
'accesskey',
|
|
766
|
-
'align',
|
|
767
|
-
'alt',
|
|
768
|
-
'autocomplete',
|
|
769
|
-
'checked',
|
|
770
|
-
'disabled',
|
|
771
|
-
'inputmode',
|
|
772
|
-
'ismap',
|
|
773
|
-
'list',
|
|
774
|
-
'max',
|
|
775
|
-
'maxlength',
|
|
776
|
-
'min',
|
|
777
|
-
'multiple',
|
|
778
|
-
...(this._allowNamedProperties ? ['name'] : []),
|
|
779
|
-
'placeholder',
|
|
780
|
-
'readonly',
|
|
781
|
-
'required',
|
|
782
|
-
'size',
|
|
783
|
-
'src',
|
|
784
|
-
'step',
|
|
785
|
-
'tabindex',
|
|
786
|
-
'type',
|
|
787
|
-
'usemap',
|
|
788
|
-
'value'
|
|
789
|
-
],
|
|
790
|
-
ins: ['cite', 'datetime'],
|
|
791
|
-
label: ['accesskey', 'for'],
|
|
792
|
-
legend: ['accesskey', 'align'],
|
|
793
|
-
li: ['type', 'value'],
|
|
794
|
-
map: this._allowNamedProperties ? ['name'] : [],
|
|
795
|
-
menu: ['compact', 'label', 'type'],
|
|
796
|
-
meter: ['high', 'low', 'max', 'min', 'value'],
|
|
797
|
-
ol: ['compact', 'reversed', 'start', 'type'],
|
|
798
|
-
optgroup: ['disabled', 'label'],
|
|
799
|
-
option: ['disabled', 'label', 'selected', 'value'],
|
|
800
|
-
output: ['for', ...(this._allowNamedProperties ? ['name'] : [])],
|
|
801
|
-
p: ['align'],
|
|
802
|
-
pre: ['width'],
|
|
803
|
-
progress: ['max', 'min', 'value'],
|
|
804
|
-
q: ['cite'],
|
|
805
|
-
select: [
|
|
806
|
-
'autocomplete',
|
|
807
|
-
'disabled',
|
|
808
|
-
'multiple',
|
|
809
|
-
...(this._allowNamedProperties ? ['name'] : []),
|
|
810
|
-
'required',
|
|
811
|
-
'size',
|
|
812
|
-
'tabindex'
|
|
813
|
-
],
|
|
814
|
-
source: ['type'],
|
|
815
|
-
table: [
|
|
816
|
-
'align',
|
|
817
|
-
'bgcolor',
|
|
818
|
-
'border',
|
|
819
|
-
'cellpadding',
|
|
820
|
-
'cellspacing',
|
|
821
|
-
'frame',
|
|
822
|
-
'rules',
|
|
823
|
-
'summary',
|
|
824
|
-
'width'
|
|
825
|
-
],
|
|
826
|
-
tbody: ['align', 'char', 'charoff', 'valign'],
|
|
827
|
-
td: [
|
|
535
|
+
this._generateOptions = () => {
|
|
536
|
+
const schemesToAllow = Array.isArray(this._customAllowedSchemes)
|
|
537
|
+
? this._customAllowedSchemes
|
|
538
|
+
: [...sanitize.defaults.allowedSchemes];
|
|
539
|
+
return {
|
|
540
|
+
// HTML tags that are allowed to be used. Tags were extracted from Google Caja
|
|
541
|
+
allowedTags: [
|
|
542
|
+
'a',
|
|
828
543
|
'abbr',
|
|
829
|
-
'
|
|
830
|
-
'
|
|
831
|
-
'
|
|
832
|
-
'
|
|
833
|
-
'
|
|
544
|
+
'acronym',
|
|
545
|
+
'address',
|
|
546
|
+
'area',
|
|
547
|
+
'article',
|
|
548
|
+
'aside',
|
|
549
|
+
'audio',
|
|
550
|
+
'b',
|
|
551
|
+
'bdi',
|
|
552
|
+
'bdo',
|
|
553
|
+
'big',
|
|
554
|
+
'blockquote',
|
|
555
|
+
'br',
|
|
556
|
+
'button',
|
|
557
|
+
'canvas',
|
|
558
|
+
'caption',
|
|
559
|
+
'center',
|
|
560
|
+
'cite',
|
|
561
|
+
'code',
|
|
562
|
+
'col',
|
|
563
|
+
'colgroup',
|
|
834
564
|
'colspan',
|
|
835
|
-
'
|
|
836
|
-
'
|
|
837
|
-
'
|
|
838
|
-
'
|
|
839
|
-
'
|
|
840
|
-
'
|
|
841
|
-
'
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
'
|
|
845
|
-
'
|
|
846
|
-
'
|
|
847
|
-
'
|
|
848
|
-
'
|
|
849
|
-
|
|
850
|
-
'
|
|
851
|
-
'
|
|
852
|
-
'
|
|
853
|
-
'
|
|
854
|
-
'
|
|
855
|
-
'
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
'
|
|
860
|
-
'
|
|
861
|
-
'
|
|
862
|
-
'
|
|
863
|
-
'
|
|
864
|
-
'
|
|
865
|
-
'
|
|
866
|
-
'
|
|
867
|
-
'
|
|
868
|
-
'
|
|
565
|
+
'command',
|
|
566
|
+
'data',
|
|
567
|
+
'datalist',
|
|
568
|
+
'dd',
|
|
569
|
+
'del',
|
|
570
|
+
'details',
|
|
571
|
+
'dfn',
|
|
572
|
+
'dir',
|
|
573
|
+
'div',
|
|
574
|
+
'dl',
|
|
575
|
+
'dt',
|
|
576
|
+
'em',
|
|
577
|
+
'fieldset',
|
|
578
|
+
'figcaption',
|
|
579
|
+
'figure',
|
|
580
|
+
'font',
|
|
581
|
+
'footer',
|
|
582
|
+
'form',
|
|
583
|
+
'h1',
|
|
584
|
+
'h2',
|
|
585
|
+
'h3',
|
|
586
|
+
'h4',
|
|
587
|
+
'h5',
|
|
588
|
+
'h6',
|
|
589
|
+
'header',
|
|
590
|
+
'hgroup',
|
|
591
|
+
'hr',
|
|
592
|
+
'i',
|
|
593
|
+
// 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html
|
|
594
|
+
// , 'iframe'
|
|
595
|
+
'img',
|
|
596
|
+
'input',
|
|
597
|
+
'ins',
|
|
598
|
+
'kbd',
|
|
599
|
+
'label',
|
|
600
|
+
'legend',
|
|
601
|
+
'li',
|
|
602
|
+
'map',
|
|
603
|
+
'mark',
|
|
604
|
+
'menu',
|
|
605
|
+
'meter',
|
|
606
|
+
'nav',
|
|
607
|
+
'nobr',
|
|
608
|
+
'ol',
|
|
609
|
+
'optgroup',
|
|
610
|
+
'option',
|
|
611
|
+
'output',
|
|
612
|
+
'p',
|
|
613
|
+
'pre',
|
|
614
|
+
'progress',
|
|
615
|
+
'q',
|
|
869
616
|
'rowspan',
|
|
870
|
-
'
|
|
871
|
-
'
|
|
872
|
-
'
|
|
617
|
+
's',
|
|
618
|
+
'samp',
|
|
619
|
+
'section',
|
|
620
|
+
'select',
|
|
621
|
+
'small',
|
|
622
|
+
'source',
|
|
623
|
+
'span',
|
|
624
|
+
'strike',
|
|
625
|
+
'strong',
|
|
626
|
+
'sub',
|
|
627
|
+
'summary',
|
|
628
|
+
'sup',
|
|
629
|
+
'table',
|
|
630
|
+
'tbody',
|
|
631
|
+
'td',
|
|
632
|
+
'textarea',
|
|
633
|
+
'tfoot',
|
|
634
|
+
'th',
|
|
635
|
+
'thead',
|
|
636
|
+
'time',
|
|
637
|
+
'tr',
|
|
638
|
+
'track',
|
|
639
|
+
'tt',
|
|
640
|
+
'u',
|
|
641
|
+
'ul',
|
|
642
|
+
'var',
|
|
643
|
+
'video',
|
|
644
|
+
'wbr'
|
|
873
645
|
],
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
'
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
'
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
'
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
'
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
'align
|
|
1026
|
-
'
|
|
1027
|
-
'
|
|
1028
|
-
|
|
1029
|
-
'
|
|
1030
|
-
'
|
|
1031
|
-
'
|
|
1032
|
-
'
|
|
1033
|
-
'
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
'
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
'
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
646
|
+
// Attributes that HTML tags are allowed to have, extracted from Google Caja.
|
|
647
|
+
// See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435
|
|
648
|
+
allowedAttributes: {
|
|
649
|
+
'*': [
|
|
650
|
+
'class',
|
|
651
|
+
'data-jupyter-id',
|
|
652
|
+
'dir',
|
|
653
|
+
'draggable',
|
|
654
|
+
'hidden',
|
|
655
|
+
'id',
|
|
656
|
+
'inert',
|
|
657
|
+
'itemprop',
|
|
658
|
+
'itemref',
|
|
659
|
+
'itemscope',
|
|
660
|
+
'lang',
|
|
661
|
+
'spellcheck',
|
|
662
|
+
'style',
|
|
663
|
+
'title',
|
|
664
|
+
'translate'
|
|
665
|
+
],
|
|
666
|
+
// 'rel' and 'target' were *not* allowed by Google Caja
|
|
667
|
+
a: [
|
|
668
|
+
'accesskey',
|
|
669
|
+
'coords',
|
|
670
|
+
'href',
|
|
671
|
+
'hreflang',
|
|
672
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
673
|
+
'rel',
|
|
674
|
+
'shape',
|
|
675
|
+
'tabindex',
|
|
676
|
+
'target',
|
|
677
|
+
'type'
|
|
678
|
+
],
|
|
679
|
+
area: [
|
|
680
|
+
'accesskey',
|
|
681
|
+
'alt',
|
|
682
|
+
'coords',
|
|
683
|
+
'href',
|
|
684
|
+
'nohref',
|
|
685
|
+
'shape',
|
|
686
|
+
'tabindex'
|
|
687
|
+
],
|
|
688
|
+
// 'autoplay' was *not* allowed by Google Caja
|
|
689
|
+
audio: [
|
|
690
|
+
'autoplay',
|
|
691
|
+
'controls',
|
|
692
|
+
'loop',
|
|
693
|
+
'mediagroup',
|
|
694
|
+
'muted',
|
|
695
|
+
'preload',
|
|
696
|
+
'src'
|
|
697
|
+
],
|
|
698
|
+
bdo: ['dir'],
|
|
699
|
+
blockquote: ['cite'],
|
|
700
|
+
br: ['clear'],
|
|
701
|
+
button: [
|
|
702
|
+
'accesskey',
|
|
703
|
+
'data-commandlinker-args',
|
|
704
|
+
'data-commandlinker-command',
|
|
705
|
+
'disabled',
|
|
706
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
707
|
+
'tabindex',
|
|
708
|
+
'type',
|
|
709
|
+
'value'
|
|
710
|
+
],
|
|
711
|
+
canvas: ['height', 'width'],
|
|
712
|
+
caption: ['align'],
|
|
713
|
+
col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
714
|
+
colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
715
|
+
command: [
|
|
716
|
+
'checked',
|
|
717
|
+
'command',
|
|
718
|
+
'disabled',
|
|
719
|
+
'icon',
|
|
720
|
+
'label',
|
|
721
|
+
'radiogroup',
|
|
722
|
+
'type'
|
|
723
|
+
],
|
|
724
|
+
data: ['value'],
|
|
725
|
+
del: ['cite', 'datetime'],
|
|
726
|
+
details: ['open'],
|
|
727
|
+
dir: ['compact'],
|
|
728
|
+
div: ['align'],
|
|
729
|
+
dl: ['compact'],
|
|
730
|
+
fieldset: ['disabled'],
|
|
731
|
+
font: ['color', 'face', 'size'],
|
|
732
|
+
form: [
|
|
733
|
+
'accept',
|
|
734
|
+
'autocomplete',
|
|
735
|
+
'enctype',
|
|
736
|
+
'method',
|
|
737
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
738
|
+
'novalidate'
|
|
739
|
+
],
|
|
740
|
+
h1: ['align'],
|
|
741
|
+
h2: ['align'],
|
|
742
|
+
h3: ['align'],
|
|
743
|
+
h4: ['align'],
|
|
744
|
+
h5: ['align'],
|
|
745
|
+
h6: ['align'],
|
|
746
|
+
hr: ['align', 'noshade', 'size', 'width'],
|
|
747
|
+
iframe: [
|
|
748
|
+
'align',
|
|
749
|
+
'frameborder',
|
|
750
|
+
'height',
|
|
751
|
+
'marginheight',
|
|
752
|
+
'marginwidth',
|
|
753
|
+
'width'
|
|
754
|
+
],
|
|
755
|
+
img: [
|
|
756
|
+
'align',
|
|
757
|
+
'alt',
|
|
758
|
+
'border',
|
|
759
|
+
'height',
|
|
760
|
+
'hspace',
|
|
761
|
+
'ismap',
|
|
762
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
763
|
+
'src',
|
|
764
|
+
'usemap',
|
|
765
|
+
'vspace',
|
|
766
|
+
'width'
|
|
767
|
+
],
|
|
768
|
+
input: [
|
|
769
|
+
'accept',
|
|
770
|
+
'accesskey',
|
|
771
|
+
'align',
|
|
772
|
+
'alt',
|
|
773
|
+
'autocomplete',
|
|
774
|
+
'checked',
|
|
775
|
+
'disabled',
|
|
776
|
+
'inputmode',
|
|
777
|
+
'ismap',
|
|
778
|
+
'list',
|
|
779
|
+
'max',
|
|
780
|
+
'maxlength',
|
|
781
|
+
'min',
|
|
782
|
+
'multiple',
|
|
783
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
784
|
+
'placeholder',
|
|
785
|
+
'readonly',
|
|
786
|
+
'required',
|
|
787
|
+
'size',
|
|
788
|
+
'src',
|
|
789
|
+
'step',
|
|
790
|
+
'tabindex',
|
|
791
|
+
'type',
|
|
792
|
+
'usemap',
|
|
793
|
+
'value'
|
|
794
|
+
],
|
|
795
|
+
ins: ['cite', 'datetime'],
|
|
796
|
+
label: ['accesskey', 'for'],
|
|
797
|
+
legend: ['accesskey', 'align'],
|
|
798
|
+
li: ['type', 'value'],
|
|
799
|
+
map: this._allowNamedProperties ? ['name'] : [],
|
|
800
|
+
menu: ['compact', 'label', 'type'],
|
|
801
|
+
meter: ['high', 'low', 'max', 'min', 'value'],
|
|
802
|
+
ol: ['compact', 'reversed', 'start', 'type'],
|
|
803
|
+
optgroup: ['disabled', 'label'],
|
|
804
|
+
option: ['disabled', 'label', 'selected', 'value'],
|
|
805
|
+
output: ['for', ...(this._allowNamedProperties ? ['name'] : [])],
|
|
806
|
+
p: ['align'],
|
|
807
|
+
pre: ['width'],
|
|
808
|
+
progress: ['max', 'min', 'value'],
|
|
809
|
+
q: ['cite'],
|
|
810
|
+
select: [
|
|
811
|
+
'autocomplete',
|
|
812
|
+
'disabled',
|
|
813
|
+
'multiple',
|
|
814
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
815
|
+
'required',
|
|
816
|
+
'size',
|
|
817
|
+
'tabindex'
|
|
818
|
+
],
|
|
819
|
+
source: ['type'],
|
|
820
|
+
table: [
|
|
821
|
+
'align',
|
|
822
|
+
'bgcolor',
|
|
823
|
+
'border',
|
|
824
|
+
'cellpadding',
|
|
825
|
+
'cellspacing',
|
|
826
|
+
'frame',
|
|
827
|
+
'rules',
|
|
828
|
+
'summary',
|
|
829
|
+
'width'
|
|
830
|
+
],
|
|
831
|
+
tbody: ['align', 'char', 'charoff', 'valign'],
|
|
832
|
+
td: [
|
|
833
|
+
'abbr',
|
|
834
|
+
'align',
|
|
835
|
+
'axis',
|
|
836
|
+
'bgcolor',
|
|
837
|
+
'char',
|
|
838
|
+
'charoff',
|
|
839
|
+
'colspan',
|
|
840
|
+
'headers',
|
|
841
|
+
'height',
|
|
842
|
+
'nowrap',
|
|
843
|
+
'rowspan',
|
|
844
|
+
'scope',
|
|
845
|
+
'valign',
|
|
846
|
+
'width'
|
|
847
|
+
],
|
|
848
|
+
textarea: [
|
|
849
|
+
'accesskey',
|
|
850
|
+
'autocomplete',
|
|
851
|
+
'cols',
|
|
852
|
+
'disabled',
|
|
853
|
+
'inputmode',
|
|
854
|
+
...(this._allowNamedProperties ? ['name'] : []),
|
|
855
|
+
'placeholder',
|
|
856
|
+
'readonly',
|
|
857
|
+
'required',
|
|
858
|
+
'rows',
|
|
859
|
+
'tabindex',
|
|
860
|
+
'wrap'
|
|
861
|
+
],
|
|
862
|
+
tfoot: ['align', 'char', 'charoff', 'valign'],
|
|
863
|
+
th: [
|
|
864
|
+
'abbr',
|
|
865
|
+
'align',
|
|
866
|
+
'axis',
|
|
867
|
+
'bgcolor',
|
|
868
|
+
'char',
|
|
869
|
+
'charoff',
|
|
870
|
+
'colspan',
|
|
871
|
+
'headers',
|
|
872
|
+
'height',
|
|
873
|
+
'nowrap',
|
|
874
|
+
'rowspan',
|
|
875
|
+
'scope',
|
|
876
|
+
'valign',
|
|
877
|
+
'width'
|
|
878
|
+
],
|
|
879
|
+
thead: ['align', 'char', 'charoff', 'valign'],
|
|
880
|
+
tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'],
|
|
881
|
+
track: ['default', 'kind', 'label', 'srclang'],
|
|
882
|
+
ul: ['compact', 'type'],
|
|
883
|
+
video: [
|
|
884
|
+
'autoplay',
|
|
885
|
+
'controls',
|
|
886
|
+
'height',
|
|
887
|
+
'loop',
|
|
888
|
+
'mediagroup',
|
|
889
|
+
'muted',
|
|
890
|
+
'poster',
|
|
891
|
+
'preload',
|
|
892
|
+
'src',
|
|
893
|
+
'width'
|
|
894
|
+
]
|
|
895
|
+
},
|
|
896
|
+
// Inline CSS styles that HTML tags may have (and their allowed values)
|
|
897
|
+
allowedStyles: {
|
|
898
|
+
// To simplify the data, all styles are allowed on all tags that allow the style attribute
|
|
899
|
+
'*': {
|
|
900
|
+
'backface-visibility': [CssProp.BACKFACE_VISIBILITY],
|
|
901
|
+
background: [CssProp.BACKGROUND],
|
|
902
|
+
'background-attachment': [CssProp.BACKGROUND_ATTACHMENT],
|
|
903
|
+
'background-clip': [CssProp.BACKGROUND_CLIP],
|
|
904
|
+
'background-color': [CssProp.BACKGROUND_COLOR],
|
|
905
|
+
'background-image': [CssProp.BACKGROUND_IMAGE],
|
|
906
|
+
'background-origin': [CssProp.BACKGROUND_ORIGIN],
|
|
907
|
+
'background-position': [CssProp.BACKGROUND_POSITION],
|
|
908
|
+
'background-repeat': [CssProp.BACKGROUND_REPEAT],
|
|
909
|
+
'background-size': [CssProp.BACKGROUND_SIZE],
|
|
910
|
+
border: [CssProp.BORDER],
|
|
911
|
+
'border-bottom': [CssProp.BORDER_BOTTOM],
|
|
912
|
+
'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR],
|
|
913
|
+
'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS],
|
|
914
|
+
'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS],
|
|
915
|
+
'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE],
|
|
916
|
+
'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH],
|
|
917
|
+
'border-collapse': [CssProp.BORDER_COLLAPSE],
|
|
918
|
+
'border-color': [CssProp.BORDER_COLOR],
|
|
919
|
+
'border-left': [CssProp.BORDER_LEFT],
|
|
920
|
+
'border-left-color': [CssProp.BORDER_LEFT_COLOR],
|
|
921
|
+
'border-left-style': [CssProp.BORDER_LEFT_STYLE],
|
|
922
|
+
'border-left-width': [CssProp.BORDER_LEFT_WIDTH],
|
|
923
|
+
'border-radius': [CssProp.BORDER_RADIUS],
|
|
924
|
+
'border-right': [CssProp.BORDER_RIGHT],
|
|
925
|
+
'border-right-color': [CssProp.BORDER_RIGHT_COLOR],
|
|
926
|
+
'border-right-style': [CssProp.BORDER_RIGHT_STYLE],
|
|
927
|
+
'border-right-width': [CssProp.BORDER_RIGHT_WIDTH],
|
|
928
|
+
'border-spacing': [CssProp.BORDER_SPACING],
|
|
929
|
+
'border-style': [CssProp.BORDER_STYLE],
|
|
930
|
+
'border-top': [CssProp.BORDER_TOP],
|
|
931
|
+
'border-top-color': [CssProp.BORDER_TOP_COLOR],
|
|
932
|
+
'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS],
|
|
933
|
+
'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS],
|
|
934
|
+
'border-top-style': [CssProp.BORDER_TOP_STYLE],
|
|
935
|
+
'border-top-width': [CssProp.BORDER_TOP_WIDTH],
|
|
936
|
+
'border-width': [CssProp.BORDER_WIDTH],
|
|
937
|
+
bottom: [CssProp.BOTTOM],
|
|
938
|
+
box: [CssProp.BOX],
|
|
939
|
+
'box-shadow': [CssProp.BOX_SHADOW],
|
|
940
|
+
'box-sizing': [CssProp.BOX_SIZING],
|
|
941
|
+
'caption-side': [CssProp.CAPTION_SIDE],
|
|
942
|
+
clear: [CssProp.CLEAR],
|
|
943
|
+
clip: [CssProp.CLIP],
|
|
944
|
+
color: [CssProp.COLOR],
|
|
945
|
+
cursor: [CssProp.CURSOR],
|
|
946
|
+
direction: [CssProp.DIRECTION],
|
|
947
|
+
display: [CssProp.DISPLAY],
|
|
948
|
+
'display-inside': [CssProp.DISPLAY_INSIDE],
|
|
949
|
+
'display-outside': [CssProp.DISPLAY_OUTSIDE],
|
|
950
|
+
elevation: [CssProp.ELEVATION],
|
|
951
|
+
'empty-cells': [CssProp.EMPTY_CELLS],
|
|
952
|
+
float: [CssProp.FLOAT],
|
|
953
|
+
font: [CssProp.FONT],
|
|
954
|
+
'font-family': [CssProp.FONT_FAMILY],
|
|
955
|
+
'font-size': [CssProp.FONT_SIZE],
|
|
956
|
+
'font-stretch': [CssProp.FONT_STRETCH],
|
|
957
|
+
'font-style': [CssProp.FONT_STYLE],
|
|
958
|
+
'font-variant': [CssProp.FONT_VARIANT],
|
|
959
|
+
'font-weight': [CssProp.FONT_WEIGHT],
|
|
960
|
+
height: [CssProp.HEIGHT],
|
|
961
|
+
left: [CssProp.LEFT],
|
|
962
|
+
'letter-spacing': [CssProp.LETTER_SPACING],
|
|
963
|
+
'line-height': [CssProp.LINE_HEIGHT],
|
|
964
|
+
'list-style': [CssProp.LIST_STYLE],
|
|
965
|
+
'list-style-image': [CssProp.LIST_STYLE_IMAGE],
|
|
966
|
+
'list-style-position': [CssProp.LIST_STYLE_POSITION],
|
|
967
|
+
'list-style-type': [CssProp.LIST_STYLE_TYPE],
|
|
968
|
+
margin: [CssProp.MARGIN],
|
|
969
|
+
'margin-bottom': [CssProp.MARGIN_BOTTOM],
|
|
970
|
+
'margin-left': [CssProp.MARGIN_LEFT],
|
|
971
|
+
'margin-right': [CssProp.MARGIN_RIGHT],
|
|
972
|
+
'margin-top': [CssProp.MARGIN_TOP],
|
|
973
|
+
'max-height': [CssProp.MAX_HEIGHT],
|
|
974
|
+
'max-width': [CssProp.MAX_WIDTH],
|
|
975
|
+
'min-height': [CssProp.MIN_HEIGHT],
|
|
976
|
+
'min-width': [CssProp.MIN_WIDTH],
|
|
977
|
+
opacity: [CssProp.OPACITY],
|
|
978
|
+
outline: [CssProp.OUTLINE],
|
|
979
|
+
'outline-color': [CssProp.OUTLINE_COLOR],
|
|
980
|
+
'outline-style': [CssProp.OUTLINE_STYLE],
|
|
981
|
+
'outline-width': [CssProp.OUTLINE_WIDTH],
|
|
982
|
+
overflow: [CssProp.OVERFLOW],
|
|
983
|
+
'overflow-wrap': [CssProp.OVERFLOW_WRAP],
|
|
984
|
+
'overflow-x': [CssProp.OVERFLOW_X],
|
|
985
|
+
'overflow-y': [CssProp.OVERFLOW_Y],
|
|
986
|
+
padding: [CssProp.PADDING],
|
|
987
|
+
'padding-bottom': [CssProp.PADDING_BOTTOM],
|
|
988
|
+
'padding-left': [CssProp.PADDING_LEFT],
|
|
989
|
+
'padding-right': [CssProp.PADDING_RIGHT],
|
|
990
|
+
'padding-top': [CssProp.PADDING_TOP],
|
|
991
|
+
'page-break-after': [CssProp.PAGE_BREAK_AFTER],
|
|
992
|
+
'page-break-before': [CssProp.PAGE_BREAK_BEFORE],
|
|
993
|
+
'page-break-inside': [CssProp.PAGE_BREAK_INSIDE],
|
|
994
|
+
'pause-after': [CssProp.PAUSE_AFTER],
|
|
995
|
+
perspective: [CssProp.PERSPECTIVE],
|
|
996
|
+
pitch: [CssProp.PITCH],
|
|
997
|
+
'pitch-range': [CssProp.PITCH_RANGE],
|
|
998
|
+
position: [CssProp.POSITION],
|
|
999
|
+
quotes: [CssProp.QUOTES],
|
|
1000
|
+
resize: [CssProp.RESIZE],
|
|
1001
|
+
richness: [CssProp.RICHNESS],
|
|
1002
|
+
right: [CssProp.RIGHT],
|
|
1003
|
+
speak: [CssProp.SPEAK],
|
|
1004
|
+
'speak-header': [CssProp.SPEAK_HEADER],
|
|
1005
|
+
'speak-numeral': [CssProp.SPEAK_NUMERAL],
|
|
1006
|
+
'speak-punctuation': [CssProp.SPEAK_PUNCTUATION],
|
|
1007
|
+
'speech-rate': [CssProp.SPEECH_RATE],
|
|
1008
|
+
stress: [CssProp.STRESS],
|
|
1009
|
+
'table-layout': [CssProp.TABLE_LAYOUT],
|
|
1010
|
+
'text-align': [CssProp.TEXT_ALIGN],
|
|
1011
|
+
'text-decoration': [CssProp.TEXT_DECORATION],
|
|
1012
|
+
'text-indent': [CssProp.TEXT_INDENT],
|
|
1013
|
+
'text-overflow': [CssProp.TEXT_OVERFLOW],
|
|
1014
|
+
'text-shadow': [CssProp.TEXT_SHADOW],
|
|
1015
|
+
'text-transform': [CssProp.TEXT_TRANSFORM],
|
|
1016
|
+
'text-wrap': [CssProp.TEXT_WRAP],
|
|
1017
|
+
top: [CssProp.TOP],
|
|
1018
|
+
'unicode-bidi': [CssProp.UNICODE_BIDI],
|
|
1019
|
+
'vertical-align': [CssProp.VERTICAL_ALIGN],
|
|
1020
|
+
visibility: [CssProp.VISIBILITY],
|
|
1021
|
+
volume: [CssProp.VOLUME],
|
|
1022
|
+
'white-space': [CssProp.WHITE_SPACE],
|
|
1023
|
+
width: [CssProp.WIDTH],
|
|
1024
|
+
'word-break': [CssProp.WORD_BREAK],
|
|
1025
|
+
'word-spacing': [CssProp.WORD_SPACING],
|
|
1026
|
+
'word-wrap': [CssProp.WORD_WRAP],
|
|
1027
|
+
'z-index': [CssProp.Z_INDEX],
|
|
1028
|
+
zoom: [CssProp.ZOOM],
|
|
1029
|
+
// Flexbox and Grid properties
|
|
1030
|
+
'align-content': [CssProp.ALIGN_CONTENT],
|
|
1031
|
+
'align-items': [CssProp.ALIGN_ITEMS],
|
|
1032
|
+
'align-self': [CssProp.ALIGN_SELF],
|
|
1033
|
+
flex: [CssProp.FLEX],
|
|
1034
|
+
'flex-basis': [CssProp.FLEX_BASIS],
|
|
1035
|
+
'flex-direction': [CssProp.FLEX_DIRECTION],
|
|
1036
|
+
'flex-grow': [CssProp.FLEX_GROW],
|
|
1037
|
+
'flex-shrink': [CssProp.FLEX_SHRINK],
|
|
1038
|
+
'flex-wrap': [CssProp.FLEX_WRAP],
|
|
1039
|
+
grid: [CssProp.GRID],
|
|
1040
|
+
'grid-area': [CssProp.GRID_AREA],
|
|
1041
|
+
'grid-auto-columns': [CssProp.GRID_AUTO_COLUMNS],
|
|
1042
|
+
'grid-auto-flow': [CssProp.GRID_AUTO_FLOW],
|
|
1043
|
+
'grid-auto-rows': [CssProp.GRID_AUTO_ROWS],
|
|
1044
|
+
'grid-column': [CssProp.GRID_COLUMN],
|
|
1045
|
+
'grid-column-end': [CssProp.GRID_COLUMN_END],
|
|
1046
|
+
'grid-column-gap': [CssProp.GRID_COLUMN_GAP],
|
|
1047
|
+
'grid-column-start': [CssProp.GRID_COLUMN_START],
|
|
1048
|
+
'grid-gap': [CssProp.GRID_GAP],
|
|
1049
|
+
'grid-row': [CssProp.GRID_ROW],
|
|
1050
|
+
'grid-row-end': [CssProp.GRID_ROW_END],
|
|
1051
|
+
'grid-row-gap': [CssProp.GRID_ROW_GAP],
|
|
1052
|
+
'grid-row-start': [CssProp.GRID_ROW_START],
|
|
1053
|
+
'grid-template': [CssProp.GRID_TEMPLATE],
|
|
1054
|
+
'grid-template-areas': [CssProp.GRID_TEMPLATE_AREAS],
|
|
1055
|
+
'grid-template-columns': [CssProp.GRID_TEMPLATE_COLUMNS],
|
|
1056
|
+
'grid-template-rows': [CssProp.GRID_TEMPLATE_ROWS],
|
|
1057
|
+
gap: [CssProp.GAP],
|
|
1058
|
+
'row-gap': [CssProp.ROW_GAP],
|
|
1059
|
+
'column-gap': [CssProp.COLUMN_GAP],
|
|
1060
|
+
'justify-content': [CssProp.JUSTIFY_CONTENT],
|
|
1061
|
+
'justify-items': [CssProp.JUSTIFY_ITEMS],
|
|
1062
|
+
'justify-self': [CssProp.JUSTIFY_SELF],
|
|
1063
|
+
order: [CssProp.ORDER],
|
|
1064
|
+
'place-content': [CssProp.PLACE_CONTENT],
|
|
1065
|
+
'place-items': [CssProp.PLACE_ITEMS],
|
|
1066
|
+
'place-self': [CssProp.PLACE_SELF]
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
transformTags: {
|
|
1070
|
+
// Set the "rel" attribute for <a> tags to "nofollow".
|
|
1071
|
+
a: sanitize.simpleTransform('a', { rel: 'nofollow' }),
|
|
1072
|
+
// Set the "disabled" attribute for <input> tags.
|
|
1073
|
+
input: sanitize.simpleTransform('input', { disabled: 'disabled' }),
|
|
1074
|
+
// Replace "id" attribute by "data-jupyter-id" if "id" is not allowed.
|
|
1075
|
+
...(this._allowNamedProperties
|
|
1076
|
+
? {}
|
|
1077
|
+
: {
|
|
1078
|
+
'*': function (tagName, attribs) {
|
|
1079
|
+
if (attribs.id !== undefined) {
|
|
1080
|
+
attribs['data-jupyter-id'] = attribs.id;
|
|
1081
|
+
delete attribs.id;
|
|
1082
|
+
}
|
|
1083
|
+
return {
|
|
1084
|
+
tagName,
|
|
1085
|
+
attribs: {
|
|
1086
|
+
...attribs
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
})
|
|
1091
|
+
},
|
|
1092
|
+
allowedSchemes: schemesToAllow,
|
|
1093
|
+
allowedSchemesByTag: {
|
|
1094
|
+
// Allow 'attachment:' img src (used for markdown cell attachments).
|
|
1095
|
+
img: [...schemesToAllow, 'attachment']
|
|
1096
|
+
},
|
|
1097
|
+
// Override of the default option, so we can skip 'src' attribute validation.
|
|
1098
|
+
// 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data.
|
|
1099
|
+
// Since embedded data is no longer deemed to be a threat, validation can be skipped.
|
|
1100
|
+
// See https://github.com/jupyterlab/jupyterlab/issues/5183
|
|
1101
|
+
allowedSchemesAppliedToAttributes: ['href', 'cite']
|
|
1102
|
+
};
|
|
1103
|
+
};
|
|
1081
1104
|
this._options = this._generateOptions();
|
|
1082
1105
|
}
|
|
1083
1106
|
/**
|
|
@@ -1098,14 +1121,23 @@ export class Sanitizer {
|
|
|
1098
1121
|
getAutolink() {
|
|
1099
1122
|
return this._autolink;
|
|
1100
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* @returns Whether to allow name and id attributes.
|
|
1126
|
+
*/
|
|
1127
|
+
get allowNamedProperties() {
|
|
1128
|
+
return this._allowNamedProperties;
|
|
1129
|
+
}
|
|
1101
1130
|
/**
|
|
1102
1131
|
* Set the allowed schemes
|
|
1103
1132
|
*
|
|
1104
|
-
* @param scheme Allowed schemes
|
|
1133
|
+
* @param scheme Allowed schemes.
|
|
1134
|
+
* Automatically regenerates sanitizer options to apply the change.
|
|
1135
|
+
* Note: the schemes merge into the current config and does not get overwritten.
|
|
1105
1136
|
*/
|
|
1106
1137
|
setAllowedSchemes(scheme) {
|
|
1107
1138
|
// Force copy of `scheme`
|
|
1108
|
-
this.
|
|
1139
|
+
this._customAllowedSchemes = [...scheme];
|
|
1140
|
+
this._options = this._generateOptions();
|
|
1109
1141
|
}
|
|
1110
1142
|
/**
|
|
1111
1143
|
* Set the URL replacement boolean.
|