Mark links with a password as "sneaky"
This commit is contained in:
parent
bf6487c5b9
commit
a5fde38c98
2 changed files with 3 additions and 1 deletions
|
@ -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')
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue