cyberchef 10.23.0 → 11.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.
Files changed (50) hide show
  1. package/.devcontainer/devcontainer.json +1 -1
  2. package/.nvmrc +1 -1
  3. package/CHANGELOG.md +79 -0
  4. package/CONTRIBUTING.md +4 -1
  5. package/Dockerfile +2 -2
  6. package/Gruntfile.js +3 -17
  7. package/README.md +3 -3
  8. package/babel.config.js +4 -1
  9. package/package.json +31 -27
  10. package/src/core/ChefWorker.js +1 -1
  11. package/src/core/Recipe.mjs +1 -1
  12. package/src/core/config/Categories.json +2 -1
  13. package/src/core/config/OperationConfig.json +54 -3
  14. package/src/core/config/modules/Default.mjs +2 -0
  15. package/src/core/config/scripts/fixCryptoApiImports.mjs +54 -0
  16. package/src/core/config/scripts/fixSnackBarMarkup.mjs +28 -0
  17. package/src/core/lib/Extract.mjs +5 -0
  18. package/src/core/lib/Magic.mjs +1 -1
  19. package/src/core/lib/ParityBit.mjs +50 -0
  20. package/src/core/operations/AnalyseUUID.mjs +109 -6
  21. package/src/core/operations/ExtractEmailAddresses.mjs +2 -3
  22. package/src/core/operations/FromPunycode.mjs +1 -1
  23. package/src/core/operations/ParityBit.mjs +128 -0
  24. package/src/core/operations/RegularExpression.mjs +2 -1
  25. package/src/core/operations/RenderMarkdown.mjs +35 -4
  26. package/src/core/operations/ShowBase64Offsets.mjs +28 -28
  27. package/src/core/operations/ToPunycode.mjs +1 -1
  28. package/src/core/operations/index.mjs +2 -0
  29. package/src/node/NodeRecipe.mjs +8 -7
  30. package/src/node/api.mjs +4 -4
  31. package/src/node/index.mjs +5 -0
  32. package/src/web/HTMLOperation.mjs +8 -2
  33. package/src/web/html/index.html +1 -1
  34. package/src/web/index.js +2 -2
  35. package/src/web/static/sitemap.mjs +1 -1
  36. package/src/web/waiters/OperationsWaiter.mjs +30 -13
  37. package/tests/lib/wasmFetchPolyfill.mjs +31 -0
  38. package/tests/node/consumers/cjs-consumer.js +2 -2
  39. package/tests/node/consumers/esm-consumer.mjs +2 -2
  40. package/tests/node/tests/Categories.mjs +2 -2
  41. package/tests/node/tests/nodeApi.mjs +55 -58
  42. package/tests/node/tests/operations.mjs +2 -3
  43. package/tests/operations/index.mjs +6 -0
  44. package/tests/operations/tests/AnalyseUUID.mjs +66 -0
  45. package/tests/operations/tests/Base64.mjs +11 -0
  46. package/tests/operations/tests/ExtractEmailAddresses.mjs +38 -12
  47. package/tests/operations/tests/Fernet.mjs +18 -3
  48. package/tests/operations/tests/ParityBit.mjs +147 -0
  49. package/tests/operations/tests/RegularExpression.mjs +75 -0
  50. package/tests/operations/tests/RenderMarkdown.mjs +110 -0
@@ -11,44 +11,70 @@ TestRegister.addTests([
11
11
  {
12
12
  name: "Extract email address",
13
13
  input: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com email@example.name\nemail@example.museum email@example.co.jp firstname-lastname@example.com",
14
- expectedOutput: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
14
+ expectedOutput:
15
+ "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
15
16
  recipeConfig: [
16
17
  {
17
- "op": "Extract email addresses",
18
- "args": [false]
18
+ op: "Extract email addresses",
19
+ args: [false],
19
20
  },
20
21
  ],
21
22
  },
22
23
  {
23
24
  name: "Extract email address - Display total",
24
25
  input: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com email@example.name\nemail@example.museum email@example.co.jp firstname-lastname@example.com",
25
- expectedOutput: "Total found: 11\n\nemail@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
26
+ expectedOutput:
27
+ "Total found: 11\n\nemail@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
26
28
  recipeConfig: [
27
29
  {
28
- "op": "Extract email addresses",
29
- "args": [true]
30
+ op: "Extract email addresses",
31
+ args: [true],
30
32
  },
31
33
  ],
32
34
  },
33
35
  {
34
36
  name: "Extract email address (Internationalized)",
35
37
  input: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9 \u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c \u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc Jos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com and Jos\u1ec5Silva@google.com\nFoO@BaR.CoM, john@192.168.10.100\ng\xf3mez@junk.br and Abc.123@example.com.\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
36
- expectedOutput: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
38
+ expectedOutput:
39
+ "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
37
40
  recipeConfig: [
38
41
  {
39
- "op": "Extract email addresses",
40
- "args": [false]
42
+ op: "Extract email addresses",
43
+ args: [false],
41
44
  },
42
45
  ],
43
46
  },
44
47
  {
45
48
  name: "Extract email address - Display total (Internationalized)",
46
49
  input: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9 \u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c \u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc Jos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com and Jos\u1ec5Silva@google.com\nFoO@BaR.CoM, john@192.168.10.100\ng\xf3mez@junk.br and Abc.123@example.com.\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
47
- expectedOutput: "Total found: 19\n\n\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
50
+ expectedOutput:
51
+ "Total found: 19\n\n\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
48
52
  recipeConfig: [
49
53
  {
50
- "op": "Extract email addresses",
51
- "args": [true]
54
+ op: "Extract email addresses",
55
+ args: [true],
56
+ },
57
+ ],
58
+ },
59
+ {
60
+ name: "Extract email address - IP address",
61
+ input: "yaunwfkb\nexample@[127.0.0.1]\n091nvka",
62
+ expectedOutput: "example@[127.0.0.1]",
63
+ recipeConfig: [
64
+ {
65
+ op: "Extract email addresses",
66
+ args: [false],
67
+ },
68
+ ],
69
+ },
70
+ {
71
+ name: "Extract email address - invalid IP address",
72
+ input: "yaunwfkb\nfalse_positive@[1.2.3.]\n091nvka",
73
+ expectedOutput: "",
74
+ recipeConfig: [
75
+ {
76
+ op: "Extract email addresses",
77
+ args: [false],
52
78
  },
53
79
  ],
54
80
  },
@@ -5,7 +5,7 @@
5
5
  * @copyright Karsten Silkenbäumer 2019
6
6
  * @license Apache-2.0
7
7
  */
8
- import TestRegister from "../TestRegister";
8
+ import TestRegister from "../../lib/TestRegister.mjs";
9
9
 
10
10
  TestRegister.addTests([
11
11
  {
@@ -47,7 +47,7 @@ TestRegister.addTests([
47
47
  {
48
48
  name: "Fernet Encrypt: no input",
49
49
  input: "",
50
- expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
50
+ expectedMatch: /^gAAA[\w-]+={0,2}$/,
51
51
  recipeConfig: [
52
52
  {
53
53
  op: "Fernet Encrypt",
@@ -69,12 +69,27 @@ TestRegister.addTests([
69
69
  {
70
70
  name: "Fernet Encrypt: valid arguments",
71
71
  input: "This is a secret message.\n",
72
- expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
72
+ expectedMatch: /^gAAA[\w-]+={0,2}$/,
73
73
  recipeConfig: [
74
74
  {
75
75
  op: "Fernet Encrypt",
76
76
  args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
77
77
  }
78
78
  ],
79
+ },
80
+ {
81
+ name: "Fernet Encrypt/Decrypt: round trip",
82
+ input: "This is a secret message.\n",
83
+ expectedOutput: "This is a secret message.\n",
84
+ recipeConfig: [
85
+ {
86
+ op: "Fernet Encrypt",
87
+ args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
88
+ },
89
+ {
90
+ op: "Fernet Decrypt",
91
+ args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
92
+ },
93
+ ],
79
94
  }
80
95
  ]);
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Parity Bit tests
3
+ *
4
+ * @author j83305 [awz22@protonmail.com]
5
+ * @copyright Crown Copyright 2020
6
+ * @license Apache-2.0
7
+ */
8
+ import TestRegister from "../../lib/TestRegister.mjs";
9
+
10
+ TestRegister.addTests([
11
+ {
12
+ name: "Parity bit encode in even parity, 1 block of binary of arbitrary length, prepend, even number of 1s",
13
+ input: "01010101 10101010",
14
+ expectedOutput: "001010101 10101010",
15
+ recipeConfig: [
16
+ {
17
+ "op": "Parity Bit",
18
+ "args": [
19
+ "Even Parity",
20
+ "Start",
21
+ "Encode",
22
+ ""
23
+ ]
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ name: "Parity bit encode in even parity, 1 block of binary of arbitrary length, prepend, odd number of 1s",
29
+ input: "01010101 10101011",
30
+ expectedOutput: "101010101 10101011",
31
+ recipeConfig: [
32
+ {
33
+ "op": "Parity Bit",
34
+ "args": [
35
+ "Even Parity",
36
+ "Start",
37
+ "Encode",
38
+ ""
39
+ ]
40
+ }
41
+ ]
42
+ },
43
+ {
44
+ name: "Parity bit encode in even parity, 1 block of binary of arbitrary length, append, odd number of 1s",
45
+ input: "01010101 10101011",
46
+ expectedOutput: "01010101 101010111",
47
+ recipeConfig: [
48
+ {
49
+ "op": "Parity Bit",
50
+ "args": [
51
+ "Even Parity",
52
+ "End",
53
+ "Encode",
54
+ ""
55
+ ]
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ name: "Parity bit encode in odd parity, 1 block of binary of arbitrary length, prepend, even number of 1s",
61
+ input: "01010101 10101010",
62
+ expectedOutput: "101010101 10101010",
63
+ recipeConfig: [
64
+ {
65
+ "op": "Parity Bit",
66
+ "args": [
67
+ "Odd Parity",
68
+ "Start",
69
+ "Encode",
70
+ ""
71
+ ]
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ name: "Parity bit encode in odd parity, 1 block of binary of arbitrary length, prepend, odd number of 1s",
77
+ input: "01010101 10101011",
78
+ expectedOutput: "001010101 10101011",
79
+ recipeConfig: [
80
+ {
81
+ "op": "Parity Bit",
82
+ "args": [
83
+ "Odd Parity",
84
+ "Start",
85
+ "Encode",
86
+ ""
87
+ ]
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ name: "Parity bit encode in odd parity, 1 block of binary of arbitrary length, append, odd number of 1s",
93
+ input: "01010101 10101011",
94
+ expectedOutput: "01010101 101010110",
95
+ recipeConfig: [
96
+ {
97
+ "op": "Parity Bit",
98
+ "args": [
99
+ "Odd Parity",
100
+ "End",
101
+ "Encode",
102
+ ""
103
+ ]
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ name: "Parity bit encode in even parity, binary for 'hello world!', prepend to each byte",
109
+ input: "hello world!",
110
+ expectedOutput: "101101000 001100101 001101100 001101100 001101111 100100000 001110111 001101111 001110010 001101100 101100100 000100001",
111
+ recipeConfig: [
112
+ {
113
+ "op": "To Binary",
114
+ "args": ["Space"]
115
+ },
116
+ {
117
+ "op": "Parity Bit",
118
+ "args": [
119
+ "Even Parity",
120
+ "Start",
121
+ "Encode",
122
+ " "
123
+ ]
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ name: "Parity bit encode in odd parity, binary for 'hello world!', append to each byte",
129
+ input: "hello world!",
130
+ expectedOutput: "011010000 011001011 011011001 011011001 011011111 001000000 011101111 011011111 011100101 011011001 011001000 001000011",
131
+ recipeConfig: [
132
+ {
133
+ "op": "To Binary",
134
+ "args": ["Space"]
135
+ },
136
+ {
137
+ "op": "Parity Bit",
138
+ "args": [
139
+ "Odd Parity",
140
+ "End",
141
+ "Encode",
142
+ " "
143
+ ]
144
+ }
145
+ ]
146
+ },
147
+ ]);
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Regular Expression tests.
3
+ *
4
+ * @author C85297 [95289555+C85297@users.noreply.github.com]
5
+ * @copyright Crown Copyright 2017
6
+ * @license Apache-2.0
7
+ */
8
+ import TestRegister from "../../lib/TestRegister.mjs";
9
+ import { EMAIL_REGEX } from "../../../src/core/lib/Extract.mjs";
10
+
11
+ TestRegister.addTests([
12
+ {
13
+ name: "Regular Expression - built in email regex - IP address",
14
+ input: "yaunwfkb\nexample@[127.0.0.1]\n091nvka",
15
+ expectedOutput: "example@[127.0.0.1]",
16
+ recipeConfig: [
17
+ {
18
+ op: "Regular expression",
19
+ args: [
20
+ "Email address",
21
+ EMAIL_REGEX.source,
22
+ true,
23
+ true,
24
+ false,
25
+ false,
26
+ false,
27
+ false,
28
+ "List matches",
29
+ ],
30
+ },
31
+ ],
32
+ },
33
+ {
34
+ name: "Regular Expression - built in email regex - invalid IP address",
35
+ input: "yaunwfkb\nfalse_positive@[1.2.3.]\n091nvka",
36
+ expectedOutput: "",
37
+ recipeConfig: [
38
+ {
39
+ op: "Regular expression",
40
+ args: [
41
+ "Email address",
42
+ EMAIL_REGEX.source,
43
+ true,
44
+ true,
45
+ false,
46
+ false,
47
+ false,
48
+ false,
49
+ "List matches",
50
+ ],
51
+ },
52
+ ],
53
+ },
54
+ {
55
+ name: "Regular Expression - built in email regex - IPv4 from #2318",
56
+ input: "user@[1.2.3.4]\ntest@[192.168.0.1]\nno-match@[1.2.3.]",
57
+ expectedOutput: "user@[1.2.3.4]\ntest@[192.168.0.1]",
58
+ recipeConfig: [
59
+ {
60
+ op: "Regular expression",
61
+ args: [
62
+ "Email address",
63
+ EMAIL_REGEX.source,
64
+ true,
65
+ true,
66
+ false,
67
+ false,
68
+ false,
69
+ false,
70
+ "List matches",
71
+ ],
72
+ },
73
+ ],
74
+ },
75
+ ]);
@@ -0,0 +1,110 @@
1
+ /**
2
+ * RenderMarkdown tests.
3
+ *
4
+ * @copyright Crown Copyright 2026
5
+ * @license Apache-2.0
6
+ */
7
+
8
+ import TestRegister from "../../lib/TestRegister.mjs";
9
+
10
+ TestRegister.addTests([
11
+ {
12
+ name: "Render Markdown: Nothing",
13
+ input: "",
14
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"></div>',
15
+ recipeConfig: [
16
+ {
17
+ "op": "Render Markdown",
18
+ "args": []
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ name: "Render Markdown: Basic Text",
24
+ input: "Hello World!",
25
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p>Hello World!</p>\n</div>',
26
+ recipeConfig: [
27
+ {
28
+ "op": "Render Markdown",
29
+ "args": []
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ name: "Render Markdown: Simple Markdown",
35
+ input: "# Hello World!",
36
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><h1>Hello World!</h1>\n</div>',
37
+ recipeConfig: [
38
+ {
39
+ "op": "Render Markdown",
40
+ "args": []
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ name: "Render Markdown: URL (not expanded)",
46
+ input: "https://gchq.github.io/CyberChef/",
47
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p>https://gchq.github.io/CyberChef/</p>\n</div>',
48
+ recipeConfig: [
49
+ {
50
+ "op": "Render Markdown",
51
+ "args": [false, false, false]
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ name: "Render Markdown: URL (expanded)",
57
+ input: "https://gchq.github.io/CyberChef/",
58
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p><a href="https://gchq.github.io/CyberChef/">https://gchq.github.io/CyberChef/</a></p>\n</div>',
59
+ recipeConfig: [
60
+ {
61
+ "op": "Render Markdown",
62
+ "args": [true, false, false]
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ name: "Render Markdown: Link (not expanded)",
68
+ input: "[CyberChef](https://gchq.github.io/CyberChef/)",
69
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p><a href="https://gchq.github.io/CyberChef/">CyberChef</a></p>\n</div>',
70
+ recipeConfig: [
71
+ {
72
+ "op": "Render Markdown",
73
+ "args": [false, false, false]
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ name: "Render Markdown: Link (expanded)",
79
+ input: "[CyberChef](https://gchq.github.io/CyberChef/)",
80
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p><a href="https://gchq.github.io/CyberChef/">CyberChef</a></p>\n</div>',
81
+ recipeConfig: [
82
+ {
83
+ "op": "Render Markdown",
84
+ "args": [true, false, false]
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ name: "Render Markdown: Link (open in new window)",
90
+ input: "[CyberChef](https://gchq.github.io/CyberChef/)",
91
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p><a href="https://gchq.github.io/CyberChef/" target="_blank">CyberChef</a></p>\n</div>',
92
+ recipeConfig: [
93
+ {
94
+ "op": "Render Markdown",
95
+ "args": [true, false, true]
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ name: "Render Markdown: URL (open in new window)",
101
+ input: "https://gchq.github.io/CyberChef/",
102
+ expectedOutput: '<div style="font-family: var(--primary-font-family)"><p><a href="https://gchq.github.io/CyberChef/" target="_blank">https://gchq.github.io/CyberChef/</a></p>\n</div>',
103
+ recipeConfig: [
104
+ {
105
+ "op": "Render Markdown",
106
+ "args": [true, false, true]
107
+ }
108
+ ]
109
+ },
110
+ ]);