fix(security): support SRI integrity verification for dashboard plugin scripts#19389
Closed
memosr wants to merge 1 commit into
Closed
fix(security): support SRI integrity verification for dashboard plugin scripts#19389memosr wants to merge 1 commit into
memosr wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The dashboard plugin loader (
web/src/plugins/usePlugins.ts) injectsplugin JS bundles as
<script>tags in the main dashboard origin withno integrity verification:
There is no:
integrityattribute (no Subresource Integrity)A plugin script that runs in the main origin has full access to:
/api/...route — including session data,command approvals, credentials
window.__HERMES_*globalsIf a plugin bundle is silently substituted (compromised plugin server,
MITM, malicious update), the loader will execute it with full origin
privileges and no warning.
Fix
Added opt-in support for the Subresource Integrity (SRI)
standard. Plugin manifests can now declare an
integrityhash:When the manifest declares an
integrityfield, the loader setsscript.integrityandscript.crossOrigin = "anonymous":The browser then verifies the bundle's hash before executing — if the
file has been tampered with, the script is rejected and never runs.
Why opt-in?
Making integrity mandatory would break every existing plugin that
doesn't ship a hash. Opt-in lets plugin authors adopt it incrementally
while leaving room for stricter enforcement (e.g. a future config flag
that requires
integrityfor all plugins) once the ecosystem catches up.A more comprehensive fix is iframe sandboxing, which would require
a plugin SDK redesign (postMessage API, no direct DOM access). That
refactor is out of scope for this PR — this fix is a low-risk
defense-in-depth improvement that ships immediately.
Type of Change
Checklist
PluginManifestinterface updated with optionalintegrityfieldintegrity