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

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

     [ https://issues.apache.org/jira/browse/OFBIZ-13190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-13190.
-----------------------------------
    Resolution: Done

I backported to 24.09 even if it's not a bug, easier later for maintenance, less conflicts.

> 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
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         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)