-
-
Notifications
You must be signed in to change notification settings - Fork 778
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
ER: resolve CodeQL alerts 36 and 37 based on analysis from #5297 #5926
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Hi @freaky4wrld, thank you for taking up this issue! Hfla appreciates you :) Do let fellow developers know about your:- You're awesome! P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :) |
Availability: Evenings |
Hey there @roslynwythe , just want to discuss some points with you about my observations : -
The only thing left is your further discussion with Bonnie. I hope the observations are helpful enough for you. DM me for further discussions, always glad to help you. |
@freaky4wrld Since babel.js is a compiler/transpiler for JavaScript, an alternative to invoking it in the browser would be to run it in the build process as described in https://medium.com/@codingstorytime/set-up-a-build-environment-using-babel-and-webpack-172110681b1. So I'm wondering if we should write an issue to investigate the pros and cons of that approach. If we do write an issue to resolve the alerts using the "integrity" attribute, do we need to specify a value for the hash? |
@roslynwythe I think writing an issue to investigate the pros and cons would be better. |
@freaky4wrld please proceed to write a new issue to investigate the pros and cons of moving babel to the build. While you are writing the issue, apply the Draft label to it, and self-assign it. When it is ready for approval, remove the Once the new issue is created, please create a comment in this ER, referencing the issue number. Typically, once an issue is created, the associated ER would be closed, but in this case, this ER will remain open until the "investigation" issue is complete and we decide how to proceed. We will move the ER to the "Ice Box" during that time and we unassign you from it, but if you wish to take it up again once the "investigation" issue is complete, indicate that in a comment and we will give you first chance to assign it. |
|
@freaky4wrld I thought this comment was saying that But maybe a discussion on slack or zoom decided babel is still needed. What about just committing the babel.js file into the website repo and point to that file? It'd be another dependency to be updated on some schedule. I'm just pointing out an alternative to:
|
Thank you @fyliu for raising a viable and much simpler alternative to moving the babel into the build process. Moving babel into the build process would have the advantage that the dependabot would notify regarding version updates, but that solution would require a good deal of effort and complexity that doesn't seem worth it, given that the CodeQL alert have been resolved using the sri attribute.
|
@roslynwythe yes we should close the ER |
Emergent Requirement - Problem
CodeQL raised alerts regarding the script
babel.js
which is loaded from the cloudflare CDN. A code fix was recommended but before implementing we need to ensure that the babel.js script is still required and should still be served from a CDN. . Even if Babel is required, there may be a more efficient means of applying it, prior to the browser.Details
Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments. With most modern browsers have already implemented nearly all features of es6, the requirement for Babel is reduced greatly, but Babel does perform other functions including transforming syntax, Code mods and polyfills.
CodeQL alerts:
https://github.com/hackforla/website/security/code-scanning/36
https://github.com/hackforla/website/security/code-scanning/37
The alerts were raised in
_layouts/default-markdown.html
and_layouts/default.html
. It is not clear if_layouts/default-markdown.html
is in current use.Issue you discovered this emergent requirement in
Inclusion of functionality from an untrusted source
#5297Date discovered
Did you have to do something temporarily
Who was involved
@freaky4wrld @roslynwythe
What happens if this is not addressed
The security concern is that if an attacker were to gain control of the CDN, a corrupted script could be loaded into any Hack for LA webpage
Resources
Inclusion of functionality from an untrusted source
#5297Recommended Action Items
_layouts/default-markdown.html
still in use? If not, create an issue to remove it, and dismiss alert 36Potential solutions [draft]
Code change
add the attributes:
to the relevant script tags
Testing:
console
and look for any issues with the script or its integrityfallback mechanism
with<noscript> tag
indicating a failure in the script loadingdeliberately tampering the babel script or introduce an error in the script URL to simulate a tampered or failed script
and observing its behaviour.The text was updated successfully, but these errors were encountered: