-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Set specific version of Algolia docsearch, set SRI #974
Conversation
I was about to drop the SRI attributes, but then noticed that jsdelivr had some warnings: * Skipped minification because the original files appear to be already minified. * Original file: /npm/@docsearch/[email protected]/dist/umd/index.js * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files So, to heed these warnings, I decided it was best to pin to a particular version of docsearch and use the pre-minified index.js to avoid dynamic modification. Work toward Homebrew#973
The one downside to this is getting the security benefits but losing the automatic update of the docsearch library... And docsearch/js is updated ~monthly: https://www.npmjs.com/package/@docsearch/js?activeTab=versions |
At the very least, the version should be linked to the stylesheet above. We probably also want a workflow that auto-updates this, with perhaps notices pointing maintainers to test locally in the event of major version bumps. |
We could add a package.json and fail the build if the versions don't match |
Agreed. It feels like we're going to have to lean into Dependabot if we do this. Not convinced the lack of SRI is a bigger security problem than sitting on older versions indefinitely. |
Upstream docsearch project has an open request for an SRI strategy: algolia/docsearch#1561 |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I posted about a potential solution in algolia/docsearch#1561 (comment). It's extra but it'd solve the problem if falling behind docsearch versions is a bad thing. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
If the build-time SRI generation is acceptable, I can move forward with that. |
@colindean Can you detail more what this looks like? |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
See algolia/docsearch#1561 (comment), but briefly, it's this at
This would safen the resource, creating only a threat vector at site build time. This also creates a build time dependency on the NPM API and jsdelivr.net, but if these are inaccessible, the build could fall back to using the latest version URL and not specifying an SRI. |
Closing this out for now but happy to review a new PR when that approach is done. |
I was about to drop the SRI attributes, but then noticed that jsdelivr had some warnings:
So, to heed these warnings, I decided it was best to pin to a particular version of docsearch and use the pre-minified index.js to avoid dynamic modification.
Work toward #973