rootaccessxvv-bbmarker 0.0.1-security → 1.0.2

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.

Potentially problematic release.


This version of rootaccessxvv-bbmarker might be problematic. Click here for more details.

Files changed (39) hide show
  1. package/README.md +13 -3
  2. package/index.js +1 -0
  3. package/package.json +17 -6
  4. package/sim/node_modules/.bin/xss +16 -0
  5. package/sim/node_modules/.bin/xss.cmd +17 -0
  6. package/sim/node_modules/.bin/xss.ps1 +28 -0
  7. package/sim/node_modules/.package-lock.json +36 -0
  8. package/sim/node_modules/commander/CHANGELOG.md +419 -0
  9. package/sim/node_modules/commander/LICENSE +22 -0
  10. package/sim/node_modules/commander/Readme.md +428 -0
  11. package/sim/node_modules/commander/index.js +1224 -0
  12. package/sim/node_modules/commander/package.json +38 -0
  13. package/sim/node_modules/commander/typings/index.d.ts +310 -0
  14. package/sim/node_modules/cssfilter/LICENSE +22 -0
  15. package/sim/node_modules/cssfilter/README.md +86 -0
  16. package/sim/node_modules/cssfilter/lib/css.js +110 -0
  17. package/sim/node_modules/cssfilter/lib/default.js +398 -0
  18. package/sim/node_modules/cssfilter/lib/index.js +32 -0
  19. package/sim/node_modules/cssfilter/lib/parser.js +74 -0
  20. package/sim/node_modules/cssfilter/lib/util.js +35 -0
  21. package/sim/node_modules/cssfilter/package.json +49 -0
  22. package/sim/node_modules/xss/CHANGELOG.md +24 -0
  23. package/sim/node_modules/xss/LICENSE +23 -0
  24. package/sim/node_modules/xss/README.md +505 -0
  25. package/sim/node_modules/xss/README.zh.md +491 -0
  26. package/sim/node_modules/xss/bin/xss +67 -0
  27. package/sim/node_modules/xss/dist/test.html +15 -0
  28. package/sim/node_modules/xss/dist/xss.js +1665 -0
  29. package/sim/node_modules/xss/dist/xss.min.js +1 -0
  30. package/sim/node_modules/xss/lib/cli.js +45 -0
  31. package/sim/node_modules/xss/lib/default.js +459 -0
  32. package/sim/node_modules/xss/lib/index.js +44 -0
  33. package/sim/node_modules/xss/lib/parser.js +247 -0
  34. package/sim/node_modules/xss/lib/util.js +34 -0
  35. package/sim/node_modules/xss/lib/xss.js +211 -0
  36. package/sim/node_modules/xss/package.json +63 -0
  37. package/sim/node_modules/xss/typings/xss.d.ts +202 -0
  38. package/sim/package-lock.json +44 -0
  39. package/sim/package.json +16 -0
@@ -0,0 +1,398 @@
1
+ /**
2
+ * cssfilter
3
+ *
4
+ * @author 老雷<leizongmin@gmail.com>
5
+ */
6
+
7
+ function getDefaultWhiteList () {
8
+ // 白名单值说明:
9
+ // true: 允许该属性
10
+ // Function: function (val) { } 返回true表示允许该属性,其他值均表示不允许
11
+ // RegExp: regexp.test(val) 返回true表示允许该属性,其他值均表示不允许
12
+ // 除上面列出的值外均表示不允许
13
+ var whiteList = {};
14
+
15
+ whiteList['align-content'] = false; // default: auto
16
+ whiteList['align-items'] = false; // default: auto
17
+ whiteList['align-self'] = false; // default: auto
18
+ whiteList['alignment-adjust'] = false; // default: auto
19
+ whiteList['alignment-baseline'] = false; // default: baseline
20
+ whiteList['all'] = false; // default: depending on individual properties
21
+ whiteList['anchor-point'] = false; // default: none
22
+ whiteList['animation'] = false; // default: depending on individual properties
23
+ whiteList['animation-delay'] = false; // default: 0
24
+ whiteList['animation-direction'] = false; // default: normal
25
+ whiteList['animation-duration'] = false; // default: 0
26
+ whiteList['animation-fill-mode'] = false; // default: none
27
+ whiteList['animation-iteration-count'] = false; // default: 1
28
+ whiteList['animation-name'] = false; // default: none
29
+ whiteList['animation-play-state'] = false; // default: running
30
+ whiteList['animation-timing-function'] = false; // default: ease
31
+ whiteList['azimuth'] = false; // default: center
32
+ whiteList['backface-visibility'] = false; // default: visible
33
+ whiteList['background'] = true; // default: depending on individual properties
34
+ whiteList['background-attachment'] = true; // default: scroll
35
+ whiteList['background-clip'] = true; // default: border-box
36
+ whiteList['background-color'] = true; // default: transparent
37
+ whiteList['background-image'] = true; // default: none
38
+ whiteList['background-origin'] = true; // default: padding-box
39
+ whiteList['background-position'] = true; // default: 0% 0%
40
+ whiteList['background-repeat'] = true; // default: repeat
41
+ whiteList['background-size'] = true; // default: auto
42
+ whiteList['baseline-shift'] = false; // default: baseline
43
+ whiteList['binding'] = false; // default: none
44
+ whiteList['bleed'] = false; // default: 6pt
45
+ whiteList['bookmark-label'] = false; // default: content()
46
+ whiteList['bookmark-level'] = false; // default: none
47
+ whiteList['bookmark-state'] = false; // default: open
48
+ whiteList['border'] = true; // default: depending on individual properties
49
+ whiteList['border-bottom'] = true; // default: depending on individual properties
50
+ whiteList['border-bottom-color'] = true; // default: current color
51
+ whiteList['border-bottom-left-radius'] = true; // default: 0
52
+ whiteList['border-bottom-right-radius'] = true; // default: 0
53
+ whiteList['border-bottom-style'] = true; // default: none
54
+ whiteList['border-bottom-width'] = true; // default: medium
55
+ whiteList['border-collapse'] = true; // default: separate
56
+ whiteList['border-color'] = true; // default: depending on individual properties
57
+ whiteList['border-image'] = true; // default: none
58
+ whiteList['border-image-outset'] = true; // default: 0
59
+ whiteList['border-image-repeat'] = true; // default: stretch
60
+ whiteList['border-image-slice'] = true; // default: 100%
61
+ whiteList['border-image-source'] = true; // default: none
62
+ whiteList['border-image-width'] = true; // default: 1
63
+ whiteList['border-left'] = true; // default: depending on individual properties
64
+ whiteList['border-left-color'] = true; // default: current color
65
+ whiteList['border-left-style'] = true; // default: none
66
+ whiteList['border-left-width'] = true; // default: medium
67
+ whiteList['border-radius'] = true; // default: 0
68
+ whiteList['border-right'] = true; // default: depending on individual properties
69
+ whiteList['border-right-color'] = true; // default: current color
70
+ whiteList['border-right-style'] = true; // default: none
71
+ whiteList['border-right-width'] = true; // default: medium
72
+ whiteList['border-spacing'] = true; // default: 0
73
+ whiteList['border-style'] = true; // default: depending on individual properties
74
+ whiteList['border-top'] = true; // default: depending on individual properties
75
+ whiteList['border-top-color'] = true; // default: current color
76
+ whiteList['border-top-left-radius'] = true; // default: 0
77
+ whiteList['border-top-right-radius'] = true; // default: 0
78
+ whiteList['border-top-style'] = true; // default: none
79
+ whiteList['border-top-width'] = true; // default: medium
80
+ whiteList['border-width'] = true; // default: depending on individual properties
81
+ whiteList['bottom'] = false; // default: auto
82
+ whiteList['box-decoration-break'] = true; // default: slice
83
+ whiteList['box-shadow'] = true; // default: none
84
+ whiteList['box-sizing'] = true; // default: content-box
85
+ whiteList['box-snap'] = true; // default: none
86
+ whiteList['box-suppress'] = true; // default: show
87
+ whiteList['break-after'] = true; // default: auto
88
+ whiteList['break-before'] = true; // default: auto
89
+ whiteList['break-inside'] = true; // default: auto
90
+ whiteList['caption-side'] = false; // default: top
91
+ whiteList['chains'] = false; // default: none
92
+ whiteList['clear'] = true; // default: none
93
+ whiteList['clip'] = false; // default: auto
94
+ whiteList['clip-path'] = false; // default: none
95
+ whiteList['clip-rule'] = false; // default: nonzero
96
+ whiteList['color'] = true; // default: implementation dependent
97
+ whiteList['color-interpolation-filters'] = true; // default: auto
98
+ whiteList['column-count'] = false; // default: auto
99
+ whiteList['column-fill'] = false; // default: balance
100
+ whiteList['column-gap'] = false; // default: normal
101
+ whiteList['column-rule'] = false; // default: depending on individual properties
102
+ whiteList['column-rule-color'] = false; // default: current color
103
+ whiteList['column-rule-style'] = false; // default: medium
104
+ whiteList['column-rule-width'] = false; // default: medium
105
+ whiteList['column-span'] = false; // default: none
106
+ whiteList['column-width'] = false; // default: auto
107
+ whiteList['columns'] = false; // default: depending on individual properties
108
+ whiteList['contain'] = false; // default: none
109
+ whiteList['content'] = false; // default: normal
110
+ whiteList['counter-increment'] = false; // default: none
111
+ whiteList['counter-reset'] = false; // default: none
112
+ whiteList['counter-set'] = false; // default: none
113
+ whiteList['crop'] = false; // default: auto
114
+ whiteList['cue'] = false; // default: depending on individual properties
115
+ whiteList['cue-after'] = false; // default: none
116
+ whiteList['cue-before'] = false; // default: none
117
+ whiteList['cursor'] = false; // default: auto
118
+ whiteList['direction'] = false; // default: ltr
119
+ whiteList['display'] = true; // default: depending on individual properties
120
+ whiteList['display-inside'] = true; // default: auto
121
+ whiteList['display-list'] = true; // default: none
122
+ whiteList['display-outside'] = true; // default: inline-level
123
+ whiteList['dominant-baseline'] = false; // default: auto
124
+ whiteList['elevation'] = false; // default: level
125
+ whiteList['empty-cells'] = false; // default: show
126
+ whiteList['filter'] = false; // default: none
127
+ whiteList['flex'] = false; // default: depending on individual properties
128
+ whiteList['flex-basis'] = false; // default: auto
129
+ whiteList['flex-direction'] = false; // default: row
130
+ whiteList['flex-flow'] = false; // default: depending on individual properties
131
+ whiteList['flex-grow'] = false; // default: 0
132
+ whiteList['flex-shrink'] = false; // default: 1
133
+ whiteList['flex-wrap'] = false; // default: nowrap
134
+ whiteList['float'] = false; // default: none
135
+ whiteList['float-offset'] = false; // default: 0 0
136
+ whiteList['flood-color'] = false; // default: black
137
+ whiteList['flood-opacity'] = false; // default: 1
138
+ whiteList['flow-from'] = false; // default: none
139
+ whiteList['flow-into'] = false; // default: none
140
+ whiteList['font'] = true; // default: depending on individual properties
141
+ whiteList['font-family'] = true; // default: implementation dependent
142
+ whiteList['font-feature-settings'] = true; // default: normal
143
+ whiteList['font-kerning'] = true; // default: auto
144
+ whiteList['font-language-override'] = true; // default: normal
145
+ whiteList['font-size'] = true; // default: medium
146
+ whiteList['font-size-adjust'] = true; // default: none
147
+ whiteList['font-stretch'] = true; // default: normal
148
+ whiteList['font-style'] = true; // default: normal
149
+ whiteList['font-synthesis'] = true; // default: weight style
150
+ whiteList['font-variant'] = true; // default: normal
151
+ whiteList['font-variant-alternates'] = true; // default: normal
152
+ whiteList['font-variant-caps'] = true; // default: normal
153
+ whiteList['font-variant-east-asian'] = true; // default: normal
154
+ whiteList['font-variant-ligatures'] = true; // default: normal
155
+ whiteList['font-variant-numeric'] = true; // default: normal
156
+ whiteList['font-variant-position'] = true; // default: normal
157
+ whiteList['font-weight'] = true; // default: normal
158
+ whiteList['grid'] = false; // default: depending on individual properties
159
+ whiteList['grid-area'] = false; // default: depending on individual properties
160
+ whiteList['grid-auto-columns'] = false; // default: auto
161
+ whiteList['grid-auto-flow'] = false; // default: none
162
+ whiteList['grid-auto-rows'] = false; // default: auto
163
+ whiteList['grid-column'] = false; // default: depending on individual properties
164
+ whiteList['grid-column-end'] = false; // default: auto
165
+ whiteList['grid-column-start'] = false; // default: auto
166
+ whiteList['grid-row'] = false; // default: depending on individual properties
167
+ whiteList['grid-row-end'] = false; // default: auto
168
+ whiteList['grid-row-start'] = false; // default: auto
169
+ whiteList['grid-template'] = false; // default: depending on individual properties
170
+ whiteList['grid-template-areas'] = false; // default: none
171
+ whiteList['grid-template-columns'] = false; // default: none
172
+ whiteList['grid-template-rows'] = false; // default: none
173
+ whiteList['hanging-punctuation'] = false; // default: none
174
+ whiteList['height'] = true; // default: auto
175
+ whiteList['hyphens'] = false; // default: manual
176
+ whiteList['icon'] = false; // default: auto
177
+ whiteList['image-orientation'] = false; // default: auto
178
+ whiteList['image-resolution'] = false; // default: normal
179
+ whiteList['ime-mode'] = false; // default: auto
180
+ whiteList['initial-letters'] = false; // default: normal
181
+ whiteList['inline-box-align'] = false; // default: last
182
+ whiteList['justify-content'] = false; // default: auto
183
+ whiteList['justify-items'] = false; // default: auto
184
+ whiteList['justify-self'] = false; // default: auto
185
+ whiteList['left'] = false; // default: auto
186
+ whiteList['letter-spacing'] = true; // default: normal
187
+ whiteList['lighting-color'] = true; // default: white
188
+ whiteList['line-box-contain'] = false; // default: block inline replaced
189
+ whiteList['line-break'] = false; // default: auto
190
+ whiteList['line-grid'] = false; // default: match-parent
191
+ whiteList['line-height'] = false; // default: normal
192
+ whiteList['line-snap'] = false; // default: none
193
+ whiteList['line-stacking'] = false; // default: depending on individual properties
194
+ whiteList['line-stacking-ruby'] = false; // default: exclude-ruby
195
+ whiteList['line-stacking-shift'] = false; // default: consider-shifts
196
+ whiteList['line-stacking-strategy'] = false; // default: inline-line-height
197
+ whiteList['list-style'] = true; // default: depending on individual properties
198
+ whiteList['list-style-image'] = true; // default: none
199
+ whiteList['list-style-position'] = true; // default: outside
200
+ whiteList['list-style-type'] = true; // default: disc
201
+ whiteList['margin'] = true; // default: depending on individual properties
202
+ whiteList['margin-bottom'] = true; // default: 0
203
+ whiteList['margin-left'] = true; // default: 0
204
+ whiteList['margin-right'] = true; // default: 0
205
+ whiteList['margin-top'] = true; // default: 0
206
+ whiteList['marker-offset'] = false; // default: auto
207
+ whiteList['marker-side'] = false; // default: list-item
208
+ whiteList['marks'] = false; // default: none
209
+ whiteList['mask'] = false; // default: border-box
210
+ whiteList['mask-box'] = false; // default: see individual properties
211
+ whiteList['mask-box-outset'] = false; // default: 0
212
+ whiteList['mask-box-repeat'] = false; // default: stretch
213
+ whiteList['mask-box-slice'] = false; // default: 0 fill
214
+ whiteList['mask-box-source'] = false; // default: none
215
+ whiteList['mask-box-width'] = false; // default: auto
216
+ whiteList['mask-clip'] = false; // default: border-box
217
+ whiteList['mask-image'] = false; // default: none
218
+ whiteList['mask-origin'] = false; // default: border-box
219
+ whiteList['mask-position'] = false; // default: center
220
+ whiteList['mask-repeat'] = false; // default: no-repeat
221
+ whiteList['mask-size'] = false; // default: border-box
222
+ whiteList['mask-source-type'] = false; // default: auto
223
+ whiteList['mask-type'] = false; // default: luminance
224
+ whiteList['max-height'] = true; // default: none
225
+ whiteList['max-lines'] = false; // default: none
226
+ whiteList['max-width'] = true; // default: none
227
+ whiteList['min-height'] = true; // default: 0
228
+ whiteList['min-width'] = true; // default: 0
229
+ whiteList['move-to'] = false; // default: normal
230
+ whiteList['nav-down'] = false; // default: auto
231
+ whiteList['nav-index'] = false; // default: auto
232
+ whiteList['nav-left'] = false; // default: auto
233
+ whiteList['nav-right'] = false; // default: auto
234
+ whiteList['nav-up'] = false; // default: auto
235
+ whiteList['object-fit'] = false; // default: fill
236
+ whiteList['object-position'] = false; // default: 50% 50%
237
+ whiteList['opacity'] = false; // default: 1
238
+ whiteList['order'] = false; // default: 0
239
+ whiteList['orphans'] = false; // default: 2
240
+ whiteList['outline'] = false; // default: depending on individual properties
241
+ whiteList['outline-color'] = false; // default: invert
242
+ whiteList['outline-offset'] = false; // default: 0
243
+ whiteList['outline-style'] = false; // default: none
244
+ whiteList['outline-width'] = false; // default: medium
245
+ whiteList['overflow'] = false; // default: depending on individual properties
246
+ whiteList['overflow-wrap'] = false; // default: normal
247
+ whiteList['overflow-x'] = false; // default: visible
248
+ whiteList['overflow-y'] = false; // default: visible
249
+ whiteList['padding'] = true; // default: depending on individual properties
250
+ whiteList['padding-bottom'] = true; // default: 0
251
+ whiteList['padding-left'] = true; // default: 0
252
+ whiteList['padding-right'] = true; // default: 0
253
+ whiteList['padding-top'] = true; // default: 0
254
+ whiteList['page'] = false; // default: auto
255
+ whiteList['page-break-after'] = false; // default: auto
256
+ whiteList['page-break-before'] = false; // default: auto
257
+ whiteList['page-break-inside'] = false; // default: auto
258
+ whiteList['page-policy'] = false; // default: start
259
+ whiteList['pause'] = false; // default: implementation dependent
260
+ whiteList['pause-after'] = false; // default: implementation dependent
261
+ whiteList['pause-before'] = false; // default: implementation dependent
262
+ whiteList['perspective'] = false; // default: none
263
+ whiteList['perspective-origin'] = false; // default: 50% 50%
264
+ whiteList['pitch'] = false; // default: medium
265
+ whiteList['pitch-range'] = false; // default: 50
266
+ whiteList['play-during'] = false; // default: auto
267
+ whiteList['position'] = false; // default: static
268
+ whiteList['presentation-level'] = false; // default: 0
269
+ whiteList['quotes'] = false; // default: text
270
+ whiteList['region-fragment'] = false; // default: auto
271
+ whiteList['resize'] = false; // default: none
272
+ whiteList['rest'] = false; // default: depending on individual properties
273
+ whiteList['rest-after'] = false; // default: none
274
+ whiteList['rest-before'] = false; // default: none
275
+ whiteList['richness'] = false; // default: 50
276
+ whiteList['right'] = false; // default: auto
277
+ whiteList['rotation'] = false; // default: 0
278
+ whiteList['rotation-point'] = false; // default: 50% 50%
279
+ whiteList['ruby-align'] = false; // default: auto
280
+ whiteList['ruby-merge'] = false; // default: separate
281
+ whiteList['ruby-position'] = false; // default: before
282
+ whiteList['shape-image-threshold'] = false; // default: 0.0
283
+ whiteList['shape-outside'] = false; // default: none
284
+ whiteList['shape-margin'] = false; // default: 0
285
+ whiteList['size'] = false; // default: auto
286
+ whiteList['speak'] = false; // default: auto
287
+ whiteList['speak-as'] = false; // default: normal
288
+ whiteList['speak-header'] = false; // default: once
289
+ whiteList['speak-numeral'] = false; // default: continuous
290
+ whiteList['speak-punctuation'] = false; // default: none
291
+ whiteList['speech-rate'] = false; // default: medium
292
+ whiteList['stress'] = false; // default: 50
293
+ whiteList['string-set'] = false; // default: none
294
+ whiteList['tab-size'] = false; // default: 8
295
+ whiteList['table-layout'] = false; // default: auto
296
+ whiteList['text-align'] = true; // default: start
297
+ whiteList['text-align-last'] = true; // default: auto
298
+ whiteList['text-combine-upright'] = true; // default: none
299
+ whiteList['text-decoration'] = true; // default: none
300
+ whiteList['text-decoration-color'] = true; // default: currentColor
301
+ whiteList['text-decoration-line'] = true; // default: none
302
+ whiteList['text-decoration-skip'] = true; // default: objects
303
+ whiteList['text-decoration-style'] = true; // default: solid
304
+ whiteList['text-emphasis'] = true; // default: depending on individual properties
305
+ whiteList['text-emphasis-color'] = true; // default: currentColor
306
+ whiteList['text-emphasis-position'] = true; // default: over right
307
+ whiteList['text-emphasis-style'] = true; // default: none
308
+ whiteList['text-height'] = true; // default: auto
309
+ whiteList['text-indent'] = true; // default: 0
310
+ whiteList['text-justify'] = true; // default: auto
311
+ whiteList['text-orientation'] = true; // default: mixed
312
+ whiteList['text-overflow'] = true; // default: clip
313
+ whiteList['text-shadow'] = true; // default: none
314
+ whiteList['text-space-collapse'] = true; // default: collapse
315
+ whiteList['text-transform'] = true; // default: none
316
+ whiteList['text-underline-position'] = true; // default: auto
317
+ whiteList['text-wrap'] = true; // default: normal
318
+ whiteList['top'] = false; // default: auto
319
+ whiteList['transform'] = false; // default: none
320
+ whiteList['transform-origin'] = false; // default: 50% 50% 0
321
+ whiteList['transform-style'] = false; // default: flat
322
+ whiteList['transition'] = false; // default: depending on individual properties
323
+ whiteList['transition-delay'] = false; // default: 0s
324
+ whiteList['transition-duration'] = false; // default: 0s
325
+ whiteList['transition-property'] = false; // default: all
326
+ whiteList['transition-timing-function'] = false; // default: ease
327
+ whiteList['unicode-bidi'] = false; // default: normal
328
+ whiteList['vertical-align'] = false; // default: baseline
329
+ whiteList['visibility'] = false; // default: visible
330
+ whiteList['voice-balance'] = false; // default: center
331
+ whiteList['voice-duration'] = false; // default: auto
332
+ whiteList['voice-family'] = false; // default: implementation dependent
333
+ whiteList['voice-pitch'] = false; // default: medium
334
+ whiteList['voice-range'] = false; // default: medium
335
+ whiteList['voice-rate'] = false; // default: normal
336
+ whiteList['voice-stress'] = false; // default: normal
337
+ whiteList['voice-volume'] = false; // default: medium
338
+ whiteList['volume'] = false; // default: medium
339
+ whiteList['white-space'] = false; // default: normal
340
+ whiteList['widows'] = false; // default: 2
341
+ whiteList['width'] = true; // default: auto
342
+ whiteList['will-change'] = false; // default: auto
343
+ whiteList['word-break'] = true; // default: normal
344
+ whiteList['word-spacing'] = true; // default: normal
345
+ whiteList['word-wrap'] = true; // default: normal
346
+ whiteList['wrap-flow'] = false; // default: auto
347
+ whiteList['wrap-through'] = false; // default: wrap
348
+ whiteList['writing-mode'] = false; // default: horizontal-tb
349
+ whiteList['z-index'] = false; // default: auto
350
+
351
+ return whiteList;
352
+ }
353
+
354
+
355
+ /**
356
+ * 匹配到白名单上的一个属性时
357
+ *
358
+ * @param {String} name
359
+ * @param {String} value
360
+ * @param {Object} options
361
+ * @return {String}
362
+ */
363
+ function onAttr (name, value, options) {
364
+ // do nothing
365
+ }
366
+
367
+ /**
368
+ * 匹配到不在白名单上的一个属性时
369
+ *
370
+ * @param {String} name
371
+ * @param {String} value
372
+ * @param {Object} options
373
+ * @return {String}
374
+ */
375
+ function onIgnoreAttr (name, value, options) {
376
+ // do nothing
377
+ }
378
+
379
+ var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;
380
+
381
+ /**
382
+ * 过滤属性值
383
+ *
384
+ * @param {String} name
385
+ * @param {String} value
386
+ * @return {String}
387
+ */
388
+ function safeAttrValue(name, value) {
389
+ if (REGEXP_URL_JAVASCRIPT.test(value)) return '';
390
+ return value;
391
+ }
392
+
393
+
394
+ exports.whiteList = getDefaultWhiteList();
395
+ exports.getDefaultWhiteList = getDefaultWhiteList;
396
+ exports.onAttr = onAttr;
397
+ exports.onIgnoreAttr = onIgnoreAttr;
398
+ exports.safeAttrValue = safeAttrValue;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * cssfilter
3
+ *
4
+ * @author 老雷<leizongmin@gmail.com>
5
+ */
6
+
7
+ var DEFAULT = require('./default');
8
+ var FilterCSS = require('./css');
9
+
10
+
11
+ /**
12
+ * XSS过滤
13
+ *
14
+ * @param {String} css 要过滤的CSS代码
15
+ * @param {Object} options 选项:whiteList, onAttr, onIgnoreAttr
16
+ * @return {String}
17
+ */
18
+ function filterCSS (html, options) {
19
+ var xss = new FilterCSS(options);
20
+ return xss.process(html);
21
+ }
22
+
23
+
24
+ // 输出
25
+ exports = module.exports = filterCSS;
26
+ exports.FilterCSS = FilterCSS;
27
+ for (var i in DEFAULT) exports[i] = DEFAULT[i];
28
+
29
+ // 在浏览器端使用
30
+ if (typeof window !== 'undefined') {
31
+ window.filterCSS = module.exports;
32
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * cssfilter
3
+ *
4
+ * @author 老雷<leizongmin@gmail.com>
5
+ */
6
+
7
+ var _ = require('./util');
8
+
9
+
10
+ /**
11
+ * 解析style
12
+ *
13
+ * @param {String} css
14
+ * @param {Function} onAttr 处理属性的函数
15
+ * 参数格式: function (sourcePosition, position, name, value, source)
16
+ * @return {String}
17
+ */
18
+ function parseStyle (css, onAttr) {
19
+ css = _.trimRight(css);
20
+ if (css[css.length - 1] !== ';') css += ';';
21
+ var cssLength = css.length;
22
+ var isParenthesisOpen = false;
23
+ var lastPos = 0;
24
+ var i = 0;
25
+ var retCSS = '';
26
+
27
+ function addNewAttr () {
28
+ // 如果没有正常的闭合圆括号,则直接忽略当前属性
29
+ if (!isParenthesisOpen) {
30
+ var source = _.trim(css.slice(lastPos, i));
31
+ var j = source.indexOf(':');
32
+ if (j !== -1) {
33
+ var name = _.trim(source.slice(0, j));
34
+ var value = _.trim(source.slice(j + 1));
35
+ // 必须有属性名称
36
+ if (name) {
37
+ var ret = onAttr(lastPos, retCSS.length, name, value, source);
38
+ if (ret) retCSS += ret + '; ';
39
+ }
40
+ }
41
+ }
42
+ lastPos = i + 1;
43
+ }
44
+
45
+ for (; i < cssLength; i++) {
46
+ var c = css[i];
47
+ if (c === '/' && css[i + 1] === '*') {
48
+ // 备注开始
49
+ var j = css.indexOf('*/', i + 2);
50
+ // 如果没有正常的备注结束,则后面的部分全部跳过
51
+ if (j === -1) break;
52
+ // 直接将当前位置调到备注结尾,并且初始化状态
53
+ i = j + 1;
54
+ lastPos = i + 1;
55
+ isParenthesisOpen = false;
56
+ } else if (c === '(') {
57
+ isParenthesisOpen = true;
58
+ } else if (c === ')') {
59
+ isParenthesisOpen = false;
60
+ } else if (c === ';') {
61
+ if (isParenthesisOpen) {
62
+ // 在圆括号里面,忽略
63
+ } else {
64
+ addNewAttr();
65
+ }
66
+ } else if (c === '\n') {
67
+ addNewAttr();
68
+ }
69
+ }
70
+
71
+ return _.trim(retCSS);
72
+ }
73
+
74
+ module.exports = parseStyle;
@@ -0,0 +1,35 @@
1
+ module.exports = {
2
+ indexOf: function (arr, item) {
3
+ var i, j;
4
+ if (Array.prototype.indexOf) {
5
+ return arr.indexOf(item);
6
+ }
7
+ for (i = 0, j = arr.length; i < j; i++) {
8
+ if (arr[i] === item) {
9
+ return i;
10
+ }
11
+ }
12
+ return -1;
13
+ },
14
+ forEach: function (arr, fn, scope) {
15
+ var i, j;
16
+ if (Array.prototype.forEach) {
17
+ return arr.forEach(fn, scope);
18
+ }
19
+ for (i = 0, j = arr.length; i < j; i++) {
20
+ fn.call(scope, arr[i], i, arr);
21
+ }
22
+ },
23
+ trim: function (str) {
24
+ if (String.prototype.trim) {
25
+ return str.trim();
26
+ }
27
+ return str.replace(/(^\s*)|(\s*$)/g, '');
28
+ },
29
+ trimRight: function (str) {
30
+ if (String.prototype.trimRight) {
31
+ return str.trimRight();
32
+ }
33
+ return str.replace(/(\s*$)/g, '');
34
+ }
35
+ };
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "cssfilter",
3
+ "version": "0.0.10",
4
+ "description": "Sanitize untrusted CSS with a configuration specified by a Whitelist. 根据白名单过滤CSS",
5
+ "main": "lib/index.js",
6
+ "files": [
7
+ "lib"
8
+ ],
9
+ "scripts": {
10
+ "test": "istanbul cover _mocha --report lcovonly -- -t 5000 -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
11
+ "build": "./build",
12
+ "prepublish": "npm run test && npm run build"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/leizongmin/js-css-filter.git"
17
+ },
18
+ "keywords": [
19
+ "sanitization",
20
+ "xss",
21
+ "sanitize",
22
+ "sanitisation",
23
+ "input",
24
+ "security",
25
+ "escape",
26
+ "encode",
27
+ "filter",
28
+ "validator",
29
+ "html",
30
+ "css",
31
+ "injection",
32
+ "whitelist"
33
+ ],
34
+ "author": "Zongmin Lei <leizongmin@gmail.com>",
35
+ "license": "MIT",
36
+ "bugs": {
37
+ "url": "https://github.com/leizongmin/js-css-filter/issues"
38
+ },
39
+ "homepage": "https://github.com/leizongmin/js-css-filter",
40
+ "devDependencies": {
41
+ "blanket": "^1.1.6",
42
+ "browserify": "^13.1.1",
43
+ "coveralls": "^2.11.14",
44
+ "istanbul": "^0.4.5",
45
+ "mocha": "^3.1.2",
46
+ "should": "^11.1.1",
47
+ "uglify-js": "^2.7.4"
48
+ }
49
+ }
@@ -0,0 +1,24 @@
1
+ # CHANGELOG
2
+
3
+ ## v1.0.10 (2021-10-08)
4
+
5
+ - [Fix: #239 stripCommentTag DoS attack](https://github.com/leizongmin/js-xss/pull/239)
6
+
7
+ ## v1.0.9 (2021-05-06)
8
+
9
+ - [Fix whitespace bypass #218](https://github.com/leizongmin/js-xss/pull/218/files) by @TomAnthony
10
+ - [Add `<summary>` to default whitelist #216](https://github.com/leizongmin/js-xss/pull/216) by @spacegaier
11
+ - [Add `<figure>` and `<figcaption>` to default whitelist](https://github.com/leizongmin/js-xss/pull/220) by @daraz999
12
+ - Add `<audio crossorigin muted>`, `<video crossorigin muted playsinline poster>` to default whitelist
13
+ - Add `<strike>` to default whitelist
14
+ - Fix: typings IWhiteList allow any tag name
15
+ - Fix: typings `onTag` options
16
+
17
+ ## v1.0.8 (2020-07-27)
18
+
19
+ - [Allow default imports in TS #200](https://github.com/leizongmin/js-xss/pull/200) by @danvk
20
+ - [Update handling of quoteStart to prevent sanitization bypass #201](https://github.com/leizongmin/js-xss/pull/201) by @TomAnthony
21
+
22
+ ## v1.0.7 (2020-06-08)
23
+
24
+ - [added support for src embedded image, ftp and relative urls](https://github.com/leizongmin/js-xss/pull/189) by @sijanec
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2012-2018 Zongmin Lei(雷宗民) <leizongmin@gmail.com>
2
+ http://ucdok.com
3
+
4
+ The MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.