Skip to content

[CI] Upgrade YAML tests fail with javax.crypto.IllegalBlockSizeException #29890

@elasticmachine

Description

@elasticmachine

Original comment by @polyfractal:

A triplet of upgrade yaml tests seem to be failing all with the same IllegalBlockSizeException, and it looks they they are only happening on release CI builds at the moment. This triplet LINK REDACTED,time:(from:now-30d,mode:quick,to:now))&_a=(columns:!(_source),index:'build-*',interval:auto,query:(query_string:(analyze_wildcard:!t,query:javax.crypto.IllegalBlockSizeException)),sort:!(process.time-start,desc))) but I couldn't see any particular change that may have caused it.

The most recent failure was on 6.x, but it seems to be happening on master too. I'm not sure if it is relevant, but all the failures were on Java 9.0.4+11

LINK REDACTED

Tagging @elastic/es-security to start, although I'm not really sure if this is a security issue or something wonky with the release process/build.

The relevant exception:

Caused by: java.lang.IllegalStateException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
	at org.elasticsearch.license.CryptUtils.decrypt(CryptUtils.java:182)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:116)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:72)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:71)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:101)
	at org.elasticsearch.license.LicenseService.registerLicense(LicenseService.java:196)
	at 

Full stack trace from the tests:

{
  "stash" : {
    "body" : {
      "error" : {
        "root_cause" : [
          {
            "type" : "illegal_state_exception",
            "reason" : "javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher",
            "stack_trace" : "[javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher]; nested: IllegalStateException[javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher]; nested: IllegalBlockSizeException[Input length must be multiple of 16 when decrypting with padded cipher];
	at org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:640)
	at org.elasticsearch.ElasticsearchException.generateFailureXContent(ElasticsearchException.java:585)
	at org.elasticsearch.rest.BytesRestResponse.build(BytesRestResponse.java:138)
	at org.elasticsearch.rest.BytesRestResponse.<init>(BytesRestResponse.java:96)
	at org.elasticsearch.rest.BytesRestResponse.<init>(BytesRestResponse.java:91)
	at org.elasticsearch.rest.action.RestActionListener.onFailure(RestActionListener.java:58)
	at org.elasticsearch.action.support.TransportAction$1.onFailure(TransportAction.java:91)
	at org.elasticsearch.action.support.ContextPreservingActionListener.onFailure(ContextPreservingActionListener.java:50)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$1.onFailure(TransportMasterNodeAction.java:160)
	at org.elasticsearch.action.ActionRunnable.onFailure(ActionRunnable.java:42)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:657)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
	at org.elasticsearch.license.CryptUtils.decrypt(CryptUtils.java:182)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:116)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:72)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:71)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:101)
	at org.elasticsearch.license.LicenseService.registerLicense(LicenseService.java:196)
	at org.elasticsearch.license.TransportPutLicenseAction.masterOperation(TransportPutLicenseAction.java:64)
	at org.elasticsearch.license.TransportPutLicenseAction.masterOperation(TransportPutLicenseAction.java:33)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction.masterOperation(TransportMasterNodeAction.java:88)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$2.doRun(TransportMasterNodeAction.java:167)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:672)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	... 3 more
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:936)
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847)
	at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
	at javax.crypto.Cipher.doFinal(Cipher.java:2164)
	at org.elasticsearch.license.CryptUtils.decrypt(CryptUtils.java:180)
	... 14 more"
          }
        ],
        "type" : "illegal_state_exception",
        "reason" : "javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher",
        "caused_by" : {
          "type" : "illegal_block_size_exception",
          "reason" : "Input length must be multiple of 16 when decrypting with padded cipher",
          "stack_trace" : "javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:936)
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847)
	at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
	at javax.crypto.Cipher.doFinal(Cipher.java:2164)
	at org.elasticsearch.license.CryptUtils.decrypt(CryptUtils.java:180)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:116)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:72)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:71)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:101)
	at org.elasticsearch.license.LicenseService.registerLicense(LicenseService.java:196)
	at org.elasticsearch.license.TransportPutLicenseAction.masterOperation(TransportPutLicenseAction.java:64)
	at org.elasticsearch.license.TransportPutLicenseAction.masterOperation(TransportPutLicenseAction.java:33)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction.masterOperation(TransportMasterNodeAction.java:88)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$2.doRun(TransportMasterNodeAction.java:167)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:672)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)"
        },
        "stack_trace" : "java.lang.IllegalStateException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
	at org.elasticsearch.license.CryptUtils.decrypt(CryptUtils.java:182)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:116)
	at org.elasticsearch.license.CryptUtils.readEncryptedPublicKey(CryptUtils.java:72)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:71)
	at org.elasticsearch.license.LicenseVerifier.verifyLicense(LicenseVerifier.java:101)
	at org.elasticsearch.license.LicenseService.registerLicense(LicenseService.java:196)
	at org.elasticsearch.license.TransportPutLicenseAction.masterOperation(TransportPutLicenseAction.java:64)
	at org.elasticsearch.license.TransportPutLicenseAction.masterOperation(TransportPutLicenseAction.java:33)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction.masterOperation(TransportMasterNodeAction.java:88)
	at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$2.doRun(TransportMasterNodeAction.java:167)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:672)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:936)
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:847)
	at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
	at javax.crypto.Cipher.doFinal(Cipher.java:2164)
	at org.elasticsearch.license.CryptUtils.decrypt(CryptUtils.java:180)
	... 14 more"
      },
      "status" : 500
    }
  }
}]
REPRODUCE WITH: ./gradlew :x-pack-elasticsearch:plugin:integTestRunner \
  -Dtests.seed=1765FEF2C5106B9 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=upgrade/10_basic/Upgrade test - should fail as index is already up to date}" \
  -Dtests.security.manager=true \
  -Dbuild.snapshot=false \
  -Dtests.jvm.argline="-Dbuild.snapshot=false" \
  -Dtests.locale=ar-LB \
  -Dtests.timezone=AET \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*,xpack/15_basic/*,license/20_put_license/*

REPRODUCE WITH: ./gradlew :x-pack-elasticsearch:plugin:integTestRunner \
  -Dtests.seed=1765FEF2C5106B9 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=upgrade/10_basic/Upgrade info - all}" \
  -Dtests.security.manager=true \
  -Dbuild.snapshot=false \
  -Dtests.jvm.argline="-Dbuild.snapshot=false" \
  -Dtests.locale=ar-LB \
  -Dtests.timezone=AET \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*,xpack/15_basic/*,license/20_put_license/*

REPRODUCE WITH: ./gradlew :x-pack-elasticsearch:plugin:integTestRunner \
  -Dtests.seed=1765FEF2C5106B9 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=upgrade/10_basic/Upgrade test - wait_for_completion:false}" \
  -Dtests.security.manager=true \
  -Dbuild.snapshot=false \
  -Dtests.jvm.argline="-Dbuild.snapshot=false" \
  -Dtests.locale=ar-LB \
  -Dtests.timezone=AET \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*,xpack/15_basic/*,license/20_put_license/*

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Security/LicenseLicense functionality for commercial features>test-failureTriaged test failures from CI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions