In my web application I need to upload file to the server. This file is JasperReport template and its extension is .jrxml. So I want to make that server accepts files only with this extension. To upload file I’m using ServletFileUpload. To verify file extension I’m only verifying if fileName contains “.jrxml”. But I don’t feel that this method is secure enough. Is there any possibility to make upload more safe ?
Share
You can use XML Validator to verify the uploaded file against the Jasper Report XSD. If you wanted to go the additional step you could also compile the uploaded template using the JasperCompile though that might be overkill for your app and a drag on performance.