mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
Sanitize error payloads more thoroughly
This commit is contained in:
parent
5ce930f0d0
commit
1582ef4a5c
@ -1,5 +1,6 @@
|
||||
# Current
|
||||
|
||||
- [ ] Await publish, show error if it fails or times out
|
||||
- [ ] Fix initial relay loading, don't nuke people's relay lists
|
||||
- [ ] Add a nuclear bypass with a warning, after we fail to find anything
|
||||
|
||||
|
@ -75,9 +75,15 @@ export const modal = {
|
||||
},
|
||||
}
|
||||
|
||||
// Redact long strings, especially hex and bech32 keys which are 64 and 63
|
||||
// characters long, respectively. Put the threshold a little lower in case
|
||||
// someone accidentally enters a key with the last few digits missing
|
||||
const redactErrorInfo = info =>
|
||||
JSON.parse(JSON.stringify(info) .replace(/\w{60}\w+/g, '[REDACTED]'))
|
||||
|
||||
// Wait for bugsnag to be started in main
|
||||
setTimeout(() => {
|
||||
Bugsnag.addOnError(event => {
|
||||
Bugsnag.addOnError((event: any) => {
|
||||
if (window.location.host.startsWith('localhost')) {
|
||||
return false
|
||||
}
|
||||
@ -86,6 +92,13 @@ setTimeout(() => {
|
||||
return false
|
||||
}
|
||||
|
||||
// Redact individual properties since the event needs to be
|
||||
// mutated, and we don't want to lose the prototype
|
||||
event.context = redactErrorInfo(event.context)
|
||||
event.request = redactErrorInfo(event.request)
|
||||
event.exceptions = redactErrorInfo(event.exceptions)
|
||||
event.breadcrumbs = redactErrorInfo(event.breadcrumbs)
|
||||
|
||||
event.setUser(session)
|
||||
|
||||
return true
|
||||
@ -107,3 +120,4 @@ export const logUsage = async name => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user