File tree 2 files changed +0
-38
lines changed
2 files changed +0
-38
lines changed Original file line number Diff line number Diff line change @@ -913,8 +913,6 @@ export default class Autolinker {
913
913
textOrHtml = textOrHtml . replace ( / < / g, '<' ) . replace ( / > / g, '>' ) ;
914
914
}
915
915
916
- textOrHtml = this . stripUnsafeCharacters ( textOrHtml ) ;
917
-
918
916
let matches = this . parse ( textOrHtml ) ,
919
917
newHtml : string [ ] = [ ] ,
920
918
lastIndex = 0 ;
@@ -1022,16 +1020,6 @@ export default class Autolinker {
1022
1020
1023
1021
return tagBuilder ;
1024
1022
}
1025
-
1026
- /**
1027
- * Strips characters considered as unsafe
1028
- * SNYK-AUTOLINKER-2438289
1029
- * @param text
1030
- * @private
1031
- */
1032
- private stripUnsafeCharacters ( text : string ) {
1033
- return text . replace ( / [ \u202a - \u202e \u200e - \u200f ] / g, '' ) ;
1034
- }
1035
1023
}
1036
1024
1037
1025
export interface AutolinkerConfig {
Original file line number Diff line number Diff line change @@ -1265,30 +1265,4 @@ describe('Autolinker Url Matching -', () => {
1265
1265
) ;
1266
1266
} ) ;
1267
1267
} ) ;
1268
-
1269
- describe ( 'unicode exploits' , ( ) => {
1270
- it ( 'should strip out character direction override unicodes which could split links into two (https://github.com/gregjacobs/Autolinker.js/issues/377)' , ( ) => {
1271
- expect ( autolinker . link ( 'foo.combar.com' ) ) . toBe (
1272
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1273
- ) ;
1274
- expect ( autolinker . link ( 'foo.com\u202Ebar.com' ) ) . toBe (
1275
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1276
- ) ;
1277
- expect ( autolinker . link ( 'foo.com\u202abar.com' ) ) . toBe (
1278
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1279
- ) ;
1280
- expect ( autolinker . link ( 'foo.com\u202bbar.com' ) ) . toBe (
1281
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1282
- ) ;
1283
- expect ( autolinker . link ( 'foo.com\u202cbar.com' ) ) . toBe (
1284
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1285
- ) ;
1286
- expect ( autolinker . link ( 'foo.com\u202dbar.com' ) ) . toBe (
1287
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1288
- ) ;
1289
- expect ( autolinker . link ( 'foo.com\u202ebar.com' ) ) . toBe (
1290
- '<a href="http://foo.combar.com">foo.combar.com</a>'
1291
- ) ;
1292
- } ) ;
1293
- } ) ;
1294
1268
} ) ;
You can’t perform that action at this time.
0 commit comments