-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Prevents blocks sanitizing for undo plugin #1280
Comments
Hi @sos-productions At the moment for Paragraph Tool (or any other) you can override it's
Or fork a tool and change The right way to overcome this issue in general — add ability to pass
Disabling sanitize at all because only one plugin is unsafe. |
Hi @gohabereg, I need to take a snapshot of the blocks for a history step whatever the content, at the beginiing it is done with undo.initialize call , later is done with .save() in registerChange() inside the Undo plugin. so I need to disable sanitize temporarely to avoid crunching the tags to be able to go back on previous state on undo.undo() or undo.redo() smootthly. Now my init of the Undo plugin is quite simple: ` /**
This problem occurs everytime a need to export throughout the editor.save() process whatever the tool. This is thus also the case for load ans save blocks to a .js local file by example. block.save() is not affected by this sanitizing issue as there is no sanitize on the block content. So I thought a loop from first to editor.blocks.getBlocksCount() with block.save() would have to solved this. Unfortunately ModificationsObserver interfers and perturbates creating extra step in undo stack so I finished by asking you, to add simply this this disableSanatize feature avoiding extra sanitize stuff I don't need at all as it is an internal process of the plugin Undo. |
Could you clarify please does state of your block on undo/redo history change differ from state you get when you save editors content? If yes, it is not the right way to manage state. If some content is stripped because of sanitize you just need to configure it properly. If you want to disable sanitize at all you still able to do that thru configuration for each plugin. My points are
|
@gohabereg, what is the deal here, security? If that is is really so, correct me if I am wrong saying it is too late to filter data on output with makeOutput. Whatever, this thing has to be verified and filtered by server itself because if configuration of sanitize is hacked ` ``
`` |
My main complaint is you can achieve your goal using current API. We also sanitize HTML input when it comes from pasting, so filtering on output is just another layer. Agree, we can also filter content on render and insertion. For sure, it doesn't guarantee 100% defence from XSS or other input-based attacks — you need a server side input validation and output escaping for that. Nevertheless it doesn't mean we shouldn't filter input on client, does it? Having not too easy way to disable validation, we have foolproof which is good to have anyway I guess. |
The patch applies again not on input but output here with save()...really the flag addition is a big compromise between complicated things, extra configuration for nothing , ie karma making things complicated. You don't want to add the patch considering it can be achieved in an other but complicated way refusing to admit it does not affect security at all. I will not fight with you, I just end saying your solution is not a good compromise on processing cost on client side, js is aleady slow if we could have avoided to overload it would have been nicer for the user. |
+1 This feature is useful for saving DRAFT data not only editorjs-undo. May be related to: https://www.w3.org/WAI/WCAG21/Understanding/on-input.html |
@hata6502 In the case we have to build the filter rules to reproduce no filtering from any data, we have to collect first all the tags from the data.blocks and accept them BEFORE editor instantiate as the data is bunkered into webpack modules closures making no more accessible for security. We have to do each time we want to save() when data changes. ^^'. I provide this facility with tool-configurator plugin so I can tell you how a pain it is to load and handle promise to make it work. |
I don't know how to desactivate sanitizing
I described the problem kommitters/editorjs-undo#16
Any idea welcome. Thanks
The text was updated successfully, but these errors were encountered: