Skip to content
Snippets Groups Projects

Iss #109 - Add fix for too long user agent strings

Merged Martin Lowe requested to merge malowe/master/109 into main
1 file
+ 4
0
Compare changes
  • Side-by-side
  • Inline
@@ -109,6 +109,10 @@ public class DistributedCSRFGenerator extends DefaultCSRFGenerator {
// get the markers used to identify a user (outside of a unique session ID)
String ipAddr = getClientIpAddress(httpServletRequest);
String userAgent = httpServletRequest.getHeader(HttpHeaderNames.USER_AGENT);
// Iss #109 - Truncate the value if it's too long to keep table entries managable
if (userAgent.length() > 255) {
userAgent = userAgent.substring(0, 250);
}
Principal user = httpServletRequest.getUserPrincipal();
MultivaluedMap<String, String> params = new MultivaluedMapImpl<>();
params.add(IP_PARAM, ipAddr);
Loading