keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
392 stars 109 forks source link

bug(ios/engine): Sentry breadcrumbs leaking too much info #3998

Closed darcywong00 closed 3 years ago

darcywong00 commented 3 years ago

Seen in Sentry log https://sentry.keyman.com/organizations/keyman/issues/1977

We need to filter breadcrumbs in Sentry for KMW embedded to avoid navigation that reports keystroke events.

References https://docs.sentry.io/platforms/javascript/enriching-events/breadcrumbs/#customize-breadcrumbs

jahorton commented 3 years ago

This is not a concern for the iOS app. For reference: https://sentry.keyman.com/share/issue/6e899b94dbb4468183e949938f799b6d/

The Script Error breadcrumbs are from other errors generated during investigation of this issue. I created a test keyboard, with handwritten script, here: sil_web_keyboard_error.kmp.zip

The custom code:

    this.g0 = function(t, e) {
        var k = KeymanWeb;
        if (this.inputCount == 0) {
            k.KO(0, t, "Further keypresses will generate errors.");
            this.inputCount++;
            return 1;
        } else {
            throw "Intentional error from keyboard (for testing error-handling code)";
        }
    }

In essence, one keypress will be handled, and any further keypresses will produce errors.

This is the part of code that receives feedback from JS:

https://github.com/keymanapp/keyman/blob/c2dc32bc7954d4ec578bf6b10717926d0c74a705/ios/engine/KMEI/KeymanEngine/Classes/KeymanWebViewController.swift#L367-L370

Note that no related fragments appear in the generated Sentry log's report.