Mark links with a password as "sneaky"

This commit is contained in:
Evan Hahn 2021-04-28 15:19:32 -05:00 committed by Scott Nonnenberg
parent bf6487c5b9
commit a5fde38c98
2 changed files with 3 additions and 1 deletions

View File

@ -117,7 +117,7 @@ function isLinkSneaky(href) {
}
// Any links which contain auth are considered sneaky
if (url.username) {
if (url.username || url.password) {
return true;
}

View File

@ -148,6 +148,8 @@ describe('Link previews', () => {
describe('auth', () => {
it('returns true for hrefs with auth (or pretend auth)', () => {
assert.isTrue(isLinkSneaky('https://user:pass@example.com'));
assert.isTrue(isLinkSneaky('https://user:@example.com'));
assert.isTrue(isLinkSneaky('https://:pass@example.com'));
assert.isTrue(
isLinkSneaky('http://whatever.com&login=someuser@77777777')
);