@friggframework/core 1.0.1-v1-alpha.0 → 1.0.1-v1-alpha.2

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.
@@ -1,3 +1,16 @@
1
+ # v1.1.8 (Fri Feb 02 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Added variable BYPASS_ENCRYPTION_STAGE to encrypt module [#248](https://github.com/friggframework/frigg/pull/248) ([@leofmds](https://github.com/leofmds))
6
+ - Added variable BYPASS_ENCRYPTION_STAGE to encrypt module ([@leofmds](https://github.com/leofmds))
7
+
8
+ #### Authors: 1
9
+
10
+ - Leonardo Ferreira ([@leofmds](https://github.com/leofmds))
11
+
12
+ ---
13
+
1
14
  # v1.1.7 (Tue Apr 04 2023)
2
15
 
3
16
  :tada: This release contains work from a new contributor! :tada:
package/encrypt/README.md CHANGED
@@ -1,3 +1,13 @@
1
1
  # encrypt
2
2
 
3
3
  This package exports the `encrypt` mongoose plugin used in [Frigg](https://friggframework.org). You can find its documentation [on Frigg's website](https://docs.friggframework.org/packages/encrypt).
4
+
5
+ ## Configuration
6
+
7
+ | Environment variable | Description |
8
+ |-------------------------|------------------------------------------------------------------------------------------------------------|
9
+ | KMS_KEY_ARN | The AWS KMS Key ARN, if using it to encryption/decryption. |
10
+ | AES_KEY | AES key, used in conjunction with AES_KEY_ID. AES option is mutually exclusive with KMS_KEY_ARN. |
11
+ | AES_KEY_ID | AES key ID, used in conjunction with AES_KEY. |
12
+ | STAGE | The stage in which the application is running. It is usually defined in Serverless configuration, if used. |
13
+ | BYPASS_ENCRYPTION_STAGE | Stages to bypass encryption/decryption, separated by comma. |
@@ -14,14 +14,20 @@ const findOneEvents = [
14
14
  'findOneAndReplace',
15
15
  ];
16
16
 
17
+ const shouldBypassEncryption = (STAGE) => {
18
+ if (!process.env.BYPASS_ENCRYPTION_STAGE) {
19
+ return false;
20
+ }
21
+
22
+ const bypassStages = process.env.BYPASS_ENCRYPTION_STAGE.split(',').map((stage) => stage.trim());
23
+ return bypassStages.indexOf(STAGE) > -1;
24
+ };
25
+
17
26
  // The Mongoose plug-in function
18
27
  function Encrypt(schema, options) {
19
28
  const { STAGE, KMS_KEY_ARN, AES_KEY_ID } = process.env;
20
- const isEnabledForStage =
21
- ['staging', 'QA', 'prod', 'encryption-test'].indexOf(STAGE) > -1;
22
29
 
23
- // No-op if not enabled
24
- if (!isEnabledForStage) {
30
+ if (shouldBypassEncryption(STAGE)) {
25
31
  return;
26
32
  }
27
33
 
@@ -34,6 +34,7 @@ describe('Encrypt', () => {
34
34
  process.env = {
35
35
  ...originalEnv,
36
36
  STAGE: 'not-encryption-test',
37
+ BYPASS_ENCRYPTION_STAGE: 'not-encryption-test',
37
38
  };
38
39
 
39
40
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "1.0.1-v1-alpha.0",
4
+ "version": "1.0.1-v1-alpha.2",
5
5
  "dependencies": {
6
6
  "@hapi/boom": "^10.0.1",
7
7
  "aws-sdk": "^2.1200.0",
@@ -15,7 +15,7 @@
15
15
  "node-fetch": "^2.6.7"
16
16
  },
17
17
  "devDependencies": {
18
- "@friggframework/devtools": "1.0.1-v1-alpha.0",
18
+ "@friggframework/devtools": "1.0.1-v1-alpha.2",
19
19
  "@types/lodash": "^4.14.191",
20
20
  "@typescript-eslint/eslint-plugin": "^5.55.0",
21
21
  "chai": "^4.3.6",
@@ -47,5 +47,5 @@
47
47
  },
48
48
  "homepage": "https://github.com/friggframework/frigg#readme",
49
49
  "description": "",
50
- "gitHead": "31dd6aab556a2fe9e930fa89630dee46925289af"
50
+ "gitHead": "be81c23e498aa754340786c3e81c23880360ec71"
51
51
  }