redmine_ckeditor icon indicating copy to clipboard operation
redmine_ckeditor copied to clipboard

Upgrading Paste from word

Open dtr5 opened this issue 6 years ago • 3 comments

After upgrading to the latest version of CKeditor (as per README.MD) and replacing the inbuilt Paste from word plugin with an updated version, I was able to copy and paste images directly from Word. But they were not showing in the wiki view; a tag without src parameter was being inserted (CKeditor inserts the images in base64 encoding).

After a bit of hacking, I found that the offending part is

redmine_ckeditor/wiki_formatting/formatter.rb::29
      text = ActionView::Base.white_list_sanitizer.sanitize(text,
        :tags => RedmineCkeditor.allowed_tags,
        :attributes => RedmineCkeditor.allowed_attributes
      )

Commenting this line makes the images visible (the src tag contains the base64 information). Of course, I understand that this makes my redmine vulnerable to attacks, as the html tags are not being sanitized anymore.

I think that the correct solution is adding "data" as a trusted protocol for the sanitizer (see https://stackoverflow.com/questions/24723434/how-to-enable-embedded-image-in-rails-sanitize) but, having never worked with Ruby before, I was unable to make this work.

Hope you have enough information to making correctly solving this problem as painless as possible.

dtr5 avatar May 15 '18 16:05 dtr5

Any news on this issue? I tried to add data to the ckeditor.yml but it didn't help.

smap9 avatar Jan 28 '19 14:01 smap9

@a-ono any news about this issue? Or can you help me to config a workaround?

smap9 avatar Feb 18 '19 08:02 smap9

It is working now. Who can read, has a clear advantage :-) I had to copy the config to the right path cp plugins/redmine_ckeditor/config/ckeditor.yml.example config/ckeditor.yml.

Afterwards I added data to the allowedProtocols configuration

smap9 avatar Feb 18 '19 10:02 smap9