-
Notifications
You must be signed in to change notification settings - Fork 324
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
fix: allow configuring the XSS protection behavior #1010
fix: allow configuring the XSS protection behavior #1010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow! Thanks for the PR. this is definitely better solution than the current application.
Thanks for the contribution of code!
🎉 This PR is included in version 7.4.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adding the xss option via Background: hitherto I have initialised a timeline like this: Doing this, even when xss was set in |
Also nice to have is we should have a |
Yes, it is intended to only accept manipulating the xss protection upon instantiation. |
### What changes were proposed in this pull request? Upgrade vis timeline to 7.7.2 Have to add xss option with whitelisting to make the timeline work after the xss protection was added in vis-timeline. (Refer to visjs/vis-timeline#1010) ### Why are the changes needed? To remediate CVE-2020-28487 GHSA-9mrv-456v-pf22 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manually by running spark-shell and checking History Server UI. Timeline rendered successfully and no change in style. Even after following operation: (1 to 1000).foreach(_ => sc.parallelize(1 to 10).collect) UI loaded in 3 seconds faster than it loaded with 4.21. Closes #41613 from shrprasa/upgrade_vis. Authored-by: Shrikant Prasad <shrprasa@visa.com> Signed-off-by: Sean Owen <srowen@gmail.com>
The documentation for the xss feature does not mention that it can only be set during initialization. It should be mentioned. |
…020-28487 ### What changes were proposed in this pull request? Upgrade vis timeline to 7.7.2 Have to add xss option with whitelisting to make the timeline work after the xss protection was added in vis-timeline. (Refer to visjs/vis-timeline#1010) ### Why are the changes needed? To remediate CVE-2020-28487 GHSA-9mrv-456v-pf22 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manually by running spark-shell and checking History Server UI. Timeline rendered successfully and no change in style. Even after following operation: (1 to 1000).foreach(_ => sc.parallelize(1 to 10).collect) UI loaded in 3 seconds faster than it loaded with 4.21. Closes apache#41613 from shrprasa/upgrade_vis. Authored-by: Shrikant Prasad <shrprasa@visa.com> Signed-off-by: Sean Owen <srowen@gmail.com> (cherry picked from commit a8ea35f)
…020-28487 ### What changes were proposed in this pull request? Upgrade vis timeline to 7.7.2 Have to add xss option with whitelisting to make the timeline work after the xss protection was added in vis-timeline. (Refer to visjs/vis-timeline#1010) ### Why are the changes needed? To remediate CVE-2020-28487 GHSA-9mrv-456v-pf22 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manually by running spark-shell and checking History Server UI. Timeline rendered successfully and no change in style. Even after following operation: (1 to 1000).foreach(_ => sc.parallelize(1 to 10).collect) UI loaded in 3 seconds faster than it loaded with 4.21. Closes apache#41613 from shrprasa/upgrade_vis. Authored-by: Shrikant Prasad <shrprasa@visa.com> Signed-off-by: Sean Owen <srowen@gmail.com> (cherry picked from commit a8ea35f)
…020-28487 ### What changes were proposed in this pull request? Upgrade vis timeline to 7.7.2 Have to add xss option with whitelisting to make the timeline work after the xss protection was added in vis-timeline. (Refer to visjs/vis-timeline#1010) ### Why are the changes needed? To remediate CVE-2020-28487 GHSA-9mrv-456v-pf22 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manually by running spark-shell and checking History Server UI. Timeline rendered successfully and no change in style. Even after following operation: (1 to 1000).foreach(_ => sc.parallelize(1 to 10).collect) UI loaded in 3 seconds faster than it loaded with 4.21. Closes apache#41613 from shrprasa/upgrade_vis. Authored-by: Shrikant Prasad <shrprasa@visa.com> Signed-off-by: Sean Owen <srowen@gmail.com> (cherry picked from commit a8ea35f)
…020-28487 ### What changes were proposed in this pull request? Upgrade vis timeline to 7.7.2 Have to add xss option with whitelisting to make the timeline work after the xss protection was added in vis-timeline. (Refer to visjs/vis-timeline#1010) ### Why are the changes needed? To remediate CVE-2020-28487 GHSA-9mrv-456v-pf22 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Manually by running spark-shell and checking History Server UI. Timeline rendered successfully and no change in style. Even after following operation: (1 to 1000).foreach(_ => sc.parallelize(1 to 10).collect) UI loaded in 3 seconds faster than it loaded with 4.21. Closes apache#41613 from shrprasa/upgrade_vis. Authored-by: Shrikant Prasad <shrprasa@visa.com> Signed-off-by: Sean Owen <srowen@gmail.com> (cherry picked from commit a8ea35f)
I tried different ways on how to implement this and thought about the ideas previously discussed in the issue #846.
After some fiddling around I decided to keep things quite simple here, to get this off and rolling for everyone.
The basic concept includes the following:
Note: This still means, that the current default behavior will remain unchanged, but users will be able to gain control over it and have alternative options. See below.
To achieve things I basically did the following:
replaced the xss export in util.js with a dynamic getter using Object.defineProperty, because this allows to exchange the XSS protection algorithms behind it, while keeping that an internal detail
add configuration options to Timeline, which allow to:
a) disable XSS protection completely and
b) optionally also change the xss library's behavior using its XSS.IFilterXSSOptions
hand these configuration options to a setup function at instanciation time, to define how that particular Timeline instance will behave with regards to XSS filtering
if someone disabled the xss protection, that makes Timelien log a warning, because... the protection is in for good reason, so why should you disable it completely (other than you know what you are doing)!?
The "disabled" must be set explictly, otherwise the xss protection will remain in place.
The protection also defaults to the current state, using the xss filter with no option at all.
This solution might not be perfect, because the dynamic getter could impact performance; also this solution does not account for treating XSS differently for loading screen, item contents, groups etc.
However I think this is at least a good intermediate solution. This might also be worth shipping, because it is a relief for both: us and the people out there, as they now have the option to get control over the XSS protection.
Here's the examples I used to verify its behavior:
With Options set to:
CASE 1:
output keeps the element, but only the class attribute passes through:
CASE 2:
output keeps element and both attributes:
CASE 3:
output is esacped, because span is no valid element:
With Options set to:
The startup of Timeline produces a console warning:
You disabled XSS protection for vis-Timeline. I sure hope you know what you're doing!