Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1413

getRealPath() can incorrectly resolve missing paths from custom resource manager

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Unresolved
    • Major
    • None
    • None
    • Servlet
    • None

    Description

      Please see related E-mail list thread:
      http://lists.jboss.org/pipermail/undertow-dev/2018-September/002273.html

      TL; DR;
      When a custom resource manager is used that resolves paths starting with "/WEB-INF" to a different location than "/" then the servletContext's getRealPath() method can incorrectly resolve non-existent paths starting with /WEB-INF. The reason is because missing paths are assumed to be rooted in whatever folder the resource manager returns for "/" but that doesn't allow a custom resource manager to return customized paths based on the start of the incoming path.

      The suggested solution is to adapt the code snippet in this comment:
      https://issues.jboss.org/browse/UNDERTOW-373?focusedCommentId=13036336&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13036336

      In which non-existent paths are checked progressively stripping folders off the end of the path until the resource manager returns a match. This will allow the resource manager to give the most specific answer possible based on as much of the path as it can. This change will only affect resolution of non-existent paths and will iterate until it reaches a path generic enough (possibly "/") that the resource manager can map it to a real path.

      Attachments

        Activity

          People

            bdw429s Brad Wood
            bdw429s Brad Wood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: