Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CEB87200C79 for ; Fri, 19 May 2017 21:45:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CD4B2160BD1; Fri, 19 May 2017 19:45:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1F4F9160BB0 for ; Fri, 19 May 2017 21:45:41 +0200 (CEST) Received: (qmail 30419 invoked by uid 500); 19 May 2017 19:45:40 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 30409 invoked by uid 99); 19 May 2017 19:45:40 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 May 2017 19:45:40 +0000 Received: from s2laptop.dev.local (host217-44-158-64.range217-44.btcentralplus.com [217.44.158.64]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 334001A031B for ; Fri, 19 May 2017 19:45:39 +0000 (UTC) Subject: Re: Tomcat 8.5: wrong classloader used during context startup? To: Tomcat Users List References: <847f40ab-1559-7520-74c1-10517821b5c4@apache.org> <8f2c9493-4921-35a5-4d43-17a34c016f9f@christopherschultz.net> From: Mark Thomas Message-ID: Date: Fri, 19 May 2017 20:45:37 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <8f2c9493-4921-35a5-4d43-17a34c016f9f@christopherschultz.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit archived-at: Fri, 19 May 2017 19:45:43 -0000 On 19/05/2017 15:25, Christopher Schultz wrote: > Mark, > > On 5/18/17 1:01 PM, Mark Thomas wrote: >> On 17/05/2017 14:32, Michael Heinen wrote: >>> I am currently migrating a web app from Tomcat 7.0.73 to 8.5.15. >>> An embedded Tomcat is used on development systems. >>> >>> The web-inf/lib folder of the application contains a jar with a >>> SAXParserFactory implementation. This SAXParserFactory is now >>> used with TC 8.5 by the WebXmlParser in order to parse the >>> web.xml (and fails unfortunately). The ServiceLoader finds the >>> jar because the ParallelWebappClassLoader is used for the >>> lookup. >>> >>> TC 7.0.73 uses the sun.misc.Launcher$AppClassLoader and does >>> therefore not use the jar under web-inf\lib. It creates the >>> webXml Digester in the init() phase of the stanrardContext. TC >>> 8.5 does this in the startInternal() phase where the >>> ParallelWebappClassLoader is instantiated and bound to the >>> current thread. >>> >>> Specifying "javax.xml.parsers.SAXParserFactory" as VM param >>> solves the issue of course. > >> I think this is the fix that triggered this: >> https://svn.apache.org/viewvc?view=revision&revision=1731216 > >>> My question: Is this behaviour expected? > >> It looks like an unintended side-effect of the change. > >>> Should Tomcat use libraries of the web app for the startup of a >>> context, here for web-xml parsing? > >> The change has been in place for over a year and this is the first >> problem we have seen. I'm curious, what exactly was the problem you >> saw? > >> I'd probably lean towards fixing this on the grounds that you want >> to parsing of web.xml to be deterministic rather than dependent on >> what may, or may not, be included in the app. > >> What do others think? > > +1 > > Also, for an untrusted application (admittedly a minority use case), > having Tomcat parse the app-provided XML with an application-provided > XML parser might have security implications. I don't believe it does in this case. The file being parsed is web.xml which is application provided anyway so any manipulation a malicious app could do via the parser could just be done directly in web.xml. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org