Bug 1342219 - tomcat doesn't apply catalina.policy rules for webapps
Summary: tomcat doesn't apply catalina.policy rules for webapps
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: tomcat
Version: 23
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Coty Sutherland
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-02 17:01 UTC by F.Prates
Modified: 2016-09-25 20:30 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-25 20:30:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
example .war file (1.90 KB, application/zip)
2016-06-02 17:02 UTC, F.Prates
no flags Details
current catalina.policy (13.07 KB, text/x-csrc)
2016-06-02 17:05 UTC, F.Prates
no flags Details
current tomcat.conf (1.95 KB, text/plain)
2016-06-02 17:07 UTC, F.Prates
no flags Details
source code of the test case (1.74 KB, application/octet-stream)
2016-06-02 17:10 UTC, F.Prates
no flags Details
stacktrace (2.53 KB, text/plain)
2016-06-02 17:14 UTC, F.Prates
no flags Details
current catalina.policy v2 (13.07 KB, text/plain)
2016-06-02 17:21 UTC, F.Prates
no flags Details

Description F.Prates 2016-06-02 17:01:26 UTC
Description of problem:
tomcat doesn't respect some custom policies for webapps declared by 'codeBase'.

Version-Release number of selected component (if applicable):
8.0.32

How reproducible:
always, security manager enabled. grant with no codeBase specified works fine.

Steps to Reproduce:
1. deploy the example war file attached (catalina_policy_test.war);
2. browse 'http://localhost:8080/catalina_policy_test/index.html' (change the port if needed);
3. an AccessControlException is raised.

Actual results:
An AccessControlException is raised for "java.util.PropertyPermission" "user.home" action "read".

Expected results:
The user.home property should be printed.

Additional info:
vanilla package from tomcat.apache.org (8.0.35) doesn't have this problem.

Comment 1 F.Prates 2016-06-02 17:02:57 UTC
Created attachment 1164128 [details]
example .war file

test case

Comment 2 F.Prates 2016-06-02 17:05:31 UTC
Created attachment 1164129 [details]
current catalina.policy

Comment 3 F.Prates 2016-06-02 17:07:31 UTC
Created attachment 1164131 [details]
current tomcat.conf

Comment 4 F.Prates 2016-06-02 17:10:59 UTC
Created attachment 1164133 [details]
source code of the test case

Comment 5 F.Prates 2016-06-02 17:14:09 UTC
Created attachment 1164135 [details]
stacktrace

Comment 6 F.Prates 2016-06-02 17:18:43 UTC
Just to ease the reading of catalina.policy, follows bellow the role a wrote to the test case:

grant codeBase "file:${catalina.base}/webapps/catalina_policy_test/-" {
    permission java.util.PropertyPermission "user.home", "read";
};

I replaced ${catalina.base} for ${catalina.home} with no success.

Comment 7 F.Prates 2016-06-02 17:21:58 UTC
Created attachment 1164136 [details]
current catalina.policy v2

fix ${catalina.home} spelling.

Comment 8 Coty Sutherland 2016-08-17 18:47:40 UTC
It looks like this might be an issue in tomcat (because it works with 8.0.35; did you test with 8.0.32 upstream?), not specific to the Fedora package, so it should be raised in the upstream project. However I recently pushed an update into updates-testing that rebased tomcat to 8.0.36. Can you test with that to verify whether or not the problem still exists? The update is here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-2b0c16fd82

If it's fixed, then I'll add this bug to the update so that it gets closed when the build is pushed to stable.

Comment 9 Coty Sutherland 2016-08-17 18:48:23 UTC
Actually that was the wrong update link. The fc23 one is https://bodhi.fedoraproject.org/updates/FEDORA-2016-0a4dccdd23

Comment 10 F.Prates 2016-09-06 17:11:52 UTC
(In reply to Coty Sutherland from comment #9)
> Actually that was the wrong update link. The fc23 one is
> https://bodhi.fedoraproject.org/updates/FEDORA-2016-0a4dccdd23

I updated the package and tested but the issue is still reproducible.

So, the recommendation is to me let upstream know about this issue, right?

Comment 11 F.Prates 2016-09-06 17:24:29 UTC
(In reply to Coty Sutherland from comment #8)
> It looks like this might be an issue in tomcat (because it works with
> 8.0.35; did you test with 8.0.32 upstream?), not specific to the Fedora
> package, so it should be raised in the upstream project. However I recently
> pushed an update into updates-testing that rebased tomcat to 8.0.36. Can you
> test with that to verify whether or not the problem still exists? The update
> is here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-2b0c16fd82
> 
> If it's fixed, then I'll add this bug to the update so that it gets closed
> when the build is pushed to stable.

sorry, i missed something: did the test case work for you? hm. so, it's my problem. there is some configuration between the vanilla tomcat and fedora's i'm not aware of.

thank you very much for your effort.

Comment 12 Coty Sutherland 2016-09-25 20:30:07 UTC
> I updated the package and tested but the issue is still reproducible.

Thanks for testing.

> So, the recommendation is to me let upstream know about this issue, right?

Yes, but this looks like expected behavior to me. All applications should not have access to the specified environment variable, so if your application needs it, then you need to adjust the policy accordingly.

> sorry, i missed something: did the test case work for you?

No, I tested with ASF tomcat 8.0.32 and 8.0.35 and both show the same behavior when using the security manager. The problem is that the default policy does not allow this behavior and therefore it's expected.

If you don't agree with that assessment please open an upstream bug with ASF tomcat and suggest a change in the policy to be less strict.


Note You need to log in before you can comment on or make changes to this bug.