Skip to content

Can't remove all compression algorithms #996

Open
@amichair

Description

@amichair

Describe the bug
In our application we have a system property that enabled/disables compression support for JWS. In the old codebase (0.11.5) there was a custom CompressionCodecResolver that checks the flag, and either delegates to one of the built-in compressions or throws an exception stating that compression is not supported.

In the new codebase (0.12.6) this has been deprecated in favor of using JwtParserBuilder.zip(). There are two issues here:

  1. Calling JwtParserBuilder.zip().clear() to remove all compression algorithm results in "java.lang.IllegalArgumentException: Collection of Identifiable instances may not be null or empty.", so there's no way to disable all of them.
  2. It is no longer possible to have one piece of code to handle all compressions (e.g. throw the exception if disabled). The workaround is to create individual custom CompressionAlgorithm for DEF and GZIP that replace the built-in ones and throw an unsupported exception in each one if necessary, but this is quite cumbersome and still doesn't allow handling of any other unknown compression ID.

To Reproduce
Invoke JwtParserBuilder.zip().clear()

Expected behavior
All compression algorithms are removed to disable compression altogether.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions