@celljs/security 4.0.0 → 4.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 (194) hide show
  1. package/README.md +113 -1
  2. package/cell.yml +1 -2
  3. package/esm/browser/module.d.ts +1 -1
  4. package/esm/browser/user/behavior-subject.d.ts +16 -0
  5. package/esm/browser/user/behavior-subject.js +28 -0
  6. package/esm/browser/user/behavior-subject.js.map +1 -0
  7. package/esm/browser/user/index.d.ts +1 -0
  8. package/esm/browser/user/index.js +1 -0
  9. package/esm/browser/user/index.js.map +1 -1
  10. package/esm/browser/user/user-manager.d.ts +1 -1
  11. package/esm/browser/user/user-manager.js +2 -3
  12. package/esm/browser/user/user-manager.js.map +1 -1
  13. package/esm/browser/user/user-protocol.d.ts +1 -1
  14. package/esm/node/access/access-protocol.d.ts +0 -4
  15. package/esm/node/access/access-protocol.js +0 -1
  16. package/esm/node/access/access-protocol.js.map +1 -1
  17. package/esm/node/access/index.d.ts +1 -1
  18. package/esm/node/access/index.js +1 -1
  19. package/esm/node/access/index.js.map +1 -1
  20. package/esm/node/access/method-advice.js +3 -7
  21. package/esm/node/access/method-advice.js.map +1 -1
  22. package/esm/node/access/pattern-util.d.ts +8 -0
  23. package/esm/node/access/pattern-util.js +78 -0
  24. package/esm/node/access/pattern-util.js.map +1 -0
  25. package/esm/node/access/policy-provider.js +2 -3
  26. package/esm/node/access/policy-provider.js.map +1 -1
  27. package/esm/node/access/policy-resolver.d.ts +3 -2
  28. package/esm/node/access/policy-resolver.js +8 -11
  29. package/esm/node/access/policy-resolver.js.map +1 -1
  30. package/esm/node/access/resource-name-resolver.d.ts +3 -0
  31. package/esm/node/access/resource-name-resolver.js +10 -7
  32. package/esm/node/access/resource-name-resolver.js.map +1 -1
  33. package/esm/node/authentication/authentication-provider.d.ts +8 -0
  34. package/esm/node/authentication/authentication-provider.js +29 -2
  35. package/esm/node/authentication/authentication-provider.js.map +1 -1
  36. package/esm/node/authentication/authentication-success-handler.js +4 -0
  37. package/esm/node/authentication/authentication-success-handler.js.map +1 -1
  38. package/esm/node/cache/request-cache.d.ts +2 -0
  39. package/esm/node/cache/request-cache.js +7 -2
  40. package/esm/node/cache/request-cache.js.map +1 -1
  41. package/esm/node/crypto/keygen/base64-string-key-generator.d.ts +4 -0
  42. package/esm/node/crypto/keygen/base64-string-key-generator.js +6 -4
  43. package/esm/node/crypto/keygen/base64-string-key-generator.js.map +1 -1
  44. package/esm/node/crypto/password/password-encoder.d.ts +40 -3
  45. package/esm/node/crypto/password/password-encoder.js +80 -24
  46. package/esm/node/crypto/password/password-encoder.js.map +1 -1
  47. package/esm/node/crypto/password/password-protocol.d.ts +6 -0
  48. package/esm/node/module.d.ts +1 -2
  49. package/esm/node/module.js +0 -1
  50. package/esm/node/module.js.map +1 -1
  51. package/esm/node/user/user-protocol.d.ts +5 -0
  52. package/esm/node/user/user-service.d.ts +14 -0
  53. package/esm/node/user/user-service.js +33 -2
  54. package/esm/node/user/user-service.js.map +1 -1
  55. package/lib/browser/module.d.ts +1 -1
  56. package/lib/browser/user/behavior-subject.d.ts +17 -0
  57. package/lib/browser/user/behavior-subject.d.ts.map +1 -0
  58. package/lib/browser/user/behavior-subject.js +32 -0
  59. package/lib/browser/user/behavior-subject.js.map +1 -0
  60. package/lib/browser/user/behavior-subject.spec.d.ts +2 -0
  61. package/lib/browser/user/behavior-subject.spec.d.ts.map +1 -0
  62. package/lib/browser/user/behavior-subject.spec.js +20 -0
  63. package/lib/browser/user/behavior-subject.spec.js.map +1 -0
  64. package/lib/browser/user/index.d.ts +1 -0
  65. package/lib/browser/user/index.d.ts.map +1 -1
  66. package/lib/browser/user/index.js +1 -0
  67. package/lib/browser/user/index.js.map +1 -1
  68. package/lib/browser/user/user-manager.d.ts +1 -1
  69. package/lib/browser/user/user-manager.d.ts.map +1 -1
  70. package/lib/browser/user/user-manager.js +3 -4
  71. package/lib/browser/user/user-manager.js.map +1 -1
  72. package/lib/browser/user/user-protocol.d.ts +1 -1
  73. package/lib/browser/user/user-protocol.d.ts.map +1 -1
  74. package/lib/node/access/access-protocol.d.ts +0 -4
  75. package/lib/node/access/access-protocol.d.ts.map +1 -1
  76. package/lib/node/access/access-protocol.js +1 -2
  77. package/lib/node/access/access-protocol.js.map +1 -1
  78. package/lib/node/access/expression-resolvers.spec.d.ts +2 -0
  79. package/lib/node/access/expression-resolvers.spec.d.ts.map +1 -0
  80. package/lib/node/access/expression-resolvers.spec.js +57 -0
  81. package/lib/node/access/expression-resolvers.spec.js.map +1 -0
  82. package/lib/node/access/index.d.ts +1 -1
  83. package/lib/node/access/index.d.ts.map +1 -1
  84. package/lib/node/access/index.js +1 -1
  85. package/lib/node/access/index.js.map +1 -1
  86. package/lib/node/access/method-advice.d.ts.map +1 -1
  87. package/lib/node/access/method-advice.js +2 -5
  88. package/lib/node/access/method-advice.js.map +1 -1
  89. package/lib/node/access/pattern-util.d.ts +9 -0
  90. package/lib/node/access/pattern-util.d.ts.map +1 -0
  91. package/lib/node/access/pattern-util.js +81 -0
  92. package/lib/node/access/pattern-util.js.map +1 -0
  93. package/lib/node/access/pattern-util.spec.d.ts +2 -0
  94. package/lib/node/access/pattern-util.spec.d.ts.map +1 -0
  95. package/lib/node/access/pattern-util.spec.js +35 -0
  96. package/lib/node/access/pattern-util.spec.js.map +1 -0
  97. package/lib/node/access/policy-provider.js +2 -2
  98. package/lib/node/access/policy-provider.js.map +1 -1
  99. package/lib/node/access/policy-resolver.d.ts +3 -2
  100. package/lib/node/access/policy-resolver.d.ts.map +1 -1
  101. package/lib/node/access/policy-resolver.js +6 -8
  102. package/lib/node/access/policy-resolver.js.map +1 -1
  103. package/lib/node/access/resource-name-resolver.d.ts +3 -0
  104. package/lib/node/access/resource-name-resolver.d.ts.map +1 -1
  105. package/lib/node/access/resource-name-resolver.js +9 -5
  106. package/lib/node/access/resource-name-resolver.js.map +1 -1
  107. package/lib/node/authentication/authentication-provider.d.ts +8 -0
  108. package/lib/node/authentication/authentication-provider.d.ts.map +1 -1
  109. package/lib/node/authentication/authentication-provider.js +29 -1
  110. package/lib/node/authentication/authentication-provider.js.map +1 -1
  111. package/lib/node/authentication/authentication-success-handler.d.ts.map +1 -1
  112. package/lib/node/authentication/authentication-success-handler.js +4 -0
  113. package/lib/node/authentication/authentication-success-handler.js.map +1 -1
  114. package/lib/node/authentication/basic-authentication.spec.d.ts +2 -0
  115. package/lib/node/authentication/basic-authentication.spec.d.ts.map +1 -0
  116. package/lib/node/authentication/basic-authentication.spec.js +65 -0
  117. package/lib/node/authentication/basic-authentication.spec.js.map +1 -0
  118. package/lib/node/cache/request-cache.d.ts +2 -0
  119. package/lib/node/cache/request-cache.d.ts.map +1 -1
  120. package/lib/node/cache/request-cache.js +7 -35
  121. package/lib/node/cache/request-cache.js.map +1 -1
  122. package/lib/node/cache/request-cache.spec.d.ts +2 -0
  123. package/lib/node/cache/request-cache.spec.d.ts.map +1 -0
  124. package/lib/node/cache/request-cache.spec.js +16 -0
  125. package/lib/node/cache/request-cache.spec.js.map +1 -0
  126. package/lib/node/crypto/keygen/base64-string-key-generator.d.ts +4 -0
  127. package/lib/node/crypto/keygen/base64-string-key-generator.d.ts.map +1 -1
  128. package/lib/node/crypto/keygen/base64-string-key-generator.js +6 -3
  129. package/lib/node/crypto/keygen/base64-string-key-generator.js.map +1 -1
  130. package/lib/node/crypto/keygen/base64-string-key-generator.spec.d.ts +2 -0
  131. package/lib/node/crypto/keygen/base64-string-key-generator.spec.d.ts.map +1 -0
  132. package/lib/node/crypto/keygen/base64-string-key-generator.spec.js +15 -0
  133. package/lib/node/crypto/keygen/base64-string-key-generator.spec.js.map +1 -0
  134. package/lib/node/crypto/password/password-encoder.d.ts +40 -3
  135. package/lib/node/crypto/password/password-encoder.d.ts.map +1 -1
  136. package/lib/node/crypto/password/password-encoder.js +80 -23
  137. package/lib/node/crypto/password/password-encoder.js.map +1 -1
  138. package/lib/node/crypto/password/password-encoder.spec.d.ts +2 -0
  139. package/lib/node/crypto/password/password-encoder.spec.d.ts.map +1 -0
  140. package/lib/node/crypto/password/password-encoder.spec.js +147 -0
  141. package/lib/node/crypto/password/password-encoder.spec.js.map +1 -0
  142. package/lib/node/crypto/password/password-protocol.d.ts +6 -0
  143. package/lib/node/crypto/password/password-protocol.d.ts.map +1 -1
  144. package/lib/node/module.d.ts +1 -2
  145. package/lib/node/module.d.ts.map +1 -1
  146. package/lib/node/module.js +0 -1
  147. package/lib/node/module.js.map +1 -1
  148. package/lib/node/user/user-protocol.d.ts +5 -0
  149. package/lib/node/user/user-protocol.d.ts.map +1 -1
  150. package/lib/node/user/user-service.d.ts +14 -0
  151. package/lib/node/user/user-service.d.ts.map +1 -1
  152. package/lib/node/user/user-service.js +33 -2
  153. package/lib/node/user/user-service.js.map +1 -1
  154. package/lib/node/user/user-service.spec.d.ts +2 -0
  155. package/lib/node/user/user-service.spec.d.ts.map +1 -0
  156. package/lib/node/user/user-service.spec.js +44 -0
  157. package/lib/node/user/user-service.spec.js.map +1 -0
  158. package/package.json +7 -17
  159. package/src/browser/user/behavior-subject.spec.ts +18 -0
  160. package/src/browser/user/behavior-subject.ts +36 -0
  161. package/src/browser/user/index.ts +2 -1
  162. package/src/browser/user/user-manager.ts +3 -5
  163. package/src/browser/user/user-protocol.ts +2 -2
  164. package/src/node/access/access-protocol.ts +0 -5
  165. package/src/node/access/expression-resolvers.spec.ts +37 -0
  166. package/src/node/access/index.ts +1 -1
  167. package/src/node/access/method-advice.ts +1 -2
  168. package/src/node/access/pattern-util.spec.ts +33 -0
  169. package/src/node/access/pattern-util.ts +71 -0
  170. package/src/node/access/policy-provider.ts +3 -3
  171. package/src/node/access/policy-resolver.ts +8 -10
  172. package/src/node/access/resource-name-resolver.ts +11 -7
  173. package/src/node/authentication/authentication-provider.ts +26 -2
  174. package/src/node/authentication/authentication-success-handler.ts +4 -0
  175. package/src/node/authentication/basic-authentication.spec.ts +68 -0
  176. package/src/node/cache/request-cache.spec.ts +14 -0
  177. package/src/node/cache/request-cache.ts +8 -3
  178. package/src/node/crypto/keygen/base64-string-key-generator.spec.ts +13 -0
  179. package/src/node/crypto/keygen/base64-string-key-generator.ts +6 -3
  180. package/src/node/crypto/password/password-encoder.spec.ts +162 -0
  181. package/src/node/crypto/password/password-encoder.ts +99 -21
  182. package/src/node/crypto/password/password-protocol.ts +6 -0
  183. package/src/node/module.ts +0 -1
  184. package/src/node/user/user-protocol.ts +5 -0
  185. package/src/node/user/user-service.spec.ts +46 -0
  186. package/src/node/user/user-service.ts +32 -2
  187. package/esm/node/access/jexl-engine-provider.d.ts +0 -5
  188. package/esm/node/access/jexl-engine-provider.js +0 -22
  189. package/esm/node/access/jexl-engine-provider.js.map +0 -1
  190. package/lib/node/access/jexl-engine-provider.d.ts +0 -6
  191. package/lib/node/access/jexl-engine-provider.d.ts.map +0 -1
  192. package/lib/node/access/jexl-engine-provider.js +0 -25
  193. package/lib/node/access/jexl-engine-provider.js.map +0 -1
  194. package/src/node/access/jexl-engine-provider.ts +0 -18
@@ -1,7 +1,11 @@
1
+ import { randomBytes } from 'node:crypto';
1
2
  import { StringKeyGenerator } from './keygen-protocol';
2
- import { enc, lib } from 'crypto-js';
3
3
  import { Value, Component } from '@celljs/core';
4
4
 
5
+ /**
6
+ * Random keys (OAuth2 `state`, PKCE `code_verifier`, OIDC `nonce`) in base64url without padding,
7
+ * so they can go into a URL as they are (RFC 7636 §4.1 allows only unreserved characters).
8
+ */
5
9
  @Component(StringKeyGenerator)
6
10
  export class Base64StringKeyGenerator implements StringKeyGenerator {
7
11
 
@@ -9,7 +13,6 @@ export class Base64StringKeyGenerator implements StringKeyGenerator {
9
13
  protected readonly keyLength: number;
10
14
 
11
15
  async generateKey(keyLength?: number) {
12
- const key = lib.WordArray.random(keyLength || this.keyLength);
13
- return enc.Base64.stringify(key);
16
+ return randomBytes(keyLength || this.keyLength).toString('base64url');
14
17
  }
15
18
  }
@@ -0,0 +1,162 @@
1
+ import { describe, it } from 'bun:test';
2
+ import { expect } from 'chai';
3
+ import { Pbkdf2PasswordEncoder, Pbkdf2PasswordEncoderOptions } from './password-encoder';
4
+ import { upgradePasswordHash } from '../../authentication/authentication-provider';
5
+
6
+ /**
7
+ * Golden vectors: legacy hashes made by the crypto-js implementation of this encoder (crypto-js 4.2.0, main 6a87acfc0)
8
+ * for fixed salts, with cell-refactor/stage1/t10-password-vectors/generate.cjs. Stored hashes like these must keep matching.
9
+ */
10
+ const LEGACY: { options: Pbkdf2PasswordEncoderOptions; password: string; salt: string; encoded: string }[] = [
11
+ { options: {"encodeHashAsBase64": true}, password: "123456", salt: "0123456789abcdef", encoded: "MDEyMzQ1Njc4OWFiY2RlZjA1NjVhMGQzZmI4ZDlhY2U3ZmY5YTY4OTE1YTFiOTll" },
12
+ { options: {"encodeHashAsBase64": true}, password: "P@ss w0rd!#$%^&*()_+-=[]{}|;:'\",.<>/?`~\\", salt: "a1b2c3d4e5f60718", encoded: "YTFiMmMzZDRlNWY2MDcxODE5NWZjMWI0ODk3YjBlMDBjMjU1YTVjNjcxZTUxOGIx" },
13
+ { options: {"encodeHashAsBase64": true}, password: "中文密码🔐", salt: "ffffffff00000000", encoded: "ZmZmZmZmZmYwMDAwMDAwMDc2MjIyMDk5NzdkMDRjMzdkY2JlYjBhZjNkNjg2NDQ3" },
14
+ { options: {"encodeHashAsBase64": false}, password: "123456", salt: "a1b2c3d4e5f60718", encoded: "a1b2c3d4e5f60718c1ef95056e13cce639b1b172f002e7ae" },
15
+ { options: {"encodeHashAsBase64": false}, password: "P@ss w0rd!#$%^&*()_+-=[]{}|;:'\",.<>/?`~\\", salt: "ffffffff00000000", encoded: "ffffffff0000000018bbdc72579e0a3093f5f6ea06b82033" },
16
+ { options: {"encodeHashAsBase64": false}, password: "中文密码🔐", salt: "0123456789abcdef", encoded: "0123456789abcdef066fc4596441dd6bdb884678496ef9fc" },
17
+ { options: {"encodeHashAsBase64": true, "secret": "s3cr3t"}, password: "123456", salt: "ffffffff00000000", encoded: "ZmZmZmZmZmYwMDAwMDAwMDg4Zjc0NzAyM2E1NjE1NWVjNzU1NzlkZTUxNmQ1Mjhi" },
18
+ { options: {"encodeHashAsBase64": true, "secret": "s3cr3t"}, password: "P@ss w0rd!#$%^&*()_+-=[]{}|;:'\",.<>/?`~\\", salt: "0123456789abcdef", encoded: "MDEyMzQ1Njc4OWFiY2RlZjY4ZGI3ZWU2NGFmMjVhNjdkNWU0MWU0ZTFlZTEyZGY0" },
19
+ { options: {"encodeHashAsBase64": true, "secret": "s3cr3t"}, password: "中文密码🔐", salt: "a1b2c3d4e5f60718", encoded: "YTFiMmMzZDRlNWY2MDcxODAxYTBjZDMxYTgxZmE0N2UyMDQxNWUzNDJiOTg5ZGMx" },
20
+ { options: {"encodeHashAsBase64": true, "secret": 123456}, password: "123456", salt: "0123456789abcdef", encoded: "MDEyMzQ1Njc4OWFiY2RlZjZkNGE0MGRkMDU4MmRmMGI1MjVkM2MxZjE0NjVkNjY5" },
21
+ { options: {"encodeHashAsBase64": true, "secret": 123456}, password: "P@ss w0rd!#$%^&*()_+-=[]{}|;:'\",.<>/?`~\\", salt: "a1b2c3d4e5f60718", encoded: "YTFiMmMzZDRlNWY2MDcxOGM5ZWY5NjgzNzExMDUwNWUwNWVlYzlkYTRhMjkyYmZj" },
22
+ { options: {"encodeHashAsBase64": true, "secret": 123456}, password: "中文密码🔐", salt: "ffffffff00000000", encoded: "ZmZmZmZmZmYwMDAwMDAwMDFkZWZlYjdjYjkxNTNlMzk1YWFiZGUzNWM3NDBjNjg0" },
23
+ { options: {"encodeHashAsBase64": false, "secret": "密钥🔑", "iterations": 1000}, password: "123456", salt: "a1b2c3d4e5f60718", encoded: "a1b2c3d4e5f6071822b7276a5d78c8e4111547a26aada7f1" },
24
+ { options: {"encodeHashAsBase64": false, "secret": "密钥🔑", "iterations": 1000}, password: "P@ss w0rd!#$%^&*()_+-=[]{}|;:'\",.<>/?`~\\", salt: "ffffffff00000000", encoded: "ffffffff0000000068f9b165d52e8bc615b2ebcc6654d149" },
25
+ { options: {"encodeHashAsBase64": false, "secret": "密钥🔑", "iterations": 1000}, password: "中文密码🔐", salt: "0123456789abcdef", encoded: "0123456789abcdef27ac13cc586b34fbf24700ef8f5cd54b" },
26
+ { options: {"encodeHashAsBase64": true, "iterations": 1, "keySize": 8}, password: "123456", salt: "ffffffff00000000", encoded: "ZmZmZmZmZmYwMDAwMDAwMGYyMjdkNzNkODMwNWU3OWZjOGM2YTc1ZjdmZjZhMGRhNDgwMWFlYTZlZjcxYWM4Mjc0MmIyYzlhNTQyZjJhM2Q=" },
27
+ { options: {"encodeHashAsBase64": true, "iterations": 1, "keySize": 8}, password: "P@ss w0rd!#$%^&*()_+-=[]{}|;:'\",.<>/?`~\\", salt: "0123456789abcdef", encoded: "MDEyMzQ1Njc4OWFiY2RlZmFmZGEwNTA0YzA5YjJlYjBjNTExOTA3ZWRlZThiNzRmODVhNGU0NWZjODg0ZmZjOGU5NDA3Y2JiNTljZDA4ZWQ=" },
28
+ { options: {"encodeHashAsBase64": true, "iterations": 1, "keySize": 8}, password: "中文密码🔐", salt: "a1b2c3d4e5f60718", encoded: "YTFiMmMzZDRlNWY2MDcxOGI2MTgyZGI1YWFkOThjMDNmOGRlZDllYTNkYjUzNTVlM2YwZDhlMmU0NDQ3ZTE5ZjY5NDBjOWUzOTRlOTE1ODM=" },
29
+ ];
30
+
31
+ class TestEncoder extends Pbkdf2PasswordEncoder {
32
+ constructor(options: Pbkdf2PasswordEncoderOptions = {}, protected readonly newIterations = 1000) {
33
+ super();
34
+ Object.defineProperty(this, 'options', { value: options });
35
+ }
36
+
37
+ protected override get iterations(): number {
38
+ return this.newIterations;
39
+ }
40
+
41
+ /** What the crypto-js implementation stored for a fixed salt. */
42
+ async legacyHash(rawPassword: string, salt: string): Promise<string> {
43
+ const text = await this.legacyEncode(rawPassword, salt);
44
+ return this.options?.encodeHashAsBase64 ? Buffer.from(text, 'utf8').toString('base64') : text;
45
+ }
46
+ }
47
+
48
+ const name = (v: (typeof LEGACY)[number]) => `${JSON.stringify(v.options)} ${JSON.stringify(v.password)}`;
49
+
50
+ describe('Pbkdf2PasswordEncoder', () => {
51
+ describe('legacy hashes of the crypto-js implementation', () => {
52
+ for (const vector of LEGACY) {
53
+ it(`match, and a wrong password does not: ${name(vector)}`, async () => {
54
+ const encoder = new TestEncoder(vector.options);
55
+ expect(await encoder.matches(vector.password, vector.encoded)).to.equal(true);
56
+ expect(await encoder.matches(`${vector.password}x`, vector.encoded)).to.equal(false);
57
+ expect(await encoder.matches('', vector.encoded)).to.equal(false);
58
+ });
59
+
60
+ it(`are reproduced byte for byte: ${name(vector)}`, async () => {
61
+ expect(await new TestEncoder(vector.options).legacyHash(vector.password, vector.salt)).to.equal(vector.encoded);
62
+ });
63
+ }
64
+
65
+ it('need an upgrade', () => {
66
+ for (const vector of LEGACY) {
67
+ expect(new TestEncoder(vector.options).needsUpgrade(vector.encoded)).to.equal(true);
68
+ }
69
+ });
70
+
71
+ it('only match with the secret they were made with (none means the text "undefined")', async () => {
72
+ const vector = LEGACY.find(v => v.options.secret === undefined && v.options.encodeHashAsBase64)!;
73
+ expect(await new TestEncoder({ ...vector.options, secret: 'undefined' }).matches(vector.password, vector.encoded)).to.equal(true);
74
+ expect(await new TestEncoder({ ...vector.options, secret: 'pepper' }).matches(vector.password, vector.encoded)).to.equal(false);
75
+ });
76
+ });
77
+
78
+ describe('new hashes', () => {
79
+ it('record their parameters and use a fresh salt', async () => {
80
+ const encoder = new TestEncoder({ encodeHashAsBase64: true });
81
+ const a = await encoder.encode('secret');
82
+ const b = await encoder.encode('secret');
83
+ expect(a).to.match(/^pbkdf2-sha256\$1000\$[A-Za-z0-9+/]{22}==\$[A-Za-z0-9+/]{43}=$/);
84
+ expect(a).to.not.equal(b);
85
+ });
86
+
87
+ it('match the right password only', async () => {
88
+ const encoder = new TestEncoder();
89
+ const hash = await encoder.encode('中文密码🔐');
90
+ expect(await encoder.matches('中文密码🔐', hash)).to.equal(true);
91
+ expect(await encoder.matches('中文密码', hash)).to.equal(false);
92
+ });
93
+
94
+ it('do not depend on encodeHashAsBase64, and a missing secret is not the text "undefined"', async () => {
95
+ const hash = await new TestEncoder({ encodeHashAsBase64: true }).encode('secret');
96
+ expect(await new TestEncoder({ encodeHashAsBase64: false }).matches('secret', hash)).to.equal(true);
97
+ expect(await new TestEncoder({ secret: 'undefined' }).matches('secret', hash)).to.equal(false);
98
+ });
99
+
100
+ it('mix the secret in', async () => {
101
+ const hash = await new TestEncoder({ secret: 'pepper' }).encode('secret');
102
+ expect(await new TestEncoder({ secret: 'pepper' }).matches('secret', hash)).to.equal(true);
103
+ expect(await new TestEncoder({ secret: 'other' }).matches('secret', hash)).to.equal(false);
104
+ expect(await new TestEncoder().matches('secret', hash)).to.equal(false);
105
+ });
106
+
107
+ it('check with the iterations they record, and need an upgrade when that is fewer than new hashes get', async () => {
108
+ const old = await new TestEncoder({}, 1000).encode('secret');
109
+ const encoder = new TestEncoder({}, 2000);
110
+ expect(await encoder.matches('secret', old)).to.equal(true);
111
+ expect(encoder.needsUpgrade(old)).to.equal(true);
112
+ expect(encoder.needsUpgrade(await encoder.encode('secret'))).to.equal(false);
113
+ });
114
+
115
+ it('get 600000 iterations by default', async () => {
116
+ expect(await new Pbkdf2PasswordEncoder().encode('secret')).to.match(/^pbkdf2-sha256\$600000\$/);
117
+ });
118
+ });
119
+
120
+ it('rejects malformed hashes instead of throwing', async () => {
121
+ for (const options of [{ encodeHashAsBase64: true }, { encodeHashAsBase64: false }]) {
122
+ const encoder = new TestEncoder(options);
123
+ for (const hash of ['', 'abc', '!!!!', '0123456789abcdef', 'pbkdf2-sha256$x$a$b', 'pbkdf2-sha256$1000$$', 'pbkdf2-sha256$1000$YQ==$YQ==',
124
+ 'pbkdf2-sha256$1000$YQ==$YQ==$x', undefined as unknown as string, null as unknown as string]) {
125
+ expect(await encoder.matches('secret', hash), String(hash)).to.equal(false);
126
+ }
127
+ }
128
+ });
129
+
130
+ describe('upgradePasswordHash', () => {
131
+ const legacy = LEGACY.find(v => v.options.encodeHashAsBase64 && v.options.secret === undefined)!;
132
+ const user = () => ({ username: 'tom', password: legacy.encoded }) as any;
133
+ const logger = (warnings: string[]) => ({ warn: (m: string) => warnings.push(m) }) as any;
134
+
135
+ it('stores a new hash of a legacy one through UserService.updatePassword', async () => {
136
+ const encoder = new TestEncoder(legacy.options);
137
+ const stored: string[] = [];
138
+ const service = { load: async () => user(), updatePassword: async (_: unknown, hash: string) => { stored.push(hash); } };
139
+ await upgradePasswordHash(encoder, service, user(), legacy.password, logger([]));
140
+ expect(stored).to.have.length(1);
141
+ expect(encoder.needsUpgrade(stored[0])).to.equal(false);
142
+ expect(await encoder.matches(legacy.password, stored[0])).to.equal(true);
143
+ });
144
+
145
+ it('does nothing when the hash is current or the UserService cannot store passwords', async () => {
146
+ const encoder = new TestEncoder(legacy.options);
147
+ const stored: string[] = [];
148
+ const service = { load: async () => user(), updatePassword: async (_: unknown, hash: string) => { stored.push(hash); } };
149
+ await upgradePasswordHash(encoder, service, { ...user(), password: await encoder.encode(legacy.password) }, legacy.password, logger([]));
150
+ await upgradePasswordHash(encoder, { load: async () => user() }, user(), legacy.password, logger([]));
151
+ expect(stored).to.have.length(0);
152
+ });
153
+
154
+ it('logs a failure to store instead of failing the login', async () => {
155
+ const warnings: string[] = [];
156
+ const service = { load: async () => user(), updatePassword: async () => { throw new Error('read-only'); } };
157
+ await upgradePasswordHash(new TestEncoder(legacy.options), service, user(), legacy.password, logger(warnings));
158
+ expect(warnings).to.have.length(1);
159
+ expect(warnings[0]).to.include('read-only');
160
+ });
161
+ });
162
+ });
@@ -1,39 +1,117 @@
1
- import { PasswordEncoder } from './password-protocol';
2
- import { PBKDF2, lib, enc} from 'crypto-js';
1
+ import { pbkdf2, randomBytes, timingSafeEqual } from 'node:crypto';
2
+ import { promisify } from 'node:util';
3
3
  import { Value, Component } from '@celljs/core';
4
+ import { PasswordEncoder } from './password-protocol';
5
+
6
+ const pbkdf2Async = promisify(pbkdf2);
4
7
 
8
+ export interface Pbkdf2PasswordEncoderOptions {
9
+ /** Optional pepper. New hashes mix it into the salt when it is set; legacy hashes were made with `String(secret)`. */
10
+ secret?: string | number;
11
+ /** Legacy hashes only: they are base64 of the hex text. */
12
+ encodeHashAsBase64?: boolean;
13
+ /** Legacy hashes only: PBKDF2 iterations they were made with. Default 250000 (crypto-js 4.2.0). */
14
+ iterations?: number;
15
+ /** Legacy hashes only: derived key length in 32-bit words. Default 4 (16 bytes, crypto-js 4.2.0). */
16
+ keySize?: number;
17
+ }
18
+
19
+ /**
20
+ * Password hashes with PBKDF2-HMAC-SHA256 on node:crypto, compared in constant time.
21
+ *
22
+ * New hashes: `pbkdf2-sha256$<iterations>$<salt, base64>$<key, base64>` with 600000 iterations, a 16-byte
23
+ * random salt (followed by the UTF-8 bytes of `secret` when one is set) and a 32-byte key.
24
+ *
25
+ * Legacy hashes (no prefix), as the crypto-js 4.2.0 implementation of 4.x stored them, keep matching:
26
+ * optionally base64 of a text that is a 16-character hex salt followed by the hex key; the key is
27
+ * PBKDF2(password, salt + String(secret)) with SHA-256, `iterations` (default 250000) and `keySize` words
28
+ * (default 4). Without a secret the salt text ends in `undefined`, which is how those hashes were made.
29
+ * Hashes made with crypto-js 4.1 or older (SHA-1, 1 iteration) are not supported.
30
+ * {@link needsUpgrade} is true for legacy hashes, so a login replaces them with a new hash.
31
+ */
5
32
  @Component(PasswordEncoder)
6
33
  export class Pbkdf2PasswordEncoder implements PasswordEncoder {
7
34
 
35
+ static readonly PREFIX = 'pbkdf2-sha256';
36
+ static readonly ITERATIONS = 600000;
37
+ static readonly SALT_BYTES = 16;
38
+ static readonly KEY_BYTES = 32;
39
+
40
+ static readonly LEGACY_ITERATIONS = 250000;
41
+ static readonly LEGACY_KEY_SIZE = 4;
42
+ static readonly LEGACY_SALT_LENGTH = 16;
43
+
8
44
  @Value('cell.security.passwordEncoder')
9
- protected readonly options: any;
45
+ protected readonly options: Pbkdf2PasswordEncoderOptions | undefined;
46
+
47
+ /** Iterations of new hashes. */
48
+ protected get iterations(): number {
49
+ return Pbkdf2PasswordEncoder.ITERATIONS;
50
+ }
10
51
 
11
52
  async encode(rawPassword: string): Promise<string> {
12
- const { encodeHashAsBase64 } = this.options;
13
- const salt = lib.WordArray.random(8);
14
- const encoded = this.doEncode(rawPassword, salt.toString());
15
- if (encodeHashAsBase64) {
16
- return enc.Base64.stringify(enc.Utf8.parse(encoded));
53
+ const salt = randomBytes(Pbkdf2PasswordEncoder.SALT_BYTES);
54
+ const key = await pbkdf2Async(rawPassword, this.pepper(salt), this.iterations, Pbkdf2PasswordEncoder.KEY_BYTES, 'sha256');
55
+ return [Pbkdf2PasswordEncoder.PREFIX, this.iterations, salt.toString('base64'), key.toString('base64')].join('$');
56
+ }
57
+
58
+ async matches(rawPassword: string, encodedPassword: string): Promise<boolean> {
59
+ if (typeof encodedPassword !== 'string' || typeof rawPassword !== 'string') {
60
+ return false;
17
61
  }
18
- return encoded;
62
+ return this.isCurrent(encodedPassword) ? this.matchesCurrent(rawPassword, encodedPassword) : this.matchesLegacy(rawPassword, encodedPassword);
19
63
  }
20
64
 
21
- protected doEncode(rawPassword: string, salt: string): string {
22
- const { secret } = this.options;
23
- return salt + PBKDF2(rawPassword, salt + secret, this.options).toString();
65
+ needsUpgrade(encodedPassword: string): boolean {
66
+ if (!this.isCurrent(encodedPassword)) {
67
+ return true;
68
+ }
69
+ return Number(encodedPassword.split('$')[1]) < this.iterations;
24
70
  }
25
71
 
26
- async matches(rawPassword: string, encodedPassword: string): Promise<boolean> {
27
- const digested = this.doDecode(encodedPassword);
28
- const salt = digested.substring(0, 16);
29
- return digested === this.doEncode(rawPassword, salt);
72
+ protected isCurrent(encodedPassword: string): boolean {
73
+ return encodedPassword.startsWith(`${Pbkdf2PasswordEncoder.PREFIX}$`);
30
74
  }
31
75
 
32
- protected doDecode(encoded: string): string {
33
- const { encodeHashAsBase64 } = this.options;
34
- if (encodeHashAsBase64) {
35
- return enc.Base64.parse(encoded).toString(enc.Utf8);
76
+ protected pepper(salt: Buffer): Buffer {
77
+ const secret = this.options?.secret;
78
+ return secret === undefined || secret === null || secret === '' ? salt : Buffer.concat([salt, Buffer.from(String(secret), 'utf8')]);
79
+ }
80
+
81
+ protected async matchesCurrent(rawPassword: string, encodedPassword: string): Promise<boolean> {
82
+ const [, iterationsText, saltText, keyText, ...rest] = encodedPassword.split('$');
83
+ const iterations = Number(iterationsText);
84
+ if (rest.length > 0 || !Number.isSafeInteger(iterations) || iterations < 1 || !saltText || !keyText) {
85
+ return false;
86
+ }
87
+ const expected = Buffer.from(keyText, 'base64');
88
+ if (expected.length !== Pbkdf2PasswordEncoder.KEY_BYTES) {
89
+ return false;
36
90
  }
37
- return encoded;
91
+ const actual = await pbkdf2Async(rawPassword, this.pepper(Buffer.from(saltText, 'base64')), iterations, Pbkdf2PasswordEncoder.KEY_BYTES, 'sha256');
92
+ return timingSafeEqual(actual, expected);
93
+ }
94
+
95
+ protected async matchesLegacy(rawPassword: string, encodedPassword: string): Promise<boolean> {
96
+ const digested = this.options?.encodeHashAsBase64 ? Buffer.from(encodedPassword, 'base64').toString('utf8') : encodedPassword;
97
+ if (digested.length <= Pbkdf2PasswordEncoder.LEGACY_SALT_LENGTH) {
98
+ return false;
99
+ }
100
+ const expected = Buffer.from(await this.legacyEncode(rawPassword, digested.substring(0, Pbkdf2PasswordEncoder.LEGACY_SALT_LENGTH)), 'utf8');
101
+ const actual = Buffer.from(digested, 'utf8');
102
+ return actual.length === expected.length && timingSafeEqual(actual, expected);
103
+ }
104
+
105
+ /** The text the crypto-js implementation stored (before the optional base64): salt + hex key. */
106
+ protected async legacyEncode(rawPassword: string, salt: string): Promise<string> {
107
+ const { secret, iterations, keySize } = this.options ?? {};
108
+ const key = await pbkdf2Async(
109
+ rawPassword,
110
+ `${salt}${secret}`,
111
+ Number(iterations ?? Pbkdf2PasswordEncoder.LEGACY_ITERATIONS),
112
+ Number(keySize ?? Pbkdf2PasswordEncoder.LEGACY_KEY_SIZE) * 4,
113
+ 'sha256',
114
+ );
115
+ return salt + key.toString('hex');
38
116
  }
39
117
  }
@@ -3,4 +3,10 @@ export const PasswordEncoder = Symbol('PasswordEncoder');
3
3
  export interface PasswordEncoder {
4
4
  encode(rawPassword: string): Promise<string>;
5
5
  matches(rawPassword: string, encodedPassword: string): Promise<boolean>;
6
+ /**
7
+ * Whether a stored hash should be replaced by `encode()` of the password once it matched (a legacy
8
+ * format, or weaker parameters than new hashes get). Login does so when the UserService can
9
+ * store passwords (`UserService.updatePassword`).
10
+ */
11
+ needsUpgrade?(encodedPassword: string): boolean;
6
12
  }
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { autoBind } from '@celljs/core';
3
2
  import './index';
4
3
 
@@ -9,6 +9,11 @@ export const USER_MIDDLEWARE_PRIORITY = SECURITY_CONTEXT_MIDDLEWARE_PRIORITY - 1
9
9
 
10
10
  export interface UserService<R, U extends User> {
11
11
  load(userRequest: R): Promise<U>;
12
+ /**
13
+ * Stores a new password hash of `user`. Optional: when a service has it, a login whose stored hash
14
+ * `PasswordEncoder.needsUpgrade()` saves the hash in the current format.
15
+ */
16
+ updatePassword?(user: U, encodedPassword: string): Promise<void>;
12
17
  }
13
18
 
14
19
  export interface UserChecker {
@@ -0,0 +1,46 @@
1
+ import { describe, it } from 'bun:test';
2
+ import { expect } from 'chai';
3
+ import { UserServiceImpl, UserSourceCheck } from './user-service';
4
+ import { UsernameNotFoundError } from '../error';
5
+
6
+ function check(userService: unknown): string[] {
7
+ const warnings: string[] = [];
8
+ const lifecycle = new UserSourceCheck();
9
+ Object.assign(lifecycle, { userService, logger: { warn: (m: string) => warnings.push(m) } });
10
+ lifecycle.initialize();
11
+ return warnings;
12
+ }
13
+
14
+ function service(options: Record<string, unknown>): UserServiceImpl {
15
+ return Object.assign(new UserServiceImpl(), { options });
16
+ }
17
+
18
+ describe('UserServiceImpl', () => {
19
+ it('has no built-in user', async () => {
20
+ let error: unknown;
21
+ try {
22
+ await service({}).load('admin');
23
+ } catch (e) {
24
+ error = e;
25
+ }
26
+ expect(error).to.be.instanceOf(UsernameNotFoundError);
27
+ });
28
+
29
+ it('loads the user of cell.security', async () => {
30
+ const user = await service({ username: 'tom', password: 'hash' }).load('tom');
31
+ expect(user.username).to.equal('tom');
32
+ expect(user.password).to.equal('hash');
33
+ });
34
+ });
35
+
36
+ describe('UserSourceCheck', () => {
37
+ it('warns when the default UserService has no configured user', () => {
38
+ expect(check(service({}))).to.have.length(1);
39
+ expect(check(service({ username: 'tom' }))).to.have.length(1);
40
+ });
41
+
42
+ it('is quiet with a configured user or a UserService of the application', () => {
43
+ expect(check(service({ username: 'tom', password: 'hash' }))).to.have.length(0);
44
+ expect(check({ load: async () => ({}) })).to.have.length(0);
45
+ });
46
+ });
@@ -1,16 +1,22 @@
1
1
  import { UserService } from './user-protocol';
2
- import { Value, Component } from '@celljs/core';
2
+ import { Value, Component, Autowired, Logger, ApplicationLifecycle, Application } from '@celljs/core';
3
3
  import { UsernameNotFoundError } from '../error';
4
4
  import { User, UserType } from '../../common';
5
5
 
6
+ /** The one user of `cell.security.username` / `password`, when they are configured. */
6
7
  @Component(UserService)
7
8
  export class UserServiceImpl implements UserService<string, User> {
8
9
 
9
10
  @Value('cell.security')
10
11
  protected readonly options: any;
11
12
 
13
+ /** Whether `cell.security` configures a user. */
14
+ get hasConfiguredUser(): boolean {
15
+ return !!this.options?.username && !!this.options?.password;
16
+ }
17
+
12
18
  async load(username: string): Promise<User> {
13
- if (this.options.username === username) {
19
+ if (this.hasConfiguredUser && this.options.username === username) {
14
20
  return {
15
21
  type: UserType.Memery,
16
22
  username,
@@ -26,3 +32,27 @@ export class UserServiceImpl implements UserService<string, User> {
26
32
  throw new UsernameNotFoundError(`Could not find: ${username}`);
27
33
  }
28
34
  }
35
+
36
+ /**
37
+ * Warns at startup when the login (form or Basic) has no user to check: the default UserService is in
38
+ * use and `cell.security` configures no user. A warning, not an error: an application may log in with
39
+ * OAuth2 only, or use @celljs/security for authorization alone.
40
+ */
41
+ @Component(ApplicationLifecycle)
42
+ export class UserSourceCheck implements ApplicationLifecycle<Application> {
43
+
44
+ @Autowired(UserService)
45
+ protected readonly userService: UserService<string, User>;
46
+
47
+ @Autowired(Logger)
48
+ protected readonly logger: Logger;
49
+
50
+ initialize(): void {
51
+ if (this.userService instanceof UserServiceImpl && !this.userService.hasConfiguredUser) {
52
+ this.logger.warn(
53
+ 'No user can log in: @celljs/security has no built-in user. Set cell.security.username and cell.security.password ' +
54
+ '(a hash made by the PasswordEncoder) in cell.yml, or bind a UserService of your own.'
55
+ );
56
+ }
57
+ }
58
+ }
@@ -1,5 +0,0 @@
1
- import { JexlEngineProvider } from './access-protocol.js';
2
- export declare class JexlEngineProviderImpl implements JexlEngineProvider<any> {
3
- protected jexlEngine: any;
4
- provide(): any;
5
- }
@@ -1,22 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component } from '@celljs/core';
8
- import { JexlEngineProvider } from './access-protocol.js';
9
- import { Jexl } from 'jexl';
10
- let JexlEngineProviderImpl = class JexlEngineProviderImpl {
11
- provide() {
12
- if (!this.jexlEngine) {
13
- this.jexlEngine = new Jexl();
14
- }
15
- return this.jexlEngine;
16
- }
17
- };
18
- JexlEngineProviderImpl = __decorate([
19
- Component(JexlEngineProvider)
20
- ], JexlEngineProviderImpl);
21
- export { JexlEngineProviderImpl };
22
- //# sourceMappingURL=jexl-engine-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jexl-engine-provider.js","sourceRoot":"","sources":["../../../src/node/access/jexl-engine-provider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGrB,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAI/B,OAAO;QAEH,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CAEJ,CAAA;AAZY,sBAAsB;IADlC,SAAS,CAAC,kBAAkB,CAAC;GACjB,sBAAsB,CAYlC"}
@@ -1,6 +0,0 @@
1
- import { JexlEngineProvider } from './access-protocol';
2
- export declare class JexlEngineProviderImpl implements JexlEngineProvider<any> {
3
- protected jexlEngine: any;
4
- provide(): any;
5
- }
6
- //# sourceMappingURL=jexl-engine-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jexl-engine-provider.d.ts","sourceRoot":"","sources":["../../../src/node/access/jexl-engine-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,qBACa,sBAAuB,YAAW,kBAAkB,CAAC,GAAG,CAAC;IAElE,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC;IAE1B,OAAO,IAAI,GAAG,CAMb;CAEJ"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.JexlEngineProviderImpl = void 0;
10
- const core_1 = require("@celljs/core");
11
- const access_protocol_1 = require("./access-protocol");
12
- const jexl_1 = require("jexl");
13
- let JexlEngineProviderImpl = class JexlEngineProviderImpl {
14
- provide() {
15
- if (!this.jexlEngine) {
16
- this.jexlEngine = new jexl_1.Jexl();
17
- }
18
- return this.jexlEngine;
19
- }
20
- };
21
- exports.JexlEngineProviderImpl = JexlEngineProviderImpl;
22
- exports.JexlEngineProviderImpl = JexlEngineProviderImpl = __decorate([
23
- (0, core_1.Component)(access_protocol_1.JexlEngineProvider)
24
- ], JexlEngineProviderImpl);
25
- //# sourceMappingURL=jexl-engine-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jexl-engine-provider.js","sourceRoot":"","sources":["../../../src/node/access/jexl-engine-provider.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyC;AACzC,uDAAuD;AACvD,+BAA4B;AAGrB,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAI/B,OAAO;QAEH,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,WAAI,EAAE,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CAEJ,CAAA;;iCAZY,sBAAsB;IADlC,IAAA,gBAAS,EAAC,oCAAkB,CAAC;GACjB,sBAAsB,CAYlC"}
@@ -1,18 +0,0 @@
1
- import { Component } from '@celljs/core';
2
- import { JexlEngineProvider } from './access-protocol';
3
- import { Jexl } from 'jexl';
4
-
5
- @Component(JexlEngineProvider)
6
- export class JexlEngineProviderImpl implements JexlEngineProvider<any> {
7
-
8
- protected jexlEngine: any;
9
-
10
- provide(): any {
11
-
12
- if (!this.jexlEngine) {
13
- this.jexlEngine = new Jexl();
14
- }
15
- return this.jexlEngine;
16
- }
17
-
18
- }