Skip to content
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

There should be a way to verify subresource integrity #30

Open
krassowski opened this issue Jan 8, 2022 · 1 comment
Open

There should be a way to verify subresource integrity #30

krassowski opened this issue Jan 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@krassowski
Copy link
Member

Problem

It is not possible to verify SRI integrity of assets served by CDN. There was a previous discussion on it in #1.

Proposed Solution

allowCDN setting should accept only-trusted-packages value; if set to such value it only imports with a defined integrity hash should be allowed; those values could be stored as:

{
   "trustedCDNPackages": {
        "bqplot@0.5.32/lib/index.min.js": "sha384-3PzjY/W0RzwwNNzUX7xM9Yg0AMgf7lNIV9vccrG++xQd7ZniA8z26dhjQa84Whdh"
   }
}

we could be showing a window with the package code and automatically add SRI to the trustedCDNPackages if user confirms that this is ok.

I attempted to do this for requirejs in 8aa1628 and reverted in 4cf596b because it did not work reliably.

A lot of code can be reused from the above commits, but we probably should give up on requirejs altogether and use SystemJS which supports semi-unofficial-standard integrity maps (in the proposed format), see #1 (comment).

Additional context

I previously suggested that we could manually check integrity for ESM.sh (in #1 (comment)); this is doable but computing hashes is not trivial and requires https secure context in modern browsers or a new dependency; SystemJS already takes care of it so its another argument for going that route.

@krassowski krassowski added the enhancement New feature or request label Jan 8, 2022
@krassowski krassowski changed the title There should be a way to verify sub resource integrity There should be a way to verify subresource integrity Jan 8, 2022
@krassowski
Copy link
Member Author

krassowski commented Jan 9, 2022

I think that my previous attempt failed because at one point the require.js setup stopped working on my branch (fixed in fbc5b39). It should be possible to revive this effort once #28 is merge (i really should stop expanding on the change set there).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant