mod-securitymod-security2

Use requestBodyProcessor after base64Decode


ModSecurity allows us to use different request body processors (e.g. for XML or JSON). My question is, is it possible to first decode a body that holds a base64 encoded string

eyJuYW1lIjoiSm9obiIsICJhZ2UiOjI1fQ==

which translates to

{"name":"John", "age":25}

and after that use requestBodyProcessor=JSON?

I tried different rules with transformations and so on, but couldn't get it to work.


Solution

  • Unfortunately, this isn't possible, because:

    There IS a way how to achieve what you need but it's a little complex and not backward compatible with existing rules using parsed JSON data. You can do this: