@sailfish-ai/recorder 1.0.0-beta-12 → 1.0.0-beta-14

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/README.md ADDED
@@ -0,0 +1 @@
1
+ # JS/TS Record-Only Package
package/dist/recording.js CHANGED
@@ -5,8 +5,37 @@ import { initializeWebSocket } from "./websocket";
5
5
  const MASK_CLASS = "sailfishSanitize";
6
6
  const DEFAULT_DOMAINS_TO_IGNORE = [];
7
7
  function maskInputFn(text, node) {
8
- // The maskInputFn logic here
9
- return text; // Placeholder return
8
+ // Exclude input[type=hidden] fields
9
+ if (node.type === "hidden") {
10
+ return "";
11
+ }
12
+ const patterns = {
13
+ creditCard: /\b(?:\d[ -]*?){13,16}\b/,
14
+ ssn: /\b\d{3}-\d{2}-\d{4}\b/,
15
+ };
16
+ const MASK_CLASS = "mask"; // Assume this is a known constant
17
+ // Check for data attributes indicating sensitive information
18
+ // Check if element or parents have MASK_CLASS in their className
19
+ if (node.closest(`.${MASK_CLASS}`)) {
20
+ // Mask the input and retain the length of the input
21
+ return "*".repeat(text.length);
22
+ }
23
+ else if (node.hasAttribute("data-cc") ||
24
+ (node.getAttribute("autocomplete")?.startsWith("cc-") ?? false) ||
25
+ patterns.creditCard.test(text)) {
26
+ // Mask all but the last 4 digits of a credit card number
27
+ return "**** **** **** " + text.slice(-4);
28
+ }
29
+ else if (node.hasAttribute("data-ssn") || patterns.ssn.test(text)) {
30
+ // Mask the first 5 digits of an SSN
31
+ return "***-**-" + text.slice(-4);
32
+ }
33
+ else if (node.hasAttribute("data-dob")) {
34
+ // Mask the day and month of a date of birth, revealing only the year
35
+ return "**/**/" + text.slice(-4);
36
+ }
37
+ // Default to returning the original text
38
+ return text;
10
39
  }
11
40
  export async function initializeRecording(captureSettings, // TODO - Sibyl post-launch - replace type
12
41
  consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
@@ -20453,7 +20453,7 @@ var ReconnectingWebSocket = (
20453
20453
  return ReconnectingWebSocket2;
20454
20454
  }()
20455
20455
  );
20456
- const version = "1.0.0-beta-12";
20456
+ const version = "1.0.0-beta-14";
20457
20457
  function initializeWebSocket(backendApi, apiKey, sessionId) {
20458
20458
  const wsHost = getWebSocketHost(backendApi);
20459
20459
  const wsScheme = window.location.protocol === "https:" ? "wss" : "ws";
@@ -20471,6 +20471,24 @@ function getWebSocketHost(url) {
20471
20471
  }
20472
20472
  const MASK_CLASS = "sailfishSanitize";
20473
20473
  function maskInputFn(text, node2) {
20474
+ var _a2;
20475
+ if (node2.type === "hidden") {
20476
+ return "";
20477
+ }
20478
+ const patterns = {
20479
+ creditCard: /\b(?:\d[ -]*?){13,16}\b/,
20480
+ ssn: /\b\d{3}-\d{2}-\d{4}\b/
20481
+ };
20482
+ const MASK_CLASS2 = "mask";
20483
+ if (node2.closest(`.${MASK_CLASS2}`)) {
20484
+ return "*".repeat(text.length);
20485
+ } else if (node2.hasAttribute("data-cc") || (((_a2 = node2.getAttribute("autocomplete")) == null ? void 0 : _a2.startsWith("cc-")) ?? false) || patterns.creditCard.test(text)) {
20486
+ return "**** **** **** " + text.slice(-4);
20487
+ } else if (node2.hasAttribute("data-ssn") || patterns.ssn.test(text)) {
20488
+ return "***-**-" + text.slice(-4);
20489
+ } else if (node2.hasAttribute("data-dob")) {
20490
+ return "**/**/" + text.slice(-4);
20491
+ }
20474
20492
  return text;
20475
20493
  }
20476
20494
  async function initializeRecording(captureSettings, consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
@@ -20457,7 +20457,7 @@
20457
20457
  return ReconnectingWebSocket2;
20458
20458
  }()
20459
20459
  );
20460
- const version = "1.0.0-beta-12";
20460
+ const version = "1.0.0-beta-14";
20461
20461
  function initializeWebSocket(backendApi, apiKey, sessionId) {
20462
20462
  const wsHost = getWebSocketHost(backendApi);
20463
20463
  const wsScheme = window.location.protocol === "https:" ? "wss" : "ws";
@@ -20475,6 +20475,24 @@
20475
20475
  }
20476
20476
  const MASK_CLASS = "sailfishSanitize";
20477
20477
  function maskInputFn(text, node2) {
20478
+ var _a2;
20479
+ if (node2.type === "hidden") {
20480
+ return "";
20481
+ }
20482
+ const patterns = {
20483
+ creditCard: /\b(?:\d[ -]*?){13,16}\b/,
20484
+ ssn: /\b\d{3}-\d{2}-\d{4}\b/
20485
+ };
20486
+ const MASK_CLASS2 = "mask";
20487
+ if (node2.closest(`.${MASK_CLASS2}`)) {
20488
+ return "*".repeat(text.length);
20489
+ } else if (node2.hasAttribute("data-cc") || (((_a2 = node2.getAttribute("autocomplete")) == null ? void 0 : _a2.startsWith("cc-")) ?? false) || patterns.creditCard.test(text)) {
20490
+ return "**** **** **** " + text.slice(-4);
20491
+ } else if (node2.hasAttribute("data-ssn") || patterns.ssn.test(text)) {
20492
+ return "***-**-" + text.slice(-4);
20493
+ } else if (node2.hasAttribute("data-dob")) {
20494
+ return "**/**/" + text.slice(-4);
20495
+ }
20478
20496
  return text;
20479
20497
  }
20480
20498
  async function initializeRecording(captureSettings, consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailfish-ai/recorder",
3
- "version": "1.0.0-beta-12",
3
+ "version": "1.0.0-beta-14",
4
4
  "publishPublicly": true,
5
5
  "main": "dist/sailfish-recorder.umd.js",
6
6
  "types": "dist/types/index.d.ts",