fix(nswitch): Mark crashes synthetic so titles fall back to the crashing function - #6253
Conversation
The native crash helpers are only compiled with the processing feature (pub use self::native::* is cfg-gated), so calling reshape_switch_crash unconditionally broke the default-features build (E0425). Wrap the call in if_processing! like the minidump path, and guard the now-conditional mut binding.
…cking Item::attachment_type can return NintendoSwitchDyingMessage from an explicitly set item header, bypassing the starts_with(magic) guard used when inferring the type. expand_dying_message then called Bytes::advance past the payload length, which panics and crashes the processing worker (DoS). Validate the magic up front and return an error instead. Reported by Warden wrdn-dos-review.
| let envelope = r#"{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc","dsn":"https://e12d836b15bb49d7bbf99e64295d995b:@sentry.io/42"} | ||
| {"type":"event"} | ||
| {"level":"error","exception":{"values":[{"type":"2168-0002 ResultAccessViolationData","value":"Data access to an invalid memory region was performed. (2: Access Violation Data)","stacktrace":{"frames":[{"function":"ASentryTowerTurret::Shoot"}]}}]}} | ||
| {"type":"attachment","filename":"dying_message.dat","length":<len>} | ||
| "# |
There was a problem hiding this comment.
Q: we have this "fake" json envelope constructed here, but we could add a test with an actual captured one from our switch-SDK integration tests. Not sure if this is somehow not advised?
There was a problem hiding this comment.
From Ingest's perspective there's no problem using a captured envelope.
There was a problem hiding this comment.
@loewenheim I added fixtures captured from our own CI tests passing through a local relay in ef999f2 ; I'm not sure if there is a cleaner pattern to 'get' those files into the test (the ../../../ doesn't look that clean 🥲 )
A raw capture of what CRPortal actually delivers (via an Import Destination pointed at a local Relay) showed the forwarded event already carries mechanism.handled: false and level: fatal. The error level seen on stored events comes from the DyingMessage scope patch winning the merge, not from Nintendo. Remove the redundant handled write and correct the reshape docs, test premise, and changelog accordingly: synthetic remains the title fix, and the level write re-asserts the severity the merge downgraded. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
we want to roll this out instead of making the change for every single sentry-switch user at once; probably in phases (ourselves -> select customers -> everyone). @mujacica are you familiar with setting up feature flags for this kind of thing? (if not, I can look into it) |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6c2c1d0. Configure here.
loewenheim
left a comment
There was a problem hiding this comment.
I have some nits, otherwise this looks good
| let envelope = r#"{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc","dsn":"https://e12d836b15bb49d7bbf99e64295d995b:@sentry.io/42"} | ||
| {"type":"event"} | ||
| {"level":"error","exception":{"values":[{"type":"2168-0002 ResultAccessViolationData","value":"Data access to an invalid memory region was performed. (2: Access Violation Data)","stacktrace":{"frames":[{"function":"ASentryTowerTurret::Shoot"}]}}]}} | ||
| {"type":"attachment","filename":"dying_message.dat","length":<len>} | ||
| "# |
There was a problem hiding this comment.
From Ingest's perspective there's no problem using a captured envelope.
Co-authored-by: Sebastian Zivota <loewenheim@users.noreply.github.com>
To be merged after the related relay PR getsentry/relay#6253 Merge after this: related options-automator PR getsentry/sentry-options-automator#9446

Switch crash events are titled with Nintendo's raw abort result code (e.g.
2168-0002 ResultAccessViolationData), hiding the crashing function and burying real regressions in a sea of identical-looking titles (getsentry/sentry-switch#153).This PR marks the exception
synthetic, the same treatment minidumps get viawrite_native_placeholder, so Sentry falls back to the symbolicated crashing function for the title. The result code stays queryable onexception.typeand themechanismtag. It also re-assertslevel: fatal— Nintendo forwards crashes as fatal, but the DyingMessage scope patch is the merge base and downgrades it toerror— and hardens dying-message parsing against a panic on payloads shorter than the magic number.Validated end-to-end against a real CRPortal-forwarded crash (captured by pointing a CRPortal Import Destination at a local Relay in processing mode): before → title
2168-0002 ResultAccessViolationData: …, after → titlennMain, level fatal. Details on the original issue.Event before fix:
https://sentry-sdks.sentry.io/issues/7671819961/?project=4509910938550273&query=is%3Aunresolved&referrer=issue-stream&sort=recommended
Event after fix:
https://sentry-sdks.sentry.io/issues/7671893807/?project=4509910938550273&query=is%3Aunresolved&referrer=issue-stream&sort=recommended
Related PRs:
sentry- getsentry/sentry#123020options-automator- https://github.com/getsentry/sentry-options-automator/pull/9446