java - How to find out whether a zipped file contains executable files -


i have requirement upload files using java - spring web application.

while uploading files web application, need check type of file uploaded. per requirement need allow zipped files uploaded.

to deal security concerns, zip file should screened executable files or unwanted file types, if have list of malicious file types.

kindly suggest how can know content type of files in zip, using java.

i suggest try following:

  1. use zip file system provider access zip files using nio.2 file api: https://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
  2. walk file tree: https://docs.oracle.com/javase/tutorial/essential/io/walk.html (there methods supporting java se 8 streams).
  3. perfrom checks, eg. using files.isexecutable

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -