From c971865cfdff71a63e6f856bfddfc300e8ced379 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 15 Jan 2025 13:29:12 +0000 Subject: [PATCH 01/18] updated /.well-known/assetlinks.json parsing --- .github/workflows/wpt-test.yml | 7 +++++++ dist/well-known.js | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wpt-test.yml b/.github/workflows/wpt-test.yml index c2bb5960..ef603da5 100644 --- a/.github/workflows/wpt-test.yml +++ b/.github/workflows/wpt-test.yml @@ -35,6 +35,13 @@ jobs: WPT_API_KEY: ${{ secrets.HA_API_KEY }} PR_BODY: ${{ github.event.pull_request.body }} + - name: Run WebPageTest for on.com + run: node tests/wpt.js + env: + WPT_SERVER: "on.com" + WPT_API_KEY: ${{ secrets.HA_API_KEY }} + PR_BODY: ${{ github.event.pull_request.body }} + - name: Add comment to PR uses: mshick/add-pr-comment@v2 if: always() diff --git a/dist/well-known.js b/dist/well-known.js index 64802a92..9bc4a155 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -81,7 +81,23 @@ function parseResponseWithRedirects(url, parser) { return Promise.all([ // ecommerce - parseResponse('/.well-known/assetlinks.json'), + parseResponse('/.well-known/assetlinks.json', r => { + return r.json().then(data => { + let hasDeepLinking = false; + let hasCredentialSharing = false; + data.forEach(statement => { + if (statement.relation === 'delegate_permission/common.handle_all_urls') { + hasDeepLinking = true; + } else if (statement.relation === 'delegate_permission/common.get_login_creds') { + hasCredentialSharing = true; + } + }); + return { + deep_linking: hasDeepLinking, + credential_sharing: hasCredentialSharing + }; + }); + }), parseResponse('/.well-known/apple-app-site-association'), // privacy sandbox parseResponse('/.well-known/related-website-set.json'), //Related Website Set From 395e4f1c4b83904ca42925b29f0c2dcc44405706 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Thu, 16 Jan 2025 13:19:19 +0000 Subject: [PATCH 02/18] updated /.well-known/assetlinks.json parsing and test URLs --- .github/pull_request_template.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3aa58daf..80e2a210 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,4 +7,7 @@ Description of the changes... **Test websites**: -- https://example.com/ +- https://www.on.com/ +- https://www.amazon.co.jp/ +- https://www.libero.it/ + From 6ee4f15c36cc0409af0464e520c3b89c4f69aa80 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Thu, 16 Jan 2025 17:17:09 +0000 Subject: [PATCH 03/18] Update .markdown-lint.yml --- .github/linters/.markdown-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml index 41806ebe..780e06f4 100644 --- a/.github/linters/.markdown-lint.yml +++ b/.github/linters/.markdown-lint.yml @@ -17,6 +17,7 @@ ignores: - ".github/**/*.md" + - ".github/*.md" ############### # Rules by id # From c8ca4d2a63b5241655e92a72def1face476f4bdd Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Thu, 16 Jan 2025 18:52:17 +0000 Subject: [PATCH 04/18] Update pull_request_template.md --- .github/pull_request_template.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 80e2a210..29789daa 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,7 +7,4 @@ Description of the changes... **Test websites**: -- https://www.on.com/ -- https://www.amazon.co.jp/ -- https://www.libero.it/ - +- https://www.example.com/ From a9919fa5c8556aa2394b43c9b0aad7fd1cdc755e Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Thu, 16 Jan 2025 18:52:37 +0000 Subject: [PATCH 05/18] Update pull_request_template.md --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 29789daa..3aa58daf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,4 +7,4 @@ Description of the changes... **Test websites**: -- https://www.example.com/ +- https://example.com/ From 13e6e91d18d1c4d3fd69ff808cae5cc5a86d6d78 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Thu, 16 Jan 2025 18:53:28 +0000 Subject: [PATCH 06/18] Update wpt-test.yml --- .github/workflows/wpt-test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/wpt-test.yml b/.github/workflows/wpt-test.yml index ef603da5..c2bb5960 100644 --- a/.github/workflows/wpt-test.yml +++ b/.github/workflows/wpt-test.yml @@ -35,13 +35,6 @@ jobs: WPT_API_KEY: ${{ secrets.HA_API_KEY }} PR_BODY: ${{ github.event.pull_request.body }} - - name: Run WebPageTest for on.com - run: node tests/wpt.js - env: - WPT_SERVER: "on.com" - WPT_API_KEY: ${{ secrets.HA_API_KEY }} - PR_BODY: ${{ github.event.pull_request.body }} - - name: Add comment to PR uses: mshick/add-pr-comment@v2 if: always() From 3819a915d89607058e31beb03e94a8757936fa06 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Tue, 4 Feb 2025 16:18:46 +0000 Subject: [PATCH 07/18] FedCM, passkey, Related Origin Requests --- .github/pull_request_template.md | 4 +++- dist/well-known.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3aa58daf..53ef882c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,4 +7,6 @@ Description of the changes... **Test websites**: -- https://example.com/ +- https://www.ebay.com/ +- https://www.amazon.co.uk/ +- https://tv.apple.com/ diff --git a/dist/well-known.js b/dist/well-known.js index 9bc4a155..798d9991 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -115,6 +115,34 @@ return Promise.all([ return data; }); }), + // FedCM + parseResponse('/.well-known/web-identity', r => { + return r.json().then(data => { + let result = { + provider_urls: data.provider_urls || [], + accounts_endpoint: data.accounts_endpoint || null, + login_url: data.login_url || null + }; + return result; + }); + }), + // Passkey + parseResponse('/.well-known/passkey-endpoints', r => { + return r.json().then(data => { + let result = { + enroll: data.enroll || null, + manage: data.manage || null + }; + return result; + }); + }), + // Related Origin Requests + parseResponse('/.well-known/webauthn', r => { + return r.json().then(data => { + let origins = data.origins ||[]; + return { origins }; + }); + }), // security parseResponse('/robots.txt', r => { return r.text().then(text => { From ee01cd61e6113de7a56d7a6caf605efff00e2176 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Tue, 4 Feb 2025 18:50:03 +0000 Subject: [PATCH 08/18] Update dist/well-known.js --- dist/well-known.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/well-known.js b/dist/well-known.js index 798d9991..54f570a7 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -116,7 +116,7 @@ return Promise.all([ }); }), // FedCM - parseResponse('/.well-known/web-identity', r => { + parseResponse('/.well-known/web-identity', r => { return r.json().then(data => { let result = { provider_urls: data.provider_urls || [], From 41f633ee4493c03d7236da4759d515de2aef55ae Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Tue, 4 Feb 2025 18:50:25 +0000 Subject: [PATCH 09/18] Update .github/pull_request_template.md --- .github/pull_request_template.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 53ef882c..5612f707 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,6 +7,3 @@ Description of the changes... **Test websites**: -- https://www.ebay.com/ -- https://www.amazon.co.uk/ -- https://tv.apple.com/ From 934c9bf20d872e4d748ca1378811e3cdc32b3008 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Tue, 4 Feb 2025 18:51:02 +0000 Subject: [PATCH 10/18] Restore example.com --- .github/pull_request_template.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5612f707..3aa58daf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,3 +7,4 @@ Description of the changes... **Test websites**: +- https://example.com/ From f222677bea4cd867550198d866cc5dd6ba2bcc26 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 5 Feb 2025 11:43:25 +0000 Subject: [PATCH 11/18] Update assetlink.json relation to check array to correctly reflect the setup. --- .github/pull_request_template.md | 1 + dist/well-known.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3aa58daf..fdcd9430 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,4 +7,5 @@ Description of the changes... **Test websites**: + - https://example.com/ diff --git a/dist/well-known.js b/dist/well-known.js index 54f570a7..d42cb387 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -86,9 +86,10 @@ return Promise.all([ let hasDeepLinking = false; let hasCredentialSharing = false; data.forEach(statement => { - if (statement.relation === 'delegate_permission/common.handle_all_urls') { + if (statement.relation.includes('delegate_permission/common.handle_all_urls')) { hasDeepLinking = true; - } else if (statement.relation === 'delegate_permission/common.get_login_creds') { + } + if (statement.relation.includes('delegate_permission/common.get_login_creds')) { hasCredentialSharing = true; } }); From ce62a098bc9a156bd18487f4ba66324f46649cfa Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 5 Feb 2025 12:55:04 +0000 Subject: [PATCH 12/18] Restore test website example.com --- .github/pull_request_template.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fdcd9430..8882ed5b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,5 +7,4 @@ Description of the changes... **Test websites**: - -- https://example.com/ +- https://example.com/ \ No newline at end of file From d6c5dbe7b20ba01656cccc98af98f96659e14628 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 5 Feb 2025 13:18:08 +0000 Subject: [PATCH 13/18] correct lint error for .github/pull_request_template.md --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8882ed5b..3aa58daf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,4 +7,4 @@ Description of the changes... **Test websites**: -- https://example.com/ \ No newline at end of file +- https://example.com/ From 8227d3b2c09f1bbb1219ace5b96f797bf432c365 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 5 Feb 2025 15:10:35 +0000 Subject: [PATCH 14/18] Update /.well-known/web-identity error handling --- dist/well-known.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dist/well-known.js b/dist/well-known.js index d42cb387..4442b6d6 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -119,12 +119,18 @@ return Promise.all([ // FedCM parseResponse('/.well-known/web-identity', r => { return r.json().then(data => { - let result = { - provider_urls: data.provider_urls || [], - accounts_endpoint: data.accounts_endpoint || null, - login_url: data.login_url || null - }; - return result; + let result = { + provider_urls: Array.isArray(data.provider_urls) && data.provider_urls.length > 0 ? data.provider_urls : [], + accounts_endpoint: data.accounts_endpoint || null, + login_url: data.login_url || null, + valid: Array.isArray(data.provider_urls) && data.provider_urls.length > 0 + }; + return result; + }).catch(error => { + return { + error: `Failed to parse JSON: ${error.message}`, + valid: false + }; }); }), // Passkey From 22329b9a9417d5798059f6b2cd2be41a51f734a9 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 5 Feb 2025 15:15:00 +0000 Subject: [PATCH 15/18] Update /.well-known/passkey-endpoints error handling --- dist/well-known.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dist/well-known.js b/dist/well-known.js index 4442b6d6..57b04046 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -136,11 +136,17 @@ return Promise.all([ // Passkey parseResponse('/.well-known/passkey-endpoints', r => { return r.json().then(data => { - let result = { - enroll: data.enroll || null, - manage: data.manage || null - }; - return result; + let result = { + enroll: data.enroll || null, + manage: data.manage || null, + valid: typeof data.enroll === 'string' && typeof data.manage === 'string' + }; + return result; + }).catch(error => { + return { + error: `Failed to parse JSON: ${error.message}`, + valid: false + }; }); }), // Related Origin Requests From b158dc87f73c35c36976585e2c56086def42e91c Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Wed, 5 Feb 2025 15:22:54 +0000 Subject: [PATCH 16/18] Update /.well-known/webauthn error handling --- dist/well-known.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/well-known.js b/dist/well-known.js index 57b04046..c285d117 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -152,8 +152,16 @@ return Promise.all([ // Related Origin Requests parseResponse('/.well-known/webauthn', r => { return r.json().then(data => { - let origins = data.origins ||[]; - return { origins }; + let result = { + origins: Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : [], + valid: Array.isArray(data.origins) && data.origins.length > 0 + }; + return result; + }).catch(error => { + return { + error: `Failed to parse JSON: ${error.message}`, + valid: false + }; }); }), // security From 113ec429bfc2adb0de316b3cdcb01182dcc94218 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Thu, 6 Feb 2025 10:25:31 +0000 Subject: [PATCH 17/18] Removed redundant properties --- dist/well-known.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/dist/well-known.js b/dist/well-known.js index c285d117..c2256a81 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -122,14 +122,12 @@ return Promise.all([ let result = { provider_urls: Array.isArray(data.provider_urls) && data.provider_urls.length > 0 ? data.provider_urls : [], accounts_endpoint: data.accounts_endpoint || null, - login_url: data.login_url || null, - valid: Array.isArray(data.provider_urls) && data.provider_urls.length > 0 + login_url: data.login_url || null }; return result; }).catch(error => { return { - error: `Failed to parse JSON: ${error.message}`, - valid: false + error: `Failed to parse JSON: ${error.message}` }; }); }), @@ -138,14 +136,12 @@ return Promise.all([ return r.json().then(data => { let result = { enroll: data.enroll || null, - manage: data.manage || null, - valid: typeof data.enroll === 'string' && typeof data.manage === 'string' + manage: data.manage || null }; return result; }).catch(error => { return { - error: `Failed to parse JSON: ${error.message}`, - valid: false + error: `Failed to parse JSON: ${error.message}` }; }); }), @@ -153,14 +149,12 @@ return Promise.all([ parseResponse('/.well-known/webauthn', r => { return r.json().then(data => { let result = { - origins: Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : [], - valid: Array.isArray(data.origins) && data.origins.length > 0 + origins: Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : [] }; return result; }).catch(error => { return { - error: `Failed to parse JSON: ${error.message}`, - valid: false + error: `Failed to parse JSON: ${error.message}` }; }); }), From 43ed0e586c151cb5410c2948f862ba2fe0973f56 Mon Sep 17 00:00:00 2001 From: Yu Tsuno Date: Fri, 7 Feb 2025 10:52:07 +0000 Subject: [PATCH 18/18] Update responding with default results. --- dist/well-known.js | 51 +++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/dist/well-known.js b/dist/well-known.js index c2256a81..a3114ca8 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -118,44 +118,53 @@ return Promise.all([ }), // FedCM parseResponse('/.well-known/web-identity', r => { - return r.json().then(data => { + return r.text().then(text => { let result = { - provider_urls: Array.isArray(data.provider_urls) && data.provider_urls.length > 0 ? data.provider_urls : [], - accounts_endpoint: data.accounts_endpoint || null, - login_url: data.login_url || null + provider_urls: [], + accounts_endpoint: null, + login_url: null }; + try { + let data = JSON.parse(text); + result.provider_urls = Array.isArray(data.provider_urls) && data.provider_urls.length > 0 ? data.provider_urls : []; + result.accounts_endpoint = data.accounts_endpoint || null; + result.login_url = data.login_url || null; + } catch (e) { + // Failed to parse JSON + } return result; - }).catch(error => { - return { - error: `Failed to parse JSON: ${error.message}` - }; }); }), // Passkey parseResponse('/.well-known/passkey-endpoints', r => { - return r.json().then(data => { + return r.text().then(text => { let result = { - enroll: data.enroll || null, - manage: data.manage || null + enroll: null, + manage: null }; + try { + let data = JSON.parse(text); + result.enroll = data.enroll || null; + result.manage = data.manage || null; + } catch (e) { + // Failed to parse JSON + } return result; - }).catch(error => { - return { - error: `Failed to parse JSON: ${error.message}` - }; }); }), // Related Origin Requests parseResponse('/.well-known/webauthn', r => { - return r.json().then(data => { + return r.text().then(text => { let result = { - origins: Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : [] + origins: [] }; + try { + let data = JSON.parse(text); + result.origins = Array.isArray(data.origins) && data.origins.length > 0 ? data.origins : []; + } catch (e) { + // Failed to parse JSON + } return result; - }).catch(error => { - return { - error: `Failed to parse JSON: ${error.message}` - }; }); }), // security