File tree Expand file tree Collapse file tree 2 files changed +0
-38
lines changed Expand file tree Collapse file tree 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 {
913913 textOrHtml = textOrHtml . replace ( / < / g, '<' ) . replace ( / > / g, '>' ) ;
914914 }
915915
916- textOrHtml = this . stripUnsafeCharacters ( textOrHtml ) ;
917-
918916 let matches = this . parse ( textOrHtml ) ,
919917 newHtml : string [ ] = [ ] ,
920918 lastIndex = 0 ;
@@ -1022,16 +1020,6 @@ export default class Autolinker {
10221020
10231021 return tagBuilder ;
10241022 }
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- }
10351023}
10361024
10371025export interface AutolinkerConfig {
Original file line number Diff line number Diff line change @@ -1265,30 +1265,4 @@ describe('Autolinker Url Matching -', () => {
12651265 ) ;
12661266 } ) ;
12671267 } ) ;
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- } ) ;
12941268} ) ;
You can’t perform that action at this time.
0 commit comments