fix(nswitch): Mark crashes synthetic so titles fall back to the crashing function - #6253
fix(nswitch): Mark crashes synthetic so titles fall back to the crashing function#6253mujacica wants to merge 9 commits into
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?
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.
| // crash on other platforms: fall the title back to the crashing function and render the | ||
| // event as a fatal, unhandled crash. Normalization runs after this and preserves it. | ||
| utils::if_processing!(ctx, { | ||
| if let Some(event) = event.value_mut() && ctx.processing.project_info.has_feature(Feature::NintendoEventRewrite) { |
There was a problem hiding this comment.
Reshape test ignores feature flag
Medium Severity
The rewrite is now gated on NintendoEventRewrite, but test_switch_crash_is_reshaped still uses a default test Context with no features enabled. reshape_switch_crash never runs, so the assertions on level and mechanism.synthetic fail.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 6c2c1d0. Configure here.


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