ritwickdey / vscode-live-server-plus-plus

VsCode Live Server++ : It's Truly Live 😊 (BETA) -- [NOT RELEASED YET]
MIT License
515 stars 318 forks source link

[SRI Issue] - Missing integrity of inline injected script. #58

Open AlessandroAlmadaLeal opened 1 year ago

AlessandroAlmadaLeal commented 1 year ago

Hello everyone,

I'm working on a personal project and came across the SRI (Subresource Integrity) check subject.

After several minutes of configuring and testing my project, I discovered the issue shown in the image below:

image

As you can see, the script injected by Live Server does not have an integrity key configured.

If the developer chooses not to use SRI or CSP (Content Security Policy), Live Server will continue to work normally. However, when we configure CPS and SRI, this script injected by the tool will not be executed due to being considered as 'unsafe-inline,' which CPS identifies as a Cross-Site Scripting (XSS) weak point.

A possible solution could be to change the existing "" tag to "<script integrity=''sha256-vvt4KWwuNr51XfE5m+hzeNEGhiOfZzG97ccfqGsPwvE=' crossorigin="self">..." this might fix the issue. However, be aware that making changes to the script may have implications for this integrity key in the future (each code update the hash need to be calculated and updated too).

Alternatively, a setting option could be created to automatically concatenate the integrity key to the script tag. As developer, we could calculate these keys ourselves and insert them into the script tag by a setting "text box" field. That's more easy and takes less effort of maintenence, once that this setting only get usual on this CPS configuring scenario.

Thank you for the attention,

Best regards,

A. Leal.

MajliTech commented 1 year ago

No one cares, see #57

AlessandroAlmadaLeal commented 1 year ago

Thanks @MajliTech.