Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
2c4dec9
Update OAuth2 OIDC SDK
AthenaEryma May 17, 2024
e64f184
WIP
AthenaEryma Jun 5, 2024
a1934a5
Merge branch 'refs/heads/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 5, 2024
888e32c
Merge branch 'refs/heads/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 6, 2024
49dff07
remove nimbus require
AthenaEryma Jun 6, 2024
bbf6ca6
Merge branch 'refs/heads/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 10, 2024
522a35e
trying the require in core
AthenaEryma Jun 10, 2024
3e096e6
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 10, 2024
c74e5bb
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 13, 2024
e254719
update to jose-jwt 9.39.1, fixing all the module issues -_-
AthenaEryma Jun 13, 2024
21997c9
Merge branch 'refs/heads/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 17, 2024
ac70e82
finally got this working, thanks chris
AthenaEryma Jun 25, 2024
6891526
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jun 25, 2024
893495d
9.39.3 patch
AthenaEryma Jun 25, 2024
a43c02a
Revert "9.39.3 patch"
AthenaEryma Jun 25, 2024
5fdeb93
back to 9.37.3
AthenaEryma Jul 1, 2024
a1d46cc
Merge branch 'refs/heads/main' into update/oauth2-oidc-sdk
AthenaEryma Jul 8, 2024
288a129
cleanup
AthenaEryma Jul 8, 2024
cb5d41e
Merge branch 'refs/heads/main' into update/oauth2-oidc-sdk
AthenaEryma Jul 11, 2024
0d19906
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jul 22, 2024
fc44310
add doPrivileged call
AthenaEryma Jul 22, 2024
e650536
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jul 22, 2024
183bb47
one more doPrivileged
AthenaEryma Jul 23, 2024
4bd6cc3
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jul 23, 2024
6ccacc9
Add unit test reproducing crypto threadpool queue overflow
AthenaEryma Jul 26, 2024
0556a5b
Fix cache issues on crypto threadpool overflow
AthenaEryma Jul 26, 2024
6e45bd6
Revert "Fix cache issues on crypto threadpool overflow"
AthenaEryma Jul 26, 2024
2deeffe
Revert "Add unit test reproducing crypto threadpool queue overflow"
AthenaEryma Jul 30, 2024
7b240e9
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Jul 31, 2024
ba520c1
WIP
AthenaEryma Aug 2, 2024
2a288c7
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 2, 2024
2c0dece
passes the testFailureOnExpiredJwt
jakelandis Aug 5, 2024
faf294f
Disable security manager for JWT & OIDC unit tests
AthenaEryma Aug 5, 2024
53405d1
Fix failure in unit test
AthenaEryma Aug 5, 2024
99d57b8
Wrap jose access in JWT `ESIntegTestCase`s
AthenaEryma Aug 6, 2024
5980a74
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 6, 2024
b760c6c
Expand wrapper to include nimbus
AthenaEryma Aug 6, 2024
0edae4a
Fix typo + wrap one more thing
AthenaEryma Aug 7, 2024
0a2fdba
Another wrapper + a bit of cleanup
AthenaEryma Aug 7, 2024
f024591
spotless
AthenaEryma Aug 7, 2024
b573cea
Include system property necessary for unit tests
AthenaEryma Aug 7, 2024
66fb729
Put testNoSecurityManager next to test
AthenaEryma Aug 7, 2024
4e96c29
General cleanup
AthenaEryma Aug 7, 2024
7a7544a
Revert "Put testNoSecurityManager next to test"
AthenaEryma Aug 7, 2024
06cf7c4
Revert "General cleanup"
AthenaEryma Aug 7, 2024
f91badf
Remove comment
AthenaEryma Aug 7, 2024
9f5b12f
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 7, 2024
44c569e
Remove unnecessary no-op module
AthenaEryma Aug 9, 2024
1273af4
First pass at forbidden APIs
AthenaEryma Aug 9, 2024
69e022f
Ah, that's how you reference inner classes
AthenaEryma Aug 10, 2024
cb320bc
That's all of them (in nimbus-jose-jwt)
AthenaEryma Aug 11, 2024
ab86673
Just cut this knot
AthenaEryma Aug 11, 2024
706866e
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 11, 2024
c9e4e52
Clean up comments
AthenaEryma Aug 11, 2024
97f178c
Policy cleanup
AthenaEryma Aug 11, 2024
4351a5c
Bit more cleanup
AthenaEryma Aug 11, 2024
291b30c
Break modifications out into "wrapper" classes
AthenaEryma Aug 12, 2024
9e09edb
License headers check
AthenaEryma Aug 12, 2024
575539b
JSONStringUtils javadoc
AthenaEryma Aug 12, 2024
41e0e57
cleanup
AthenaEryma Aug 12, 2024
27d2d96
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 12, 2024
1fc71bf
Reconfigure the build to reference original class files
AthenaEryma Aug 13, 2024
c5c82d8
We have json serializiation at home
AthenaEryma Aug 13, 2024
9e573b7
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 13, 2024
a535fa0
Adjust exception handling per review
AthenaEryma Aug 15, 2024
6b55a8b
Rename directories + spotless
AthenaEryma Aug 15, 2024
20e0b3b
Merge remote-tracking branch 'origin/main' into update/oauth2-oidc-sdk
AthenaEryma Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,11 @@
<sha256 value="fbfd0d5f2b2f86758b821daa5e79b5d7c965edd9dc1b2cc80b515df1c6ddc22d" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.nimbusds" name="nimbus-jose-jwt" version="9.23">
<artifact name="nimbus-jose-jwt-9.23.jar">
<sha256 value="33ab8084fdae1d75be1b061b1489d4a12045bd7b50c2e24ff152911e4551ec07" origin="Generated by Gradle"/>
<component group="com.nimbusds" name="nimbus-jose-jwt" version="9.37.3">
<artifact name="nimbus-jose-jwt-9.37.3.jar">
<sha256 value="12ae4a3a260095d7aeba2adea7ae396e8b9570db8b7b409e09a824c219cc0444" origin="Generated by Gradle">
<also-trust value="afc63b689d881439b95f343b1dca750391edac63b87392be4d90d19c94ccafbe"/>
</sha256>
</artifact>
</component>
<component group="com.nimbusds" name="nimbus-jose-jwt" version="9.37.3">
Expand All @@ -961,6 +963,11 @@
<sha256 value="7664cf8c6f2adadf600287812b32878277beda54912eab9d4c2932cd50cb704a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.nimbusds" name="oauth2-oidc-sdk" version="11.10.1">
<artifact name="oauth2-oidc-sdk-11.10.1.jar">
<sha256 value="9e51b2c17503cdd3eb97f41491c712aff7783bb3c67185d789f44ccf2a603b26" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.nimbusds" name="oauth2-oidc-sdk" version="11.9.1">
<artifact name="oauth2-oidc-sdk-11.9.1.jar">
<sha256 value="0820c9690966304d075347b88e81ae490213440fc4d2c84f3d370d41941b2b9c" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -1739,6 +1746,11 @@
<sha256 value="64072f56d9dff5040b2acec477c5d5e6bcebfc88c508f12acb26072d07942146" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="net.minidev" name="json-smart" version="2.5.1">
<artifact name="json-smart-2.5.1.jar">
<sha256 value="86c0c189581b79b57b0719f443a724e9f628ffbb9eef645cf79194f5973a1001" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="net.minidev" name="json-smart" version="2.5.0">
<artifact name="json-smart-2.5.0.jar">
<sha256 value="432b9e545848c4141b80717b26e367f83bf33f19250a228ce75da6e967da2bc7" origin="Generated by Gradle"/>
Expand Down
255 changes: 125 additions & 130 deletions x-pack/plugin/security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,19 @@ dependencies {
runtimeOnly "joda-time:joda-time:2.10.10"

// Dependencies for oidc
api "com.nimbusds:oauth2-oidc-sdk:9.37"
api "com.nimbusds:nimbus-jose-jwt:9.23"
api "com.nimbusds:oauth2-oidc-sdk:11.10.1"
api project(path: xpackModule('security:lib:nimbus-jose-jwt-modified'), configuration: 'shadow')
if (isEclipse) {
/*
* Eclipse can't pick up the shadow dependency so we point it at the unmodified version of the library
* so it can compile things.
*/
api "com.nimbusds:nimbus-jose-jwt:9.37.3"
}
api "com.nimbusds:lang-tag:1.4.4"
api "com.sun.mail:jakarta.mail:1.6.3"
api "net.jcip:jcip-annotations:1.0"
api "net.minidev:json-smart:2.4.10"
api "net.minidev:json-smart:2.5.1"
api "net.minidev:accessors-smart:2.4.2"
api "org.ow2.asm:asm:8.0.1"

Expand All @@ -103,7 +110,6 @@ dependencies {
testImplementation('org.apache.kerby:kerb-crypto:1.1.1')
testImplementation('org.apache.kerby:kerb-util:1.1.1')
testImplementation('org.apache.kerby:token-provider:1.1.1')
testImplementation('com.nimbusds:nimbus-jose-jwt:9.23')
testImplementation('net.jcip:jcip-annotations:1.0')
testImplementation('org.apache.kerby:kerb-admin:1.1.1')
testImplementation('org.apache.kerby:kerb-server:1.1.1')
Expand Down Expand Up @@ -225,6 +231,9 @@ tasks.named("thirdPartyAudit").configure {
'javax.servlet.http.HttpSession',
'javax.servlet.http.HttpUpgradeHandler',
'javax.servlet.http.Part',
'jakarta.servlet.ServletRequest',
'jakarta.servlet.http.HttpServletRequest',
'jakarta.servlet.http.HttpServletResponse',
// [missing classes] Shibboleth + OpenSAML have velocity support that we don't use
'org.apache.velocity.VelocityContext',
'org.apache.velocity.app.VelocityEngine',
Expand Down Expand Up @@ -274,112 +283,103 @@ tasks.named("thirdPartyAudit").configure {
// [missing classes] Http Client cache has optional ehcache support
'net.sf.ehcache.Ehcache',
'net.sf.ehcache.Element',
// Bouncycastle is an optional dependency for apache directory, cryptacular and opensaml packages. We
// acknowledge them here instead of adding bouncy castle as a compileOnly dependency
'org.bouncycastle.asn1.ASN1Encodable',
'org.bouncycastle.asn1.ASN1InputStream',
'org.bouncycastle.asn1.ASN1Integer',
'org.bouncycastle.asn1.ASN1ObjectIdentifier',
'org.bouncycastle.asn1.ASN1OctetString',
'org.bouncycastle.asn1.ASN1Primitive',
'org.bouncycastle.asn1.ASN1Sequence',
'org.bouncycastle.asn1.ASN1TaggedObject',
// 'org.bouncycastle.asn1.DEROctetString',
'org.bouncycastle.asn1.pkcs.EncryptedPrivateKeyInfo',
'org.bouncycastle.asn1.pkcs.EncryptionScheme',
'org.bouncycastle.asn1.pkcs.KeyDerivationFunc',
'org.bouncycastle.asn1.pkcs.PBEParameter',
'org.bouncycastle.asn1.pkcs.PBES2Parameters',
'org.bouncycastle.asn1.pkcs.PBKDF2Params',
'org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers',
'org.bouncycastle.asn1.pkcs.PrivateKeyInfo',
'org.bouncycastle.asn1.x500.AttributeTypeAndValue',
'org.bouncycastle.asn1.x500.RDN',
'org.bouncycastle.asn1.x500.X500Name',
'org.bouncycastle.asn1.x509.AccessDescription',
'org.bouncycastle.asn1.x509.AlgorithmIdentifier',
'org.bouncycastle.asn1.x509.AuthorityKeyIdentifier',
'org.bouncycastle.asn1.x509.BasicConstraints',
'org.bouncycastle.asn1.x509.DistributionPoint',
'org.bouncycastle.asn1.x509.Extension',
'org.bouncycastle.asn1.x509.GeneralName',
'org.bouncycastle.asn1.x509.GeneralNames',
'org.bouncycastle.asn1.x509.GeneralNamesBuilder',
'org.bouncycastle.asn1.x509.KeyPurposeId',
'org.bouncycastle.asn1.x509.KeyUsage',
'org.bouncycastle.asn1.x509.PolicyInformation',
'org.bouncycastle.asn1.x509.SubjectKeyIdentifier',
'org.bouncycastle.asn1.x509.SubjectPublicKeyInfo',
// 'org.bouncycastle.asn1.x9.DomainParameters',
// 'org.bouncycastle.asn1.x9.ECNamedCurveTable',
'org.bouncycastle.asn1.x9.X9ECParameters',
'org.bouncycastle.cert.X509v3CertificateBuilder',
'org.bouncycastle.cert.jcajce.JcaX509CertificateConverter',
'org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils',
'org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder',
'org.bouncycastle.crypto.BlockCipher',
'org.bouncycastle.crypto.BufferedBlockCipher',
'org.bouncycastle.crypto.CipherParameters',
'org.bouncycastle.crypto.Digest',
'org.bouncycastle.crypto.PBEParametersGenerator',
'org.bouncycastle.crypto.StreamCipher',
'org.bouncycastle.crypto.agreement.kdf.ConcatenationKDFGenerator',
// 'org.bouncycastle.crypto.ec.CustomNamedCurves',
'org.bouncycastle.crypto.engines.AESEngine',
'org.bouncycastle.crypto.generators.BCrypt',
'org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator',
'org.bouncycastle.crypto.generators.PKCS5S1ParametersGenerator',
'org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator',
'org.bouncycastle.crypto.macs.HMac',
'org.bouncycastle.crypto.modes.AEADBlockCipher',
'org.bouncycastle.crypto.modes.GCMBlockCipher',
'org.bouncycastle.crypto.paddings.BlockCipherPadding',
'org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher',
'org.bouncycastle.crypto.params.AsymmetricKeyParameter',
'org.bouncycastle.crypto.params.DSAKeyParameters',
'org.bouncycastle.crypto.params.DSAParameters',
'org.bouncycastle.crypto.params.DSAPrivateKeyParameters',
'org.bouncycastle.crypto.params.DSAPublicKeyParameters',
'org.bouncycastle.crypto.params.ECDomainParameters',
'org.bouncycastle.crypto.params.ECKeyParameters',
'org.bouncycastle.crypto.params.ECPrivateKeyParameters',
'org.bouncycastle.crypto.params.ECPublicKeyParameters',
// 'org.bouncycastle.crypto.params.KDFParameters',
'org.bouncycastle.crypto.params.KeyParameter',
'org.bouncycastle.crypto.params.RSAKeyParameters',
'org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters',
'org.bouncycastle.crypto.prng.EntropySource',
'org.bouncycastle.crypto.prng.SP800SecureRandom',
'org.bouncycastle.crypto.prng.SP800SecureRandomBuilder',
'org.bouncycastle.crypto.prng.drbg.SP80090DRBG',
'org.bouncycastle.crypto.signers.DSASigner',
'org.bouncycastle.crypto.signers.ECDSASigner',
'org.bouncycastle.crypto.signers.RSADigestSigner',
'org.bouncycastle.crypto.util.PrivateKeyFactory',
'org.bouncycastle.crypto.util.PrivateKeyInfoFactory',
'org.bouncycastle.crypto.util.PublicKeyFactory',
'org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory',
'org.bouncycastle.jcajce.provider.asymmetric.dsa.KeyPairGeneratorSpi',
'org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC',
'org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyPairGeneratorSpi',
'org.bouncycastle.jcajce.provider.asymmetric.util.EC5Util',
'org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil',
// 'org.bouncycastle.jce.ECNamedCurveTable',
// 'org.bouncycastle.jce.spec.ECNamedCurveParameterSpec',
'org.bouncycastle.math.ec.ECFieldElement',
'org.bouncycastle.math.ec.ECPoint',
'org.bouncycastle.openssl.jcajce.JcaPEMWriter',
'org.bouncycastle.operator.jcajce.JcaContentSignerBuilder',
'org.bouncycastle.util.Arrays',
'org.bouncycastle.util.io.Streams',
'org.bouncycastle.cert.jcajce.JcaX509CertificateHolder',
'org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider',
'org.bouncycastle.cert.X509CertificateHolder',
'org.bouncycastle.openssl.PEMKeyPair',
'org.bouncycastle.openssl.PEMParser',
'org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter',
'org.bouncycastle.crypto.InvalidCipherTextException',
'org.bouncycastle.jce.provider.BouncyCastleProvider',
// Bouncycastle is an optional dependency for apache directory, cryptacular and opensaml packages. We
// acknowledge them here instead of adding bouncy castle as a compileOnly dependency
'org.bouncycastle.asn1.ASN1Encodable',
'org.bouncycastle.asn1.ASN1InputStream',
'org.bouncycastle.asn1.ASN1Integer',
'org.bouncycastle.asn1.ASN1ObjectIdentifier',
'org.bouncycastle.asn1.ASN1OctetString',
'org.bouncycastle.asn1.ASN1Primitive',
'org.bouncycastle.asn1.ASN1Sequence',
'org.bouncycastle.asn1.ASN1TaggedObject',
// 'org.bouncycastle.asn1.DEROctetString',
'org.bouncycastle.asn1.pkcs.EncryptedPrivateKeyInfo',
'org.bouncycastle.asn1.pkcs.EncryptionScheme',
'org.bouncycastle.asn1.pkcs.KeyDerivationFunc',
'org.bouncycastle.asn1.pkcs.PBEParameter',
'org.bouncycastle.asn1.pkcs.PBES2Parameters',
'org.bouncycastle.asn1.pkcs.PBKDF2Params',
'org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers',
'org.bouncycastle.asn1.pkcs.PrivateKeyInfo',
'org.bouncycastle.asn1.x500.AttributeTypeAndValue',
'org.bouncycastle.asn1.x500.RDN',
'org.bouncycastle.asn1.x500.X500Name',
'org.bouncycastle.asn1.x509.AccessDescription',
'org.bouncycastle.asn1.x509.AlgorithmIdentifier',
'org.bouncycastle.asn1.x509.AuthorityKeyIdentifier',
'org.bouncycastle.asn1.x509.BasicConstraints',
'org.bouncycastle.asn1.x509.DistributionPoint',
'org.bouncycastle.asn1.x509.Extension',
'org.bouncycastle.asn1.x509.GeneralName',
'org.bouncycastle.asn1.x509.GeneralNames',
'org.bouncycastle.asn1.x509.GeneralNamesBuilder',
'org.bouncycastle.asn1.x509.KeyPurposeId',
'org.bouncycastle.asn1.x509.KeyUsage',
'org.bouncycastle.asn1.x509.PolicyInformation',
'org.bouncycastle.asn1.x509.SubjectKeyIdentifier',
'org.bouncycastle.asn1.x509.SubjectPublicKeyInfo',
// 'org.bouncycastle.asn1.x9.DomainParameters',
// 'org.bouncycastle.asn1.x9.ECNamedCurveTable',
'org.bouncycastle.asn1.x9.X9ECParameters',
'org.bouncycastle.cert.X509v3CertificateBuilder',
'org.bouncycastle.cert.jcajce.JcaX509CertificateConverter',
'org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils',
'org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder',
'org.bouncycastle.crypto.BlockCipher',
'org.bouncycastle.crypto.BufferedBlockCipher',
'org.bouncycastle.crypto.CipherParameters',
'org.bouncycastle.crypto.Digest',
'org.bouncycastle.crypto.PBEParametersGenerator',
'org.bouncycastle.crypto.StreamCipher',
'org.bouncycastle.crypto.agreement.kdf.ConcatenationKDFGenerator',
// 'org.bouncycastle.crypto.ec.CustomNamedCurves',
'org.bouncycastle.crypto.generators.BCrypt',
'org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator',
'org.bouncycastle.crypto.generators.PKCS5S1ParametersGenerator',
'org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator',
'org.bouncycastle.crypto.macs.HMac',
'org.bouncycastle.crypto.modes.AEADBlockCipher',
'org.bouncycastle.crypto.paddings.BlockCipherPadding',
'org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher',
'org.bouncycastle.crypto.params.AsymmetricKeyParameter',
'org.bouncycastle.crypto.params.DSAKeyParameters',
'org.bouncycastle.crypto.params.DSAParameters',
'org.bouncycastle.crypto.params.DSAPrivateKeyParameters',
'org.bouncycastle.crypto.params.DSAPublicKeyParameters',
'org.bouncycastle.crypto.params.ECDomainParameters',
'org.bouncycastle.crypto.params.ECKeyParameters',
'org.bouncycastle.crypto.params.ECPrivateKeyParameters',
'org.bouncycastle.crypto.params.ECPublicKeyParameters',
// 'org.bouncycastle.crypto.params.KDFParameters',
'org.bouncycastle.crypto.params.KeyParameter',
'org.bouncycastle.crypto.params.RSAKeyParameters',
'org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters',
'org.bouncycastle.crypto.prng.EntropySource',
'org.bouncycastle.crypto.prng.SP800SecureRandom',
'org.bouncycastle.crypto.prng.SP800SecureRandomBuilder',
'org.bouncycastle.crypto.prng.drbg.SP80090DRBG',
'org.bouncycastle.crypto.signers.DSASigner',
'org.bouncycastle.crypto.signers.ECDSASigner',
'org.bouncycastle.crypto.signers.RSADigestSigner',
'org.bouncycastle.crypto.util.PrivateKeyFactory',
'org.bouncycastle.crypto.util.PrivateKeyInfoFactory',
'org.bouncycastle.crypto.util.PublicKeyFactory',
'org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory',
'org.bouncycastle.jcajce.provider.asymmetric.dsa.KeyPairGeneratorSpi',
'org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC',
'org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyPairGeneratorSpi',
'org.bouncycastle.jcajce.provider.asymmetric.util.EC5Util',
'org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil',
// 'org.bouncycastle.jce.ECNamedCurveTable',
// 'org.bouncycastle.jce.spec.ECNamedCurveParameterSpec',
'org.bouncycastle.math.ec.ECFieldElement',
'org.bouncycastle.math.ec.ECPoint',
'org.bouncycastle.openssl.jcajce.JcaPEMWriter',
'org.bouncycastle.operator.jcajce.JcaContentSignerBuilder',
'org.bouncycastle.util.Arrays',
'org.bouncycastle.util.io.Streams',
'org.bouncycastle.cert.X509CertificateHolder',
)

ignoreViolations(
Expand All @@ -402,26 +402,21 @@ tasks.named("thirdPartyAudit").configure {

tasks.named("thirdPartyAudit").configure {
ignoreMissingClasses(
'javax.xml.bind.JAXBContext',
'javax.xml.bind.JAXBElement',
'javax.xml.bind.JAXBException',
'javax.xml.bind.Unmarshaller',
'javax.xml.bind.UnmarshallerHandler',
// Optional dependency of oauth2-oidc-sdk that we don't need since we do not support AES-SIV for JWE
'org.cryptomator.siv.SivMode',
// Optional dependency of nimbus-jose-jwt for handling Ed25519 signatures and ECDH with X25519 (RFC 8037)
'com.google.crypto.tink.subtle.Ed25519Sign',
'com.google.crypto.tink.subtle.Ed25519Sign$KeyPair',
'com.google.crypto.tink.subtle.Ed25519Verify',
'com.google.crypto.tink.subtle.X25519',
'com.google.crypto.tink.subtle.XChaCha20Poly1305',
'com.nimbusds.common.contenttype.ContentType',
'javax.activation.ActivationDataFlavor',
'javax.activation.DataContentHandler',
'javax.activation.DataHandler',
'javax.activation.DataSource',
'javax.activation.FileDataSource',
'javax.activation.FileTypeMap'
'javax.xml.bind.JAXBContext',
'javax.xml.bind.JAXBElement',
'javax.xml.bind.JAXBException',
'javax.xml.bind.Unmarshaller',
'javax.xml.bind.UnmarshallerHandler',
// Optional dependency of oauth2-oidc-sdk that we don't need since we do not support AES-SIV for JWE
'org.cryptomator.siv.SivMode',
'com.nimbusds.common.contenttype.ContentType',
'com.nimbusds.common.contenttype.ContentType$Parameter',
'javax.activation.ActivationDataFlavor',
'javax.activation.DataContentHandler',
'javax.activation.DataHandler',
'javax.activation.DataSource',
'javax.activation.FileDataSource',
'javax.activation.FileTypeMap'
)
}

Expand Down
13 changes: 13 additions & 0 deletions x-pack/plugin/security/lib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This build deserves an explanation. Nimbus-jose-jwt uses gson internally, which is unfriendly
// to our usage of the security manager, to a degree that it makes the library extremely difficult
// to work with safely. The purpose of this build is to create a version of nimbus-jose-jwt with
// a couple classes replaced with wrappers which work with the security manager, the source files
// in this directory.

// Because we want to include the original class files so that we can reference them without
// modification, there are a couple intermediate steps:
// nimbus-jose-jwt-modified-part1: Create a version of the JAR in which the relevant class files are moved to a different package.
// This is not immediately usable as this process rewrites the rest of the JAR to "correctly" reference the new classes. So, we need to...
// nimbus-jose-jwt-modified-part2: Create a JAR from the result of part 1 which contains *only* the relevant class files by removing everything else.
// nimbus-jose-jwt-modified: Use the result of part 2 here, combined with the original library, so that we can use our
// replacement classes which wrap the original class files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

apply plugin: 'elasticsearch.build'
apply plugin: 'com.github.johnrengelman.shadow'

// See the build.gradle file in the parent directory for an explanation of this unusual build

dependencies {
implementation "com.nimbusds:nimbus-jose-jwt:9.37.3"
}

tasks.named('shadowJar').configure {
// Attempting to exclude all of the classes we *don't* move here ought to be possible per the
// shadowJar docs, but actually attempting to do so results in an empty JAR. May be a bug in the shadowJar plugin.
relocate 'com.nimbusds.jose.util.JSONObjectUtils', 'org.elasticsearch.nimbus.jose.util.JSONObjectUtils'
relocate 'com.nimbusds.jose.util.JSONStringUtils', 'org.elasticsearch.nimbus.jose.util.JSONStringUtils'
}

['jarHell', 'thirdPartyAudit', 'forbiddenApisMain', 'splitPackagesAudit', 'licenseHeaders'].each {
tasks.named(it).configure {
enabled = false
}
}

Loading