Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a processor to remove all stacktraces from reported exceptions #429

Merged

Conversation

ste93cry
Copy link
Collaborator

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes

This PR implements a processor that removes all stacktraces from reported exceptions. Its code is a direct porting of the processor added to the Ruby client with getsentry/sentry-ruby#233

@dcramer
Copy link
Member

dcramer commented Mar 13, 2017

tbh im not sure why we allowed this in ruby -- this basically breaks any good behavior within Sentry, and probably was accepted because someone kept complaining that they "needed" it. I'd rather just say "dont use Sentry if you just want shitty logs", rather than pretending the app is at all usable without stacktraces. I do think we can support "dont store source code", but we sitll need filenames, function names, and line numbers.

/cc @nateberkopec

@ste93cry
Copy link
Collaborator Author

While I agree with you, as specified above this is just a porting of a feature that's available on the Ruby client. It seems that that SDK is the most maintained, so I think until this processor is there it should also be here. Also, I think a user should still be able to do whatever he wants, including not sending stacktraces to Sentry

@dcramer
Copy link
Member

dcramer commented Mar 13, 2017

@ste93cry except then that user emails support and asks why nothing works. I dont disagree that users should have choice, but you can use Sentry, or you can use logs. To use Sentry you need stacks. I'm also going to talk internally about deprecating/removing this from the Ruby SDK since it will cause the same concerns. In general filenames/etc should not be sensitive, and I'd bet the original reason for it was to remove source code (and it was the easiest way).

@ste93cry
Copy link
Collaborator Author

ste93cry commented Mar 13, 2017

except then that user emails support and asks why nothing works

Why should the user complain that your product doesn't work because it doesn't show stacktraces if the processor is not enabled by default and won't be anyway even in a 2.x version of this package... Also, please take a look at this article about why this processor could not be so useless in the end.

@nateberkopec
Copy link

nateberkopec commented Mar 14, 2017

It seems that that SDK is the most maintained

yyeeeeee boiiii thx :)

please take a look at this article about why this processor could not be so useless in the end.

"To the user" being the operative words in that question. Events are transmitted over SSL to Sentry, there is no information leak to persons outside the organization.

Also, I think a user should still be able to do whatever he wants, including not sending stacktraces to Sentry

Then they can write their own processor. It's super easy, at least in the Ruby SDK.

I do think we can support "dont store source code", but we sitll need filenames, function names, and line numbers.

I can modify the Ruby processor to do this.

Here's a recap of the arguments in favor of this feature: getsentry/sentry-ruby#130

"You're okay with sharing your source code with 3rd party services?" we said, on GitHub.

IMO we might be better off just documenting how to write your own processors (it's trivial) and letting users take care of themselves.

@ste93cry
Copy link
Collaborator Author

+1 on making this a processor included in the repo, but not on by default.

This is what you voted on getsentry/sentry-ruby#130. I agree with that phrase, there is no disadvantage in having this processor available to users of your SDK, mostly because it's anyway turned off by default

@nateberkopec
Copy link

It's what I said 3 years ago to try and close an issue that was dragging on too long, raised by people who are probably not even Sentry users.

As I also said at the end of that issue, it's unclear to me exactly what data people think is a security concern. The current processor is like a flamethrower - it indiscriminately wipes out all data relating to the source. @dcramer has already proposed a processor which only wipes the actual source code but keeps line numbers/everything else intact.

I'll re-paste the data we're talking about here for clarity:

{"abs_path"=>"/Users/nateberkopec/Documents/code/raven-ruby/spec/raven/processors/removestacktrace_spec.rb",
        "function"=>"block (2 levels) in <top (required)>",
        "pre_context"=>["  end\n", "\n", "  it 'should remove stacktraces' do\n"],
        "post_context"=>
         ["    binding.pry\n", "    expect(data['exception']['stacktrace']).to_not eq(nil)\n", "    result = @processor.process(data)\n"],
        "context_line"=>"    data = Raven::Event.capture_exception(build_exception).to_hash\n",
        "lineno"=>12,
        "in_app"=>false,
        "filename"=>"raven/processors/removestacktrace_spec.rb"}

So, instead of removing all of this, we could remove pre_, post_, and context_line.

@ste93cry
Copy link
Collaborator Author

As I also said at the end of that issue, it's unclear to me exactly what data people think is a security concern.

According to the article and according to the people that were complaining about security on that issue I think their concern is that showing anything that include source code to third-parties is an information leak. While I agree with this statement, I also agree on that a product like Sentry is totally useless without that informations.

So, instead of removing all of this, we could remove pre_, post_, and context_line

If everyone agree on this, I can make the changes to do it and rename this processor to something like SanitizeStacktraceProcessor. To make everyone happy, we could even make it configurable, so users can decide whether they want to remove everything or only those parts of the stacktrace.

@dcramer
Copy link
Member

dcramer commented Mar 24, 2017

I'd agree that both here (and eventually as a standard), we should provide a way to strip the source code context, but not the entire stacktrace (for the reasons stated).

@ste93cry
Copy link
Collaborator Author

Should I make it configurable, so that users can choose whether to strip just pre_context, post_context or context_line or should the processor just remove all of them when enabled? Honestly, I think there should be no need to just remove only one of them, but asking is always better 😄

@ste93cry ste93cry force-pushed the feature/remove-stacktrace-processor branch 2 times, most recently from 7ac62fd to 4bef2a7 Compare March 24, 2017 14:12
@dcramer
Copy link
Member

dcramer commented Mar 24, 2017 via email

@ste93cry ste93cry force-pushed the feature/remove-stacktrace-processor branch from 4bef2a7 to ff41be6 Compare March 24, 2017 15:53
@ste93cry
Copy link
Collaborator Author

Then PR is ready and tests are green

@dcramer dcramer merged commit b19982a into getsentry:master Mar 24, 2017
@dcramer
Copy link
Member

dcramer commented Mar 24, 2017

Thanks!

@ste93cry ste93cry deleted the feature/remove-stacktrace-processor branch March 24, 2017 16:05
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.

None yet

3 participants