We use an ESAPI security layer in our application. We also, by design, use a '%' character for wildcard searches passed from the browser side. This is a poor choice and has carried over as legacy design for easily constructing the sql to run on the backend.
Now, a '%' character in input is rejected by the ESAPI validator to prevent double encoding attacks. We are actively pursuing the idea to replace the '%' by something like '*'. But for the interim, to enable use of '%' for wildcard searches, we are weighing our options among these options:
1) Turning off the ESAPI canonicalizer. (Bad idea, leaves hole for double encoding.)
2) In the security layer, replace all '%' by some unlikely character right before the filter pass. Then change back. (Folks have different opinions on this; some think this is as good as having no defense for a double encoding attack, other think it has some value.)
3) In the front-end app, let the user input '%', but substitute them by '*' before submitting to the server. Will need to manipulate the '*' as '%' again in the DAO layer. Will require the most code changes in all UI code that can take the wildcard input.
Would like to invite answers on how to best solve this. Appreciate any help.