Skip to content

Commit 2e1f211

Browse files
committed
Revert "Merge pull request #386 from ziflow/master"
This reverts commit 8119d5c, reversing changes made to b0c15d6.
1 parent e518a70 commit 2e1f211

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

src/autolinker.ts

-12
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,6 @@ export default class Autolinker {
913913
textOrHtml = textOrHtml.replace(/</g, '&lt;').replace(/>/g, '&gt;');
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

10371025
export interface AutolinkerConfig {

tests/autolinker-url.spec.ts

-26
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)