Skip to content
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

Shading issues (BouncyCastle, Jetty) #338

Closed
wpoch opened this issue May 9, 2017 · 11 comments
Closed

Shading issues (BouncyCastle, Jetty) #338

wpoch opened this issue May 9, 2017 · 11 comments

Comments

@wpoch
Copy link

wpoch commented May 9, 2017

When using the provided distribution I'm facing BouncyCastle and Jetty shading issues with my current application code; I cloned the repo removed the shading and everything worked as expected.

Would you consider releasing a version without shading the dependencies? I can work on the PR with a custom profile.

Congrats for the great lib!

@asafm
Copy link
Contributor

asafm commented May 9, 2017 via email

@rnorth
Copy link
Member

rnorth commented May 15, 2017

Hi
Sorry you've had problems with the shaded JARs - it's quite a pain that we have to do it at all! I'd be happy to release an unshaded version, yes. We'd probably still want to guide people towards the shaded version normally, but for people who need to use an unshaded version it would make a nice option.

Ideally I'd hope it's something we can define at the parent POM level to avoid having to update every POM - is that what you'd have in mind?
Thanks!
Richard

@terribleherbst
Copy link

I've got a similar problem. When integrating the testcontainer dependency I get an jackson error java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider org.testcontainers.shaded.com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype. This is caused by a customized Jackson configuration which autoconfigures modules at startup.
Is there a unshaded version of testcontainers available?

@rmchale
Copy link

rmchale commented Aug 2, 2017

I get this issue as well

java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider org.testcontainers.shaded.com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule not a subtype

@banderous
Copy link

BouncyCastle is a signed JAR which is being shaded by TestContainers, ie. repackaged into an unsigned JAR. The signature of this jar is verified (and fails to verify) when BouncyCastle types are used by java.security.

A particular problem is that a shaded BouncyCastleProvider is registered with java.security.Security by Netty, which if it happens first will prevent a signed BouncyCastleProvider being registered.

@bsideup
Copy link
Member

bsideup commented Mar 28, 2018

Hi @banderous,

Thanks for explanation, it helps to understand the issue better 👍

FYI we have plans to replace Netty with OkHttp or some other alternative lightweight networking library once new docker-java is released, I'll post the update on this issue once it's done

@banderous
Copy link

banderous commented Mar 28, 2018 via email

@bsideup
Copy link
Member

bsideup commented Mar 28, 2018

@banderous
BouncyCastle is a transitive dependency of docker-java -> Netty, I don't think we use it anywhere else.

I would keep shaded because we don't want to leak it into our public API / dependencies, and the proper fix will be to remove it completely

@banderous
Copy link

banderous commented Mar 28, 2018 via email

@rnorth
Copy link
Member

rnorth commented Apr 26, 2019

With removal of Netty in #1307, we're no longer shading BouncyCastle. It is still a transitive dependency via docker-java:

+--- com.github.docker-java:docker-java:3.1.0-rc-4
|    +--- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.6.7
|    |    +--- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.6.7
|    |    |    +--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |    |    \--- com.fasterxml.jackson.core:jackson-databind:2.6.7
|    |    |         +--- com.fasterxml.jackson.core:jackson-annotations:2.6.0
|    |    |         \--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |    +--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.6.7 (*)
|    |    \--- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.6.7
|    |         +--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |         \--- com.fasterxml.jackson.core:jackson-databind:2.6.7 (*)
|    +--- commons-codec:commons-codec:1.11
|    +--- commons-lang:commons-lang:2.6
|    +--- commons-io:commons-io:2.6
|    +--- com.google.guava:guava:19.0
|    \--- org.bouncycastle:bcpkix-jdk15on:1.60
|         \--- org.bouncycastle:bcprov-jdk15on:1.60

As this issue was specifically about the shading, I'll close. If there are any issues just relating to the (unshaded) BC library being a dependency, let's open a new ticket.

@rnorth rnorth closed this as completed Apr 26, 2019
@crusi
Copy link

crusi commented Jan 31, 2020

With removal of Netty in #1307, we're no longer shading BouncyCastle. It is still a transitive dependency via docker-java:

+--- com.github.docker-java:docker-java:3.1.0-rc-4
|    +--- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.6.7
|    |    +--- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.6.7
|    |    |    +--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |    |    \--- com.fasterxml.jackson.core:jackson-databind:2.6.7
|    |    |         +--- com.fasterxml.jackson.core:jackson-annotations:2.6.0
|    |    |         \--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |    +--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |    +--- com.fasterxml.jackson.core:jackson-databind:2.6.7 (*)
|    |    \--- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.6.7
|    |         +--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    |         \--- com.fasterxml.jackson.core:jackson-databind:2.6.7 (*)
|    +--- commons-codec:commons-codec:1.11
|    +--- commons-lang:commons-lang:2.6
|    +--- commons-io:commons-io:2.6
|    +--- com.google.guava:guava:19.0
|    \--- org.bouncycastle:bcpkix-jdk15on:1.60
|         \--- org.bouncycastle:bcprov-jdk15on:1.60

As this issue was specifically about the shading, I'll close. If there are any issues just relating to the (unshaded) BC library being a dependency, let's open a new ticket.

there are still bouncycastle classes in the testcontainers.jar. And they still lead to errors like
testcontainers-1.12.5.jar has unsigned entries - org/testcontainers/lifecycle/Startable.class

As long as you have org.testcontainers.shaded.org.bouncycastle.jce.provider.BouncyCastleProvider in your jar, and your jar is not signed, the error will happen in other projects and the only workaround currently is to remove this provider before the test executes and add the correct one first, e.g. here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants