@sailfish-ai/recorder 1.0.0-beta-11 → 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
@@ -1,13 +1,41 @@
1
1
  import { record } from "@sailfish-rrweb/record";
2
2
  import { getRecordConsolePlugin, } from "@sailfish-rrweb/rrweb-plugin-console-record";
3
- import { getRecordNetworkPlugin, } from "@sailfish-rrweb/rrweb-plugin-network-record";
4
3
  import { cacheEvents, sendRecordingEvents } from "./eventCache";
5
4
  import { initializeWebSocket } from "./websocket";
6
5
  const MASK_CLASS = "sailfishSanitize";
7
6
  const DEFAULT_DOMAINS_TO_IGNORE = [];
8
7
  function maskInputFn(text, node) {
9
- // The maskInputFn logic here
10
- 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;
11
39
  }
12
40
  export async function initializeRecording(captureSettings, // TODO - Sibyl post-launch - replace type
13
41
  consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
@@ -18,7 +46,7 @@ consoleRecordSettings, networkRecordSettings, backendApi, apiKey, sessionId) {
18
46
  },
19
47
  plugins: [
20
48
  getRecordConsolePlugin(consoleRecordSettings),
21
- getRecordNetworkPlugin(networkRecordSettings),
49
+ // getRecordNetworkPlugin(networkRecordSettings),
22
50
  ],
23
51
  maskInputOptions: { text: true }, // Fix the incorrect property name
24
52
  maskInputFn,