@veolab/discoverylab 1.1.1 → 1.2.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.
Files changed (60) hide show
  1. package/dist/chunk-2OGZX6C4.js +588 -0
  2. package/dist/chunk-43U6UYV7.js +590 -0
  3. package/dist/chunk-4H2E3K2G.js +7638 -0
  4. package/dist/chunk-4KLG6DDE.js +334 -0
  5. package/dist/chunk-4NNTRJOI.js +7791 -0
  6. package/dist/chunk-5F76VWME.js +6397 -0
  7. package/dist/chunk-5NEFN42O.js +7791 -0
  8. package/dist/chunk-63MEQ6UH.js +7673 -0
  9. package/dist/chunk-C7QUR7XX.js +6397 -0
  10. package/dist/chunk-GGJJUCFK.js +7160 -0
  11. package/dist/chunk-GLHOY3NN.js +7805 -0
  12. package/dist/chunk-GSWHWEYC.js +1346 -0
  13. package/dist/chunk-HDKEQOF5.js +7788 -0
  14. package/dist/chunk-HZGSWVVS.js +7111 -0
  15. package/dist/chunk-I6YD3QFM.js +500 -0
  16. package/dist/chunk-KV7KDJ43.js +7639 -0
  17. package/dist/chunk-L4SA5F5W.js +6397 -0
  18. package/dist/chunk-MJS2YKNR.js +6397 -0
  19. package/dist/chunk-NDBW6ELQ.js +7638 -0
  20. package/dist/chunk-P4S7ZY6G.js +7638 -0
  21. package/dist/chunk-PMTGGZ7R.js +6397 -0
  22. package/dist/chunk-PYUCY3U6.js +1340 -0
  23. package/dist/chunk-RDZDSOAL.js +7750 -0
  24. package/dist/chunk-SLNJEF32.js +91 -0
  25. package/dist/chunk-SR67SRIT.js +1336 -0
  26. package/dist/chunk-TAODYZ52.js +1393 -0
  27. package/dist/chunk-TBG76CYG.js +6395 -0
  28. package/dist/chunk-TJ3H23LL.js +362 -0
  29. package/dist/chunk-XIBF5LBD.js +6395 -0
  30. package/dist/chunk-XUKWS2CE.js +7805 -0
  31. package/dist/cli.js +6 -6
  32. package/dist/db-ADBEBNH6.js +35 -0
  33. package/dist/index.d.ts +170 -1
  34. package/dist/index.html +1019 -84
  35. package/dist/index.js +9 -7
  36. package/dist/playwright-ATDC4NYW.js +38 -0
  37. package/dist/playwright-E6EUFIJG.js +38 -0
  38. package/dist/playwright-R7Y5HREH.js +39 -0
  39. package/dist/server-2VKO76UK.js +14 -0
  40. package/dist/server-3BK2VFU7.js +13 -0
  41. package/dist/server-6IPHVUYT.js +14 -0
  42. package/dist/server-73P7M3QB.js +14 -0
  43. package/dist/server-BPVRW5LJ.js +14 -0
  44. package/dist/server-IOOZK4NP.js +14 -0
  45. package/dist/server-NPZN3FWO.js +14 -0
  46. package/dist/server-O5FIAHSY.js +14 -0
  47. package/dist/server-P27BZXBL.js +14 -0
  48. package/dist/server-S6B5WUBT.js +14 -0
  49. package/dist/server-SRYNSGSP.js +14 -0
  50. package/dist/server-X3TLP6DX.js +14 -0
  51. package/dist/server-ZBPQ33V6.js +14 -0
  52. package/dist/setup-AQX4JQVR.js +17 -0
  53. package/dist/tools-2KPB37GK.js +178 -0
  54. package/dist/tools-3H6IOWXV.js +178 -0
  55. package/dist/tools-BUVCUCRL.js +178 -0
  56. package/dist/tools-HDNODRS6.js +178 -0
  57. package/dist/tools-L6PKKQPY.js +179 -0
  58. package/dist/tools-N5N2IO7V.js +178 -0
  59. package/dist/tools-TLCKABUW.js +178 -0
  60. package/package.json +1 -1
@@ -0,0 +1,91 @@
1
+ // src/core/security/sensitiveInput.ts
2
+ function normalizeHint(value) {
3
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
4
+ }
5
+ function buildHintText(context) {
6
+ if (!context) return "";
7
+ return [
8
+ normalizeHint(context.actionType),
9
+ normalizeHint(context.selector),
10
+ normalizeHint(context.description),
11
+ normalizeHint(context.fieldHint)
12
+ ].filter(Boolean).join(" ");
13
+ }
14
+ function looksLikeEmail(value) {
15
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
16
+ }
17
+ function looksLikeCpf(value) {
18
+ const digits = value.replace(/\D/g, "");
19
+ return digits.length === 11 && /^(\d{3}\.?\d{3}\.?\d{3}-?\d{2})$/.test(value);
20
+ }
21
+ function looksLikeCnpj(value) {
22
+ const digits = value.replace(/\D/g, "");
23
+ return digits.length === 14 && /^(\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2})$/.test(value);
24
+ }
25
+ function looksLikePhone(value) {
26
+ const digits = value.replace(/\D/g, "");
27
+ if (digits.length < 10 || digits.length > 13) return false;
28
+ return /^\+?[\d\s().-]+$/.test(value);
29
+ }
30
+ function looksLikeMaskedPassword(value) {
31
+ return /^[*•●·]+$/.test(value);
32
+ }
33
+ function looksLikeNumericCode(value) {
34
+ const digits = value.replace(/\D/g, "");
35
+ return digits.length >= 4 && digits.length <= 8 && digits === value.trim();
36
+ }
37
+ function hasAny(hint, patterns) {
38
+ return patterns.some((pattern) => pattern.test(hint));
39
+ }
40
+ function redactSensitiveTestInput(rawValue, context) {
41
+ if (typeof rawValue !== "string") return rawValue;
42
+ const value = rawValue.trim();
43
+ if (!value) return rawValue;
44
+ const hint = buildHintText(context);
45
+ const digits = value.replace(/\D/g, "");
46
+ const passwordHint = hasAny(hint, [/\bpassword\b/, /\bsenha\b/, /\bpasscode\b/, /\bsecret\b/]);
47
+ if (passwordHint || looksLikeMaskedPassword(value)) {
48
+ return "${PASSWORD}";
49
+ }
50
+ const tokenHint = hasAny(hint, [/\btoken\b/, /\bapi[-_ ]?key\b/, /\bbearer\b/]);
51
+ if (tokenHint && value.length >= 6) {
52
+ return "${SECRET}";
53
+ }
54
+ const emailHint = hasAny(hint, [/\bemail\b/, /\be-mail\b/]);
55
+ if (emailHint || looksLikeEmail(value)) {
56
+ return "${EMAIL}";
57
+ }
58
+ const cpfHint = hasAny(hint, [/\bcpf\b/, /\bdocumento\b/]);
59
+ if (cpfHint && digits.length === 11 || looksLikeCpf(value)) {
60
+ return "${CPF}";
61
+ }
62
+ const cnpjHint = hasAny(hint, [/\bcnpj\b/]);
63
+ if (cnpjHint && digits.length === 14 || looksLikeCnpj(value)) {
64
+ return "${CNPJ}";
65
+ }
66
+ const otpHint = hasAny(hint, [/\botp\b/, /\b2fa\b/, /\bpin\b/, /\bverification\b/, /\bcodigo\b/, /\bcódigo\b/, /\bcode\b/]);
67
+ if (otpHint && looksLikeNumericCode(value)) {
68
+ return hint.includes("pin") ? "${PIN}" : "${OTP_CODE}";
69
+ }
70
+ const phoneHint = hasAny(hint, [/\bphone\b/, /\btelefone\b/, /\bcelular\b/, /\bwhats(app)?\b/, /\btel\b/]);
71
+ if (phoneHint && digits.length >= 8 && digits.length <= 13 || looksLikePhone(value)) {
72
+ return "${PHONE}";
73
+ }
74
+ const usernameHint = hasAny(hint, [/\busername\b/, /\buser\b/, /\blogin\b/]);
75
+ if (usernameHint) {
76
+ return "${USERNAME}";
77
+ }
78
+ return rawValue;
79
+ }
80
+ function redactQuotedStringsInText(rawText, context) {
81
+ if (typeof rawText !== "string" || !rawText) return rawText;
82
+ return rawText.replace(/"([^"]*)"/g, (_match, quoted) => {
83
+ const redacted = redactSensitiveTestInput(String(quoted), context);
84
+ return `"${redacted}"`;
85
+ });
86
+ }
87
+
88
+ export {
89
+ redactSensitiveTestInput,
90
+ redactQuotedStringsInText
91
+ };