8000 docs: add section for secure error reporting · Issue #6153 · trpc/trpc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

docs: add section for secure error reporting #6153

Open
1 task done
SimonSimCity opened this issue Oct 25, 2024 · 1 comment
Open
1 task done

docs: add section for secure error reporting #6153

SimonSimCity opened this issue Oct 25, 2024 · 1 comment
Labels
✅ accepted-PRs-welcome Feature proposal is accepted and ready to work on 📚 documentation / examples Improvements or additions to documentation

Comments

@SimonSimCity
Copy link
SimonSimCity commented Oct 25, 2024

Area of Improvement

By default, the errors sent from the backend to the client are quite verbose. This might be good for prototyping an app, but I wouldn't like this to stay for a production app, specially because OWASP mentions this as a security flaw: https://owasp.org/www-community/Improper_Error_Handling

The docs should contain a section where one could see a best-practice of how errors should be dealt with. I would expect for any unknown exception to just return a common error message like "Internal Server Error" and hand it over to an exception handler (default implementation could just log it out to the console, other implementations like Sentry could pick it up by providing a middleware), whereby other errors, which are request-related, should just contain the error itself, but not a stacktrace or any direct sign e.g. showing that I use zod for input-validation.

I'm not very familiar with what all is possible or implemented but have briefly looked at https://www.jsonrpc.org/specification#error_object and https://trpc.io/docs/server/error-formatting.

A good starting point would be if someone could point me to where and how the individual error-codes reported by JSON-RPC are determined, and I can come up with something that we could add to the docs as a first draft people could decide on how they want things to be.

Link to related docs

https://trpc.io/docs/server/error-handling

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing the suggested changes!

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@SimonSimCity SimonSimCity added the 📚 documentation / examples Improvements or additions to documentation label Oct 25, 2024
@KATT KATT added the ✅ accepted-PRs-welcome Feature proposal is accepted and ready to work on label Oct 25, 2024
@KATT
Copy link
Member
KATT commented Oct 25, 2024

We strip the stack in dev mode by default, but yeah, we could document this stuff better. Open for PRs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ accepted-PRs-welcome Feature proposal is accepted and ready to work on 📚 documentation / examples Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants
0