-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 458 #470
Fix 458 #470
Conversation
Hm, I need to check the failure in the tests. |
I tried to resolve the conflict from merge with master from GitHub but I see that without success. What I don't like with this kind of solution is that we modified the core for a vulnerability that appear in a optional module (for example I don't use that module in my projects). And the modification is not trivial. For a new comer is hard to read this code and to quess why we did it. I don't understand why XStream doesn't come with a fix. |
I had some difficulties while locally merging. About your reservations:
|
Pull Request Test Coverage Report for Build 1017
💛 - Coveralls |
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
pippo-session-parent/pippo-session/src/main/java/ro/pippo/session/ClassFilter.java
Outdated
Show resolved
Hide resolved
pippo-session-parent/pippo-session/src/main/java/ro/pippo/session/ClassFilter.java
Outdated
Show resolved
Hide resolved
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
Yes, you are right.
No, I will merge in the end. Maybe I will read more about this subject. Users using Pippo need to make sure we focus on security. |
I have changed all your requests. |
I'll take a look at everything that was said here... |
The @rygel changes was made in the pippo-session module. Why did you guys say it was made in the pippo-core? I did not understand.
XStream provides means to avoid RCE, or in other words to avoid or not to serialize / deserialize certain classes. Those who use this API can choose whether or not to enable this security.
As I quoted here and I will detail it better in my post below, I believe there is a relationship with XStream. |
I read and refreshed my memory! :) Serialization / Deserialization is very common and checking whether certain types may or may not be deserialized is very important because of security concerns. Regardless if it is from a json, xml, Java serialization etc. Recently (others not so) some frameworks that I use have implemented a restriction to allow or not to deserialize a set of classes and/or packages, eg: Richfaces 3.3.3 > 3.3.4, JBoss EAP 6.3.0 with jackson-mapper-asl 1.9.9.redhat-3 > JBoss EAP 6.4.20 with jackson-mapper-asl 1.9.9.redhat-6, XStream after version 1.4.6. So I had to define a set of my allowed packages for Serialization / Deserialization. I think somewhere in Pippo there could be the option where it would be possible to define a list of classes and/or packages that would be allowed to deserialize (whitelist). I believe somewhere in the core. Why the core? Because, as I said above, Serialization / Deserialization is something common. This whitelist would already come with some basic classes (eg ro.pippo.core.Flash, java.util.ArrayList etc), but would be extensible in some way (eg: system property, application.properties etc) so that it could be possible to add more classes and/or packages. Both the FilteringObjectInputStream class (created here in this PR) and the XstreamEngine class (see issue #454), as well as any other Pippo class that works with Serialization / Deserialization, should check the whitelist! Below are two implementations from where we can extract one or another idea (let's always keep in mind the simplicity, efficiency and code readability of Pippo!):
What do you guys think? |
I find this interesting article that describes problem in detail. |
I see some improvements in code. I will add new comments in a new review. |
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
...-session-parent/pippo-session/src/main/java/ro/pippo/session/FilteringObjectInputStream.java
Outdated
Show resolved
Hide resolved
@mhagnumdw Thank you for explaining the issue better. I understand now that both #458 and #454 are related. I am now just wondering if we fixed also the XStream issue with this PR or if there is more work needed? |
I polished a litle bit this PR. Now, I think that we have enough flexibility. In the end, I think that |
We can improve the format of
The line from above, could means add all classes from for (String package: whitePackageNames) {
if (className.startWith(package)) { // trivial implementation
return true;
}
} In the extreme case (last step), we can go (add support) with regex. So, the sky is the limit 😄. It's not very clear for me what about primitive classes, if we must add them by default in |
I've added the fix propsed by @idealzh