Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-16395

(7.2.z) Internal Server Error (500) when using directory-listing in FileHandler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 7.2.2.CR1, 7.2.2.GA
    • 7.2.0.GA
    • Undertow
    • None
    • Hide
      1. Create a folder in welcome content and create a bad symlink in the folder
        mkdir folder
        cd folder
        ln -s xxx bad
        
      2. Start server standalone.sh
      3. Allow directory listing in file handler
        /subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=directory-listing, value=true)
        reload
        
      4. Go to the folder in welcome content
        http://127.0.0.1:8080/folder
      Show
      Create a folder in welcome content and create a bad symlink in the folder mkdir folder cd folder ln -s xxx bad Start server standalone.sh Allow directory listing in file handler /subsystem=undertow/configuration=handler/file=welcome-content:write-attribute(name=directory-listing, value= true ) reload Go to the folder in welcome content http: //127.0.0.1:8080/folder

      When I added a bad symlink to the welcome-content and allowed directory-listing in the file handler of the welcome-content server returns Internal Server Error (500) when accessing the folder containing the bad symlink. However, no exception is logged in the output on WildFly.

      I also tried to use simple example application - File Serving from Undertow Examples where I can see the following exception when accessing the directory with the bad symlink:

      java.lang.RuntimeException: java.nio.file.NoSuchFileException: /home/akrajcik/Pictures/pictures
      	at io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:62)
      	at io.undertow.server.handlers.resource.DirectoryUtils.renderDirectoryListing(DirectoryUtils.java:139)
      	at io.undertow.server.handlers.resource.DirectoryUtils.renderDirectoryListing(DirectoryUtils.java:162)
      	at io.undertow.server.handlers.resource.ResourceHandler$1.handleRequest(ResourceHandler.java:233)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      	at java.lang.Thread.run(Thread.java:811)
      Caused by: java.nio.file.NoSuchFileException: /home/akrajcik/Pictures/pictures
      	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:98)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:114)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:119)
      	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:67)
      	at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:156)
      	at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:111)
      	at java.nio.file.Files.readAttributes(Files.java:1748)
      	at java.nio.file.Files.getLastModifiedTime(Files.java:2277)
      	at io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:60)
      	... 8 more
      

              rhn-support-iweiss Ingo Weiss
              akrajcik@redhat.com Adam Krajcik
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: