MindscapeHQ / raygun4cfml

Raygun.io client for Cold Fusion
Other
12 stars 15 forks source link

Bug in applyFilter function in RaygunClient.cfc #62

Closed gedas20 closed 2 hours ago

gedas20 commented 8 hours ago

There is a bug in the applyFilter function in the RaygunClient.cfc file. The issue is with the structFindKey function call, which only searches one level deep in the structure. This causes the function to miss nested keys that need to be filtered.

Steps to Reproduce: Use the applyFilter function with a nested structure in messageData. Pass a filter that matches keys at deeper levels of the structure. Observe that the keys at deeper levels are not being filtered.

Expected Behavior: The applyFilter function should search all levels of the structure and replace the keys that match the filter.

Actual Behavior: The applyFilter function only searches one level deep, missing nested keys.

Proposed Solution: Modify the structFindKey function call to include the "all" parameter, allowing it to search all levels of the structure.

customUserDataStruct={ key1 = { password = "secret" }, key2 = { password = "secret" } } customUserData = createObject("nz.co.ventego-creative.raygun4cfml.RaygunUserCustomData").init(customUserDataStruct); contentFilter = [{filter = "password", replacement = "password"}]; contentFilter = createObject("nz.co.ventego-creative.raygun4cfml.RaygunContentFilter").init(contentFilter); raygun = createObject("component","nz.co.ventego-creative.raygun4cfml.RaygunClient").init( apiKey = variables.RAYGUNAPIKEY, contentFilter = contentFilter ); result = raygun.send(issueDataStruct=error,userCustomData=customUserData);

TheRealAgentK commented 6 hours ago

Thanks for reporting this,. @gedas20 - I can see where and how that is happening.

There'll be a fix in the next couple of day forthcoming.

TheRealAgentK commented 2 hours ago

Fixed in https://github.com/TheRealAgentK/raygun4cfml/pull/6

There'll be a release later today or tomorrow, @gedas20