Skip to content

Conversation

paulstatezny
Copy link
Contributor

The docs for Sentry.PlugCapture reference the custom :scrubber option for use Sentry.PlugCapture:

a term of type {module, function, args} that will be invoked to scrub sensitive data from Plug.Conn structs.

However, when you provide {module, function, args} as instructed:

use Sentry.PlugCapture, scrubber: {MyModule, :scrub_conn, []}

You get this compilation error:

== Compilation error in file my_endpoint.ex ==
** (ArgumentError) expected :scrubber to be a {module, function, args} tuple, got: {:{}, [line: 4], [MyModule, :scrub_conn, []]}

This PR removes the Macro.escape that was causing this.

@paulstatezny
Copy link
Contributor Author

You can reproduce the compilation error by running the test against the code in master.

@whatyouhide
Copy link
Collaborator

Ah, great catch, thank you @paulstatezny 💟

@whatyouhide whatyouhide merged commit f62d101 into getsentry:master Dec 23, 2023
@paulstatezny paulstatezny deleted the ps/custom-scrubber branch December 23, 2023 15:24
@paulstatezny
Copy link
Contributor Author

paulstatezny commented Dec 23, 2023

@whatyouhide Thank you!

Question: I intended to use this feature to redact certain segments of certain URLs. But it seems the URL passed to Sentry uses the original conn, not the scrubbed one.

Do you have a recommendation for redacting sensitive URL segments? I know it's an odd case. Would you be open to a PR that adds a URL scrubber similar to the header / body / param scrubbers?

@whatyouhide
Copy link
Collaborator

Yes absolutely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants