-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workbox PWA broken due to integrity hash mismatch #1539
Comments
@thexeos it'd help a lot if you could provide an example of such a PWA. |
@sfionov I suppose we could have issues with SRI in general since AG may also modify other responses content (i.e. A little bit better solution would be to read that attribute and do the check on our own (it can probably be planned on a later release of CL). |
https://beaconx.com (requires login before PWA can be installed) I gave this some thought and the biggest issue here is the asynchronicity of SRI hashes being sent to client and content being loaded. In case of Workbox, the SRI hashes are included in The format in which hashes are sent is, roughly (service-worker.js): // workbox code
precacheAndRoute([
{
'integrity':'sha384-BubaQZpIBydSuCKS/9CbrgmvnPmxf0V0QMIAQIYVOx+mgVM4PuMfflVIuPj8Q1kL',
'revision':'47a4e4a808ef26a32c8193a21a962d5f',
'url':'/index.html'
},
{
'integrity':'sha384-920rHB8nX4WFHKgdjjN7TboxzDRs3iIJ0JYbnjOb22fUeoONRhIG9IHvxgUfKZdz',
'revision':'87f95b08a473c41f5c7e464403eac1f3',
'url':'/manifest.json'
},
{
'integrity':'sha384-8MPmbcaDaa3PyrjdhZZia3RGxQFn7CB+6KQNIFt6oG56E28+SeOiuhotLWwKgIKq',
'revision':null,
'url':'https://static.beaconx.com/css/app.0cf1188a.css'
},
{
'integrity':'sha384-DITOVQ9GRMKDkvZwAgf3Quo/95Tqc9gTuQICo4TPSkvT+qjlK5dn6b7Hvn9/zC1g',
'revision':null,
'url':'https://static.beaconx.com/js/app.b8f62d34.js'
}
])
// more workbox code |
A quick solution for beaconx would be to add a filtering rule that disables cosmetic rules injection completely for it, something like this: We may resort to it after all, but we'd better look for a generic solution first. |
In the end, I can't see any viable generic solution. Moved my thoughts about it to a different issue: #1562 Regarding beaconx, I've added the exception rule for it to AG Base filter, the issue shouldn't be happening anymore. |
@thexeos commented on Fri Oct 29 2021
Issue Details
Description
When Workbox-based PWAs update (assuming their install was not blocked by any of the filters), the list of files to update may contain
integrity
attributes, corresponding to SRI hashes. If the hash of the received (server) response does not match the stored hash - the file download, and by extension the update process, fails.I am seeing these two lines added to the response body for
index.html
from the PWA's domain (after<meta charset=utf-8>
tag):Generally, you can tell that the request was made by the Service Worker by inspecting the Referrer header in the request, which would typically look like 'https://domain.com/service-worker.js'.
Either way, this seems to be a recent breaking change, as this specific PWA was able to update through the same mechanism for over a year. From user perspective, this is an issue with the PWA and AdGuard would be the last place they'll look when trying to troubleshoot failed "app" updates.
I can provide the domain name of the PWA, if that would make any difference.
The text was updated successfully, but these errors were encountered: