You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Sixty One (Jira)" <ji...@apache.org> on 2024/12/06 08:39:00 UTC

[jira] [Created] (OFBIZ-13190) PDF-Check: Just delete unsafe PDF files

Sixty One created OFBIZ-13190:
---------------------------------

             Summary: PDF-Check: Just delete unsafe PDF files
                 Key: OFBIZ-13190
                 URL: https://issues.apache.org/jira/browse/OFBIZ-13190
             Project: OFBiz
          Issue Type: Improvement
          Components: framework/security
    Affects Versions: Upcoming Branch
            Reporter: Sixty One
         Attachments: do-not-delete-valid-pdf-file.diff

This refers to the implementation within SecuredUpload.java:

Currently, all PDF files are deleted after the check within isValidPdfFile - regardless of whether they have been successfully validated or not. As with other format validations, we should keep the valid files directly so that they can be processed afterwards. The mentioned behavior was introduced by [https://github.com/apache/ofbiz-framework/commit/c3653d51ae88e6a0069bb750d8d36c7fa0e4e1a7]:
{code:java}
file = new File(fileName);
file.delete(); {code}
At first I planned to change the implementation to just delete the PDF file within isValidPdfFile if the PDF's safeState is false. Then I found out that the file deletion already happens withn isValidFile (deleteBadFile) - hence there is no need to delete the invalid file within the PDF check itself.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)