Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7983

JweClientResponseFilter fails to decrypt response, when it has status 204 No Content

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.4, 3.3.0
    • 3.2.9, 3.3.2
    • JAX-RS Security
    • None
    • Unknown

    Description

      JweClientResponseFilter fails to decrypt response, when it has status 204 No Content
      For my current project I am trying to get familiar with the cxf JOSE framework. Currently I am running into a problem with JWE trying to encrypt request and response with compact serialization. I have a GET request where the response is correctly encrypted and decrypted, and I have a POST request where the response sends status code 204 and the body is obviously empty.
      The response fails with a warning "WARNUNG: 5 JWE parts are expected" and an exception
      org.apache.cxf.rs.security.jose.jwe.JweException: INVALID_COMPACT_JWE
          at org.apache.cxf.rs.security.jose.jwe.JweCompactConsumer.<init>(JweCompactConsumer.java:40)
          at org.apache.cxf.rs.security.jose.jaxrs.AbstractJweDecryptingFilter.decrypt(AbstractJweDecryptingFilter.java:44)
          at org.apache.cxf.rs.security.jose.jaxrs.JweClientResponseFilter.filter(JweClientResponseFilter.java:42)
      ...
      Test case and test log with exception are attached.
      I debugged the code a bit and it seems to me the filter method in JweClientResponseFilter fails to identify the body is empty and therefor calls the decrypt method, which it shouldn't

       

      I ran the test case using 3.2.4 and 3.3.0, but also other versions will be affected.

      Attachments

        1. EmptyInputStream-screenshot.png
          118 kB
          Jan Bernhardt
        2. test-output.txt
          18 kB
          Zsolt Beothy-Elo
        3. encryption-exception.zip
          31 kB
          Zsolt Beothy-Elo

        Activity

          People

            ashakirin Andrei Shakirin
            zbeothy Zsolt Beothy-Elo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: