MindscapeHQ / raygun4java

Java SDK for the Raygun service
https://raygun.com
MIT License
24 stars 21 forks source link

Implement request data filtering for RaygunServletClient #31

Closed Paxa closed 6 years ago

Paxa commented 9 years ago

Problem: Currently raygun4java will send all POST and GET parameters, that may contain passwords, credit card numbers, and other sensitive information.

I implement filtering for request data before it being send.

How to use:

class MyRaygunServletFilter extends RaygunServletFilter {

    public void filter (RaygunMessage message) {
        RaygunRequestMessage request = ((RaygunServletMessage) message).getDetails().getRequest();

        if (request.form.get("password") != null) {
            request.form.put("password", "[FILTERED]");
        }

        if (request.form.get("password_confirmation") != null) {
            request.form.put("password_confirmation", "[FILTERED]");
        }

        if (request.form.get("credit_card_number") != null) {
            request.form.put("credit_card_number", "[FILTERED]");
        }
    }
}

// in your error handing

MyRaygunServletFilter fitler = new MyRaygunServletFilter();
RaygunServletClient client = new RaygunServletClient(RAYGUN_KEY, request, fitler);
client.Send(exception);
Paxa commented 8 years ago

@fundead Any thoughts?

fundead commented 8 years ago

Hi Pavel,

Apologies for the delay in the response to this PR, it got missed, and thanks for your work on this one. This PR does look good and brings this provider in line with the others regarding request filtering. There's a couple of things to add before getting this out in a release, including a unit test or two and documentation updates. We'd be happy to add these in the near term, internally we have a couple of large upcoming releases so I won't be able to add these right away but if you wanted to update this PR with them I can get it merged and released quicker.

Regards,

Callum Gavin Raygun Limited

jscottnz commented 6 years ago

superseded by https://github.com/MindscapeHQ/raygun4java/pull/48

Paxa commented 6 years ago

Thanks!