Closed (fixed)
Project:
FillPDF
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Jan 2013 at 10:34 UTC
Updated:
22 Jan 2014 at 22:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
wizonesolutionsThanks for reporting this. If you submit a patch that doesn't introduce security issues, I will consider it. Documentation: http://drupal.org/patch/create
I am also downgrading this to normal because:
I will still try to reply quickly if you come back with a patch.
Comment #2
Halim_61 commentedThe code could be there for a long time but it can't be used with pdf files which contains umlauts in pdf-fieldnames. The attachments demonstrates it.
Filtering special html chars in userinput is important because of security reasons but in this case xfdf.inc you replace eg.: & chars with amp. pdftk can't file in the formdata because of changed Fieldname.
The fieldnames were read from pdf file. It's not a user input which must be parsed.
Please have a look to attached files.
The patch would be removing htmlspecialchars in xfdf.inc completely.
Comment #3
Halim_61 commentedComment #4
Halim_61 commentedHere is my proposed patch.
It works as follows:
- defines two array with german umlauts and the htmltags like ò etc
- checks for correct encoding utf-8
- replaces specialchars with correct utf-8 encoded umlauts
- Last it uses htmlspecialchar function like before!
Thx a lot for your work on fillpdf!
Comment #5
wizonesolutionsThanks for the patch. I think that, as you said, we should just avoid
htmlspecialchars(). I don't want to fix things only for a specific language.The risk here will be that people with the ability to upload PDFs might be able to do something with the field names, although it's rather unlikely. Therefore, the patch should make the
Administer Fill PDFpermission display the security warning, just so people will know of the remote risk.If I have time, I will look into this, but again, patches speed things up :)
Comment #6
liam morlandHere is a patch which rewrites create_xfdf() to use DOMDocument. This should guarantee well-formed XML and does not make use of htmlspecialchars().
Comment #7
wizonesolutionsThanks a lot Liam. I know someone who needs this and pointed them here. It should get some testing soon.
This one looks like it'll be 7.x-1.x-dev specifically, but I should cross-port it to PDF Forms API when I restore pdftk functionality there.
Comment #8
cphilli12 commentedI am not sure if this was intended to be applied then it will just work..... I have an issue That is affecting my PDF reports, I am seeing
"instead of".I applied the patch, and ran the FIll PDF, and it still displayed
"instead of"....Was this supposed to work for " (quotes) ?
[Heine - Added code tags around HTML entities]
Comment #9
liam morlandThings should work the same before and after this patch. This is a more robust way of generating XML. In some more rare cases, characters might be escaped differently.
I don't understand what the problem is that you are observing. Are you trying to say that you are seeing " in your output?
Comment #10
cphilli12 commentedYes I am seeing " in my ouput...
Comment #11
wizonesolutionsComment #12
liam morlandIn my testing with the latest 7.x-1.x-dev, both with and without this patch, I can fill PDF forms with both single and double quotes from Webform without any problems.
I think we need to open another issue for the problem of seeing "
"" in output.Is there anything holding up commit of this patch?
Comment #13
liam morlandhttp://drupalcode.org/project/fillpdf.git/commitdiff/e3c456f