Mark links with a password as "sneaky"
This commit is contained in:

committed by
Scott Nonnenberg

parent
bf6487c5b9
commit
a5fde38c98
@@ -117,7 +117,7 @@ function isLinkSneaky(href) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Any links which contain auth are considered sneaky
|
// Any links which contain auth are considered sneaky
|
||||||
if (url.username) {
|
if (url.username || url.password) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -148,6 +148,8 @@ describe('Link previews', () => {
|
|||||||
describe('auth', () => {
|
describe('auth', () => {
|
||||||
it('returns true for hrefs with auth (or pretend auth)', () => {
|
it('returns true for hrefs with auth (or pretend auth)', () => {
|
||||||
assert.isTrue(isLinkSneaky('https://user:pass@example.com'));
|
assert.isTrue(isLinkSneaky('https://user:pass@example.com'));
|
||||||
|
assert.isTrue(isLinkSneaky('https://user:@example.com'));
|
||||||
|
assert.isTrue(isLinkSneaky('https://:pass@example.com'));
|
||||||
assert.isTrue(
|
assert.isTrue(
|
||||||
isLinkSneaky('http://whatever.com&login=someuser@77777777')
|
isLinkSneaky('http://whatever.com&login=someuser@77777777')
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user