Automatically-internal login URLs: add GitHub 2FA pages (PR #1140)

I have 2FA (FIDO/Yubikey) set up for GitHub, and the session login was redirecting to my browser. Looking at the redirect path, it appears that github.com/session is involved, so adding that to internal login details.

With this patched, I'm able to login in to https://octobox.io/ in nativefier.
This commit is contained in:
Evan Anderson 2021-03-17 04:39:24 -07:00 committed by GitHub
parent 50ce2f81dd
commit 4298d2da06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -64,6 +64,9 @@ const testLoginPages = [
'https://github.co.uk/login',
'https://github.com/login',
'https://github.de/login',
// GitHub 2FA flow with FIDO token
'https://github.com/session',
'https://github.com/sessions/two-factor/webauth',
'https://accounts.google.co.uk',
'https://accounts.google.com',
'https://accounts.google.de',
@ -89,6 +92,21 @@ test.each(testLoginPages)(
},
);
// Ensure that we don't over-match service pages
const testNonLoginPages = [
'https://www.amazon.com/Node-Cookbook-techniques-server-side-development-ebook',
'https://github.com/nativefier/nativefier',
'https://github.com/org/nativefier',
'https://twitter.com/marcoroth_/status/1325938620906287104',
];
test.each(testNonLoginPages)(
'%s page should not be internal',
(url: string) => {
expect(linkIsInternal(internalUrl, url, undefined)).toEqual(false);
},
);
const smallCounterTitle = 'Inbox (11) - nobody@example.com - Gmail';
const largeCounterTitle = 'Inbox (8,756) - nobody@example.com - Gmail';
const noCounterTitle = 'Inbox - nobody@example.com - Gmail';

View File

@ -22,7 +22,7 @@ function isInternalLoginPage(url: string): boolean {
const internalLoginPagesArray = [
'amazon\\.[a-zA-Z\\.]*/[a-zA-Z\\/]*signin', // Amazon
`facebook\\.[a-zA-Z\\.]*\\/login`, // Facebook
'github\\.[a-zA-Z\\.]*\\/login', // GitHub
'github\\.[a-zA-Z\\.]*\\/(?:login|session)', // GitHub
'accounts\\.google\\.[a-zA-Z\\.]*', // Google
'linkedin\\.[a-zA-Z\\.]*/uas/login', // LinkedIn
'login\\.live\\.[a-zA-Z\\.]*', // Microsoft