Jump to content

Sanitizing PDF Files


phdphd
 Share

Recommended Posts

Hi All,

Is there a security risk with PDF files in the following registration process ?

1. A user fills in a form with values that are then regex-checked and stored into session variables.

2. The user details are sent to a table using a parameterized query.

3. The user goes through a payment process.

4. When the user has successfully paid, an invoice as a PDF file is stored on the server and also sent by mail to the user as an attachement. This PDF file is built up with some of the session variables’ values previously entered by the user.

Is there any risk that those values cause issues server side (when the file is stored) or user side (when the user opens the email or the attached PDF file) ? Does any sanitizing need to be done for values to be included into a PDF file?

Thank you!

Regards,

PhD

Link to comment
Share on other sites

One shouldn't store/save sensitive values.  Once the input values are used to authorize a user, you should use a generated token to recognize the authenticity of the user from that point on.  As for a pdf I don't believe you have to worry about that.

  • Thanks 1
Link to comment
Share on other sites

8 hours ago, requinix said:

Nicer than storing generated PDFs on your server is generating them at the time they're needed. Because, at least in the case of invoices, the data supporting its contents shouldn't ever change.

Generally, I would agree with that. However, I wonder if there would be legal reasons for keeping a copy of the invoice that was sent. Yes, another copy could be generated later and would be the same - if the code had not changed. But, if there was any type of legal action and the company needed to provide records of the invoices that were sent, I don't know if regenerating a copy would be adequate. They might have to also prove that none of the code changed that generated the invoice and if the code had changed they might have to prove what the invoice would have looked like at the time it was generated previously.

  • Thanks 1
Link to comment
Share on other sites

Hi All,

Thank you for your answers.

When the invoice is sent by mail to the user, it is also BCC'd to the webmaster. By doing this I have a copy of the invoice as it was sent, at the time it was sent. However, storing it on the server may be useful if for any reason, sending the mail fails. In this case, I just need to grab the invoice from the server and email it manually. Another advantage of storing it on the server is if I need to print a copy of the invoice. I would not need to search for it in the email system.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.