@debugbundle/sdk-react-native 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## [2.0.0] - 2026-09-21
8
+
9
+ ### Security
10
+
11
+ - Enforce mandatory JavaScript capture protection before and after `beforeSend` and before native bridge calls, including the legacy bridge fallback.
12
+
13
+ ### Changed
14
+
15
+ - Pin the protected Android 2.0.0 and Swift 2.0 release lines and fail the release when any wrapper, bridge, podspec, Android, or smoke-test version drifts.
16
+ - Require published-native Android 17/API 37.0 and Xcode 27/iOS 27 app-delivery gates before npm publication.
17
+
18
+ ## [1.3.0] - 2026-09-12
19
+
20
+ ### Changed
21
+
22
+ - License first-party SDK code under Apache-2.0 and ship consistent package licensing metadata and license text.
23
+ - Use Android1.3.1 with complete packaged Apache licenses and the Apache-2.0 Swift SDK1.3.0.
24
+ - Publish npm releases through GitHub Actions trusted publishing without an npm token.
25
+
7
26
  ## 1.2.0 - 2026-07-29
8
27
 
9
28
  - Preserve React Native SDK identity, original JavaScript error fields, service, correlation, context, probes, and mobile metadata through additive Android and Swift external-event APIs.
@@ -1,8 +1,8 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "DebugBundleReactNative"
3
- s.version = "1.2.0"
3
+ s.version = "2.0.0"
4
4
  s.summary = "React Native wrapper for the DebugBundle mobile SDKs."
5
- s.license = { :type => "AGPL-3.0-only" }
5
+ s.license = { :type => "Apache-2.0", :file => "LICENSE" }
6
6
  s.author = { "DebugBundle" => "support@debugbundle.com" }
7
7
  s.homepage = "https://github.com/debugbundle/debugbundle-react-native"
8
8
  s.source = { :git => "https://github.com/debugbundle/debugbundle-react-native.git", :tag => s.version.to_s }
@@ -12,5 +12,5 @@ Pod::Spec.new do |s|
12
12
 
13
13
  s.dependency "React-Core"
14
14
  install_modules_dependencies(s) if defined?(install_modules_dependencies)
15
- s.dependency "DebugBundle", "~> 1.2"
15
+ s.dependency "DebugBundle", "~> 2.0"
16
16
  end
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -25,9 +25,9 @@ Published implementation:
25
25
  | Lane | Support |
26
26
  | --- | --- |
27
27
  | Minimum compatibility | React Native 0.76+, React 18.2+, iOS 15+, Android minSdk 23 |
28
- | Recommended production | Current stable React Native 0.86.x with Hermes and the New Architecture enabled where your app supports it |
28
+ | Recommended production | Current stable React Native 0.87.x with Hermes and the New Architecture enabled where your app supports it |
29
29
  | Installed-base compatibility | React Native 0.76 through current stable, including legacy bridge apps |
30
- | Rolling CI | TypeScript/package smoke, Android bridge compile on RN 0.76.9, 0.82.1, and 0.85.3, bare iOS compatibility/current-installed-base lanes, plus Expo SDK 57 / RN 0.86 Android and iOS development builds |
30
+ | Rolling CI | TypeScript/package smoke, Android bridge compile on RN 0.76.9, 0.82.1, 0.85.3, and 0.87.1, bare iOS compatibility/current-installed-base lanes, plus Expo SDK 57 / RN 0.86 Android and iOS development builds |
31
31
  | Expo | Expo development builds and prebuild; Expo Go is degraded because it cannot load custom native modules |
32
32
 
33
33
  JSC compatibility is best-effort where the selected React Native lane still supports it. Hermes is the primary tested JavaScript engine.
@@ -141,4 +141,4 @@ checks.
141
141
 
142
142
  ## Release
143
143
 
144
- The package publishes to npm from `v*` tags through GitHub Actions. Configure the repository secret `NPM_TOKEN`, make sure the tag matches `package.json` exactly, for example `v1.2.0`, and push the tag only after the exact Android and Swift native dependency line referenced by this package is available to Maven Central and CocoaPods consumers. The release workflow compiles clean apps against those published artifacts before npm publication.
144
+ The package publishes to npm from `v*` tags through GitHub Actions. Configure an npm GitHub Actions trusted publisher for `debugbundle/debugbundle-react-native` and `release.yml`, with a blank environment and direct `npm publish` enabled. Publishing uses OIDC without a long-lived npm token. Make sure the tag matches `package.json` exactly. The next protected release requires a matching 2.x wrapper/Swift pod line and a published Android 2.x BOM/module pin. `make check-protected-native-pins` refuses the current 1.x source line; update the wrapper version, native pins, and embedded SDK versions together only after the exact Android and Swift artifacts are available to Maven Central and CocoaPods consumers. The release workflow then compiles and runs clean apps against those published artifacts on Android API 37 and Xcode 27 before npm publication.
@@ -11,7 +11,7 @@ if (isReactNativeHostBuild) {
11
11
  def hostKotlinVersion = rootProject.ext.has("kotlinVersion")
12
12
  ? rootProject.ext.get("kotlinVersion")
13
13
  : "2.1.20"
14
- def debugBundleAndroidVersion = rootProject.findProperty("debugBundleAndroidVersion") ?: "1.2.0"
14
+ def debugBundleAndroidVersion = rootProject.findProperty("debugBundleAndroidVersion") ?: "2.0.0"
15
15
 
16
16
  android {
17
17
  namespace "com.debugbundle.reactnative"
@@ -32,7 +32,7 @@ android {
32
32
  }
33
33
 
34
34
  dependencies {
35
- compileOnly "com.facebook.react:react-android:${rootProject.findProperty("reactNativeVersion") ?: "0.85.3"}"
35
+ compileOnly "com.facebook.react:react-android:${rootProject.findProperty("reactNativeVersion") ?: "0.87.1"}"
36
36
  implementation "org.jetbrains.kotlin:kotlin-stdlib:${hostKotlinVersion}"
37
37
  implementation platform("com.debugbundle:debugbundle-android-bom:${debugBundleAndroidVersion}")
38
38
  implementation("com.debugbundle:debugbundle-android") {
@@ -40,7 +40,7 @@ dependencies {
40
40
  exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib-jdk7"
41
41
  exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib-jdk8"
42
42
  }
43
- testImplementation "com.facebook.react:react-android:${rootProject.findProperty("reactNativeVersion") ?: "0.85.3"}"
43
+ testImplementation "com.facebook.react:react-android:${rootProject.findProperty("reactNativeVersion") ?: "0.87.1"}"
44
44
  testImplementation "junit:junit:4.13.2"
45
45
  testImplementation "org.mockito:mockito-core:5.14.2"
46
46
  }
@@ -199,12 +199,12 @@ public final class DebugBundleReactNativeModule extends ReactContextBaseJavaModu
199
199
  }
200
200
  }
201
201
 
202
- private String currentSdkVersion = "1.2.0";
202
+ private String currentSdkVersion = "2.0.0";
203
203
  private String currentService = "react-native-app";
204
204
  private String currentEnvironment = "production";
205
205
 
206
206
  private DebugBundleConfig createConfig(ReadableMap config) {
207
- currentSdkVersion = stringOrDefault(config, "sdkVersion", "1.2.0");
207
+ currentSdkVersion = stringOrDefault(config, "sdkVersion", "2.0.0");
208
208
  currentService = stringOrDefault(config, "service", "react-native-app");
209
209
  currentEnvironment = stringOrDefault(config, "environment", "production");
210
210
  return DebugBundleConfig.create(
package/app.plugin.js CHANGED
@@ -49,4 +49,4 @@ function withAndroidDesugaring(contents) {
49
49
  return next;
50
50
  }
51
51
 
52
- export default createRunOncePlugin(withDebugBundle, "@debugbundle/sdk-react-native", "1.2.0");
52
+ export default createRunOncePlugin(withDebugBundle, "@debugbundle/sdk-react-native", "2.0.0");
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EAEjB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EAIjB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAYpB,qBAAa,4BAA6B,YAAW,iBAAiB;IACpE,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,YAAY,CAAwC;IAC5D,OAAO,CAAC,WAAW,CAAkE;IACrF,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,YAAY,CAAqD;IACzE,OAAO,CAAC,0BAA0B,CAAK;gBAE3B,MAAM,GAAE,iBAAsB;IAO1C,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAED,IAAI,CAAC,MAAM,EAAE,i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EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAS7C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,EAAE,OAAO,GAAE,uBAA4B,GAAG,IAAI;IA4B5F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAWtB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWhE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAcxE,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,GAAE,MAAM,GAAG,IAAW,EAAE,MAAM,SAAqB,GAAG,IAAI;IAWzG,OAAO,CAAC,OAAO;IAiDf,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,0BAA0B;CAInC;AAED,wBAAgB,uBAAuB,CAAC,MAAM,GAAE,iBAAsB,GAAG,4BAA4B,CAEpG;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,yBAAyB,CAsClF"}
package/dist/client.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { getNativeModule, degradedNativeState, safeNativeCall } from "./native.js";
2
2
  import { applyBeforeSend } from "./before-send.js";
3
3
  import { defaultRedactFields, DEFAULT_HEADER_ALLOWLIST, sanitizeHeaders, sanitizeValue } from "./redaction.js";
4
+ import { sanitizeTelemetry } from "./privacy-telemetry.js";
4
5
  const SDK_NAME = "@debugbundle/sdk-react-native";
5
- const DEFAULT_SDK_VERSION = "1.2.0";
6
+ const DEFAULT_SDK_VERSION = "2.0.0";
6
7
  const LOG_LEVELS = {
7
8
  debug: 10,
8
9
  info: 20,
@@ -10,6 +11,37 @@ const LOG_LEVELS = {
10
11
  error: 40,
11
12
  critical: 50
12
13
  };
14
+ function protectEventFields(event, additionalKeys) {
15
+ // Preserve typed identities only when their scalar values pass the mandatory policy.
16
+ for (const value of [event.schema_version, event.sdk_name, event.sdk_version,
17
+ ...Object.values(event.correlation ?? {})]) {
18
+ if (typeof value !== "string")
19
+ continue;
20
+ const checked = sanitizeTelemetry(value, { additionalKeys });
21
+ if (!checked.ok || checked.value !== value)
22
+ return null;
23
+ }
24
+ const result = sanitizeTelemetry({
25
+ service: event.service,
26
+ payload: event.payload,
27
+ ...(event.context ? { context: event.context } : {})
28
+ }, { additionalKeys });
29
+ if (!result.ok || !result.value || typeof result.value !== "object" || Array.isArray(result.value)) {
30
+ return null;
31
+ }
32
+ const safeFields = result.value;
33
+ if (!safeFields.service || !safeFields.payload ||
34
+ typeof safeFields.service !== "object" || Array.isArray(safeFields.service) ||
35
+ typeof safeFields.payload !== "object" || Array.isArray(safeFields.payload)) {
36
+ return null;
37
+ }
38
+ return {
39
+ ...event,
40
+ service: safeFields.service,
41
+ payload: safeFields.payload,
42
+ ...(event.context ? { context: safeFields.context } : {})
43
+ };
44
+ }
13
45
  export class DebugBundleReactNativeClient {
14
46
  config;
15
47
  nativeModule = null;
@@ -216,19 +248,25 @@ export class DebugBundleReactNativeClient {
216
248
  ? { ...payload, device: canonicalDevice(this.nativeState.device, this.config) }
217
249
  : payload
218
250
  };
219
- const event = applyBeforeSend(authoredEvent, this.config.beforeSend);
251
+ const initial = protectEventFields(authoredEvent, this.config.redactFields);
252
+ if (!initial)
253
+ return;
254
+ const event = applyBeforeSend(initial, this.config.beforeSend);
220
255
  if (!event || !localPolicyAllows) {
221
256
  return;
222
257
  }
258
+ const safeEvent = protectEventFields(event, this.config.redactFields);
259
+ if (!safeEvent)
260
+ return;
223
261
  if (!this.nativeModule) {
224
262
  this.nativeState = degradedNativeState("native_module_unavailable");
225
263
  return;
226
264
  }
227
265
  if (this.nativeModule.enqueueCanonicalEvent) {
228
- void safeNativeCall(() => this.nativeModule.enqueueCanonicalEvent(event), undefined);
266
+ void safeNativeCall(() => this.nativeModule.enqueueCanonicalEvent(safeEvent), undefined);
229
267
  }
230
268
  else {
231
- void safeNativeCall(() => this.nativeModule.enqueueEvent(toLegacyNativeEvent(event)), undefined);
269
+ void safeNativeCall(() => this.nativeModule.enqueueEvent(toLegacyNativeEvent(safeEvent)), undefined);
232
270
  }
233
271
  }
234
272
  canCapture(eventType, countTowardSession) {
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_SENSITIVE_KEYS: readonly ["password", "secret", "token", "api_key", "apikey", "access_token", "refresh_token", "private_key", "authorization", "bearer", "cookie", "session_id", "passwd", "ssn", "credit_card", "card_number", "cvv", "cvc", "pin", "expiry", "phone", "otp", "verification_code"];
2
+ export declare function isSensitiveKey(key: string, sensitiveKeys: readonly string[]): boolean;
3
+ //# sourceMappingURL=privacy-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-keys.d.ts","sourceRoot":"","sources":["../src/privacy-keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,qRAKzB,CAAC;AAeX,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAkBrF"}
@@ -0,0 +1,35 @@
1
+ export const DEFAULT_SENSITIVE_KEYS = [
2
+ "password", "secret", "token", "api_key", "apikey", "access_token", "refresh_token",
3
+ "private_key", "authorization", "bearer", "cookie", "session_id", "passwd", "ssn",
4
+ "credit_card", "card_number", "cvv", "cvc", "pin", "expiry", "phone", "otp",
5
+ "verification_code"
6
+ ];
7
+ function canonicalizeSensitiveKey(value) {
8
+ return value.toLowerCase().replace(/[^a-z0-9]+/g, "");
9
+ }
10
+ function splitKeyIntoSegments(key) {
11
+ return key
12
+ .trim()
13
+ .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
14
+ .toLowerCase()
15
+ .split(/[^a-z0-9]+/)
16
+ .filter((segment) => segment.length > 0);
17
+ }
18
+ export function isSensitiveKey(key, sensitiveKeys) {
19
+ const normalized = key.trim().toLowerCase();
20
+ if (sensitiveKeys.includes(normalized)) {
21
+ return true;
22
+ }
23
+ const canonicalSensitiveKeys = new Set(sensitiveKeys.map(canonicalizeSensitiveKey));
24
+ const segments = splitKeyIntoSegments(key);
25
+ for (let start = 0; start < segments.length; start += 1) {
26
+ let combined = "";
27
+ for (let end = start; end < segments.length; end += 1) {
28
+ combined += segments[end];
29
+ if (canonicalSensitiveKeys.has(combined)) {
30
+ return true;
31
+ }
32
+ }
33
+ }
34
+ return false;
35
+ }
@@ -0,0 +1,19 @@
1
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
2
+ [key: string]: JsonValue;
3
+ };
4
+ export interface TelemetrySanitizationOptions {
5
+ additionalKeys?: readonly string[];
6
+ maxTotalBytes?: number;
7
+ }
8
+ export type TelemetrySanitizationResult = {
9
+ ok: true;
10
+ value: JsonValue;
11
+ redactionCount: number;
12
+ } | {
13
+ ok: false;
14
+ reason: "unsafe_input" | "budget_exceeded";
15
+ };
16
+ /** Mandatory telemetry policy; unlike the legacy `redact` helper, custom keys are additive. */
17
+ export declare function sanitizeTelemetry(value: unknown, options?: TelemetrySanitizationOptions): TelemetrySanitizationResult;
18
+ export {};
19
+ //# sourceMappingURL=privacy-telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-telemetry.d.ts","sourceRoot":"","sources":["../src/privacy-telemetry.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAW/F,MAAM,WAAW,4BAA4B;IAC3C,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,2BAA2B,GACnC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAA;CAAE,CAAC;AAyH9D,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,4BAAiC,GAAG,2BAA2B,CA2BzH"}
@@ -0,0 +1,164 @@
1
+ import { DEFAULT_SENSITIVE_KEYS, isSensitiveKey } from "./privacy-keys.js";
2
+ import { scrubCredentialText } from "./privacy-text.js";
3
+ const REDACTED = "[REDACTED]";
4
+ const MAX_DEPTH = 16;
5
+ const MAX_NODES = 4096;
6
+ const MAX_ENTRIES = 256;
7
+ const MAX_STRING_BYTES = 16 * 1024;
8
+ const MAX_TOTAL_BYTES = 256 * 1024;
9
+ class BudgetExceeded extends Error {
10
+ }
11
+ function byteLength(value) {
12
+ let bytes = 0;
13
+ for (let index = 0; index < value.length; index += 1) {
14
+ const code = value.charCodeAt(index);
15
+ if (code < 0x80)
16
+ bytes += 1;
17
+ else if (code < 0x800)
18
+ bytes += 2;
19
+ else if (code >= 0xd800 && code <= 0xdbff && index + 1 < value.length &&
20
+ value.charCodeAt(index + 1) >= 0xdc00 && value.charCodeAt(index + 1) <= 0xdfff) {
21
+ bytes += 4;
22
+ index += 1;
23
+ }
24
+ else
25
+ bytes += 3;
26
+ }
27
+ return bytes;
28
+ }
29
+ function mask(state) {
30
+ state.redactionCount += 1;
31
+ return REDACTED;
32
+ }
33
+ function sanitizeString(value, state, allowStructured) {
34
+ if (value.length > MAX_STRING_BYTES)
35
+ return mask(state);
36
+ const length = byteLength(value);
37
+ if (length > MAX_STRING_BYTES)
38
+ return mask(state);
39
+ state.textBytes += length;
40
+ if (state.textBytes > state.maxTotalBytes)
41
+ throw new BudgetExceeded();
42
+ if (allowStructured && (value.startsWith("{") || value.startsWith("["))) {
43
+ try {
44
+ const parsed = JSON.parse(value);
45
+ if (typeof parsed === "object" && parsed !== null) {
46
+ const nested = sanitizeValue(parsed, state, 0, false);
47
+ const encoded = JSON.stringify(nested);
48
+ if (encoded !== value)
49
+ state.redactionCount += 1;
50
+ return encoded;
51
+ }
52
+ }
53
+ catch (error) {
54
+ if (error instanceof BudgetExceeded)
55
+ throw error;
56
+ // Malformed structured content with a recognizable sensitive label is withheld below.
57
+ }
58
+ }
59
+ const result = scrubCredentialText(value, state.extra);
60
+ if (result !== value)
61
+ state.redactionCount += 1;
62
+ if ((value.startsWith("{") || value.startsWith("[")) && result === value &&
63
+ /(?:password|token|secret|authorization|cookie)["']?\s*[:=]/i.test(value)) {
64
+ return mask(state);
65
+ }
66
+ return result;
67
+ }
68
+ function sanitizeValue(value, state, depth, allowStructured) {
69
+ state.nodes += 1;
70
+ if (state.nodes > MAX_NODES)
71
+ throw new BudgetExceeded();
72
+ if (depth > MAX_DEPTH)
73
+ return mask(state);
74
+ if (typeof value === "string")
75
+ return sanitizeString(value, state, allowStructured);
76
+ if (value === null || typeof value === "boolean")
77
+ return value;
78
+ if (typeof value === "number" && Number.isFinite(value))
79
+ return value;
80
+ if (typeof value !== "object")
81
+ throw new TypeError("unsafe_input");
82
+ if (state.seen.has(value))
83
+ return "[Circular]";
84
+ state.seen.add(value);
85
+ try {
86
+ if (Array.isArray(value)) {
87
+ if (value.length > MAX_ENTRIES)
88
+ return mask(state);
89
+ return Array.from({ length: value.length }, (_, index) => {
90
+ const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
91
+ if (descriptor === undefined || !("value" in descriptor))
92
+ throw new TypeError("unsafe_input");
93
+ return sanitizeValue(descriptor.value, state, depth + 1, allowStructured);
94
+ });
95
+ }
96
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
97
+ throw new TypeError("unsafe_input");
98
+ }
99
+ const keys = Object.keys(value);
100
+ if (keys.length > MAX_ENTRIES)
101
+ return mask(state);
102
+ const result = {};
103
+ for (const key of keys) {
104
+ if (key.length > 128) {
105
+ state.redactionCount += 1;
106
+ continue;
107
+ }
108
+ state.textBytes += byteLength(key);
109
+ if (state.textBytes > state.maxTotalBytes)
110
+ throw new BudgetExceeded();
111
+ const safeKey = scrubCredentialText(key, state.extra);
112
+ if (safeKey !== key) {
113
+ state.redactionCount += 1;
114
+ continue;
115
+ }
116
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
117
+ if (descriptor === undefined || !("value" in descriptor))
118
+ throw new TypeError("unsafe_input");
119
+ const safeValue = isSensitiveKey(key, state.keys)
120
+ ? mask(state)
121
+ : sanitizeValue(descriptor.value, state, depth + 1, allowStructured);
122
+ Object.defineProperty(result, key, {
123
+ value: safeValue,
124
+ enumerable: true,
125
+ configurable: true,
126
+ writable: true
127
+ });
128
+ }
129
+ return result;
130
+ }
131
+ finally {
132
+ state.seen.delete(value);
133
+ }
134
+ }
135
+ /** Mandatory telemetry policy; unlike the legacy `redact` helper, custom keys are additive. */
136
+ export function sanitizeTelemetry(value, options = {}) {
137
+ try {
138
+ const extra = options.additionalKeys ?? [];
139
+ if (extra.length > 128 || extra.some((key) => typeof key !== "string" || key.length > 64 || !key.trim())) {
140
+ return { ok: false, reason: "unsafe_input" };
141
+ }
142
+ const maxTotalBytes = options.maxTotalBytes ?? MAX_TOTAL_BYTES;
143
+ if (!Number.isInteger(maxTotalBytes) || maxTotalBytes < 1 || maxTotalBytes > 512 * 1024) {
144
+ return { ok: false, reason: "unsafe_input" };
145
+ }
146
+ const state = {
147
+ nodes: 0,
148
+ textBytes: 0,
149
+ redactionCount: 0,
150
+ seen: new WeakSet(),
151
+ keys: [...DEFAULT_SENSITIVE_KEYS, ...extra],
152
+ extra,
153
+ maxTotalBytes
154
+ };
155
+ const sanitized = sanitizeValue(value, state, 0, true);
156
+ if (byteLength(JSON.stringify(sanitized)) > maxTotalBytes) {
157
+ return { ok: false, reason: "budget_exceeded" };
158
+ }
159
+ return { ok: true, value: sanitized, redactionCount: state.redactionCount };
160
+ }
161
+ catch (error) {
162
+ return { ok: false, reason: error instanceof BudgetExceeded ? "budget_exceeded" : "unsafe_input" };
163
+ }
164
+ }
@@ -0,0 +1,3 @@
1
+ /** Bounded caller input only. Returns stable replacement text, never the matching secret. */
2
+ export declare function scrubCredentialText(input: string, additionalKeys: readonly string[], scanUrls?: boolean): string;
3
+ //# sourceMappingURL=privacy-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-text.d.ts","sourceRoot":"","sources":["../src/privacy-text.ts"],"names":[],"mappings":"AAyDA,6FAA6F;AAC7F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,UAAO,GAAG,MAAM,CA2B7G"}