dotsec 4.0.0-alpha.0 → 4.0.0-alpha.1

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 (2) hide show
  1. package/README.md +63 -105
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,7 +1,45 @@
1
1
  # dotsec
2
2
 
3
- The solution offers encryption and decryption of `.env` files to and from `.sec` files, the ability to run a command with the values of a `.env`/`.sec` file in its environment, and the ability to push selected `.env`/`.sec` entries to AWS Systems Manager Parameter Store and AWS Secrets Manager.
4
- Encrypts your `.env` file with the AWS Encryption SDK so you can safely commit it to your repository.
3
+ > consider the contents of this file a work in progress, and not yet ready for consumption
4
+ > For now see --help for more information
5
+
6
+ ## Installation
7
+
8
+ With AWS support:
9
+
10
+ ```sh
11
+ npm install dotsec @dotsec/plugin-aws
12
+ npx dotsec --plugin @dotsec/plugin-aws aws init
13
+ ```
14
+
15
+ With PKE support:
16
+
17
+ ```sh
18
+ npm install dotsec @dotsec/plugin-pke
19
+ npx dotsec --plugin @dotsec/plugin-pke pke init
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```sh
25
+ npx dotsec --help
26
+ ```
27
+
28
+ <!--
29
+ `dotsec` is a tool for managing environment variables in a secure way. Encrypted environment variables are stored in a `.sec` file, and decrypted to a `.env` file. The `.sec` file can be committed to your repository. The `.env` file should not be committed to your repository.
30
+
31
+ Next to encrypting and decrypting environment variables, `dotsec` can also be used to run a command with the values of a `.env` file in its environment, or with the values of a `.sec` file in its environment.
32
+
33
+ As of writing this, `dotsec` supports the following encryption providers:
34
+
35
+ - [AWS Key Management Service (AWS KMS)](https://aws.amazon.com/kms/)
36
+ - [Public-key cryptography](https://en.wikipedia.org/wiki/Public-key_cryptography)
37
+
38
+ When using the AWS plugin, dotsec can also push selected `.env`/`.sec` entries to AWS Systems Manager Parameter Store, and/or AWS Secrets Manager.
39
+
40
+ ## Table of Contents
41
+
42
+ - [Installation](#installation)
5
43
 
6
44
  ## Features
7
45
 
@@ -29,87 +67,7 @@ Encrypts your `.env` file with the AWS Encryption SDK so you can safely commit i
29
67
 
30
68
  - For initialisation enough credentials for creating a KMS key, and alias.
31
69
  - For usage enough credentials for using the KMS key to encrypt and/or decrypt.
32
- - An AWS KMS key with an alias.
33
-
34
- ## Installation
35
-
36
- ```sh
37
- npm install --save-dev dotsec @dotsec/plugin-aws
38
- ```
39
-
40
- Add the folowing to dotsec.config.ts:
41
-
42
- ```ts
43
- import { DotsecPluginAws } from "@dotsec/plugin-aws";
44
- import { DotsecConfig } from "dotsec";
45
-
46
- export const dotsec: DotsecConfig<{ plugins: DotsecPluginAws }> = {
47
- defaults: {
48
- encryptionEngine: "aws",
49
- },
50
- };
51
- ```
52
-
53
- ## Usage
54
-
55
- If you don't have a .env file, create one:
56
-
57
- ```sh
58
- I_CAN_SEE="clearly now"
59
- SINGING="in the rain"
60
- I_BLESS_THE_RAINS="down in Africa"
61
- ```
62
-
63
- ### Execute a command and use the values of a .env file in its environment
64
-
65
- ```sh
66
- npx dotsec run --with-env node -e "console.log(process.env.I_BLESS_THE_RAINS)"
67
- ```
68
-
69
- ### Encrypt a .env file to .sec
70
-
71
- ```sh
72
- npx dotsec encrypt
73
- ```
74
-
75
- ### Execute a command and use the values of a .sec file in its environment
76
-
77
- ```sh
78
- npx dotsec run --with-sec node -e "console.log(process.env.I_BLESS_THE_RAINS)"
79
- ```
80
-
81
- ### Decrypt a .sec file to .env
82
-
83
- ```sh
84
- npx dotsec decrypt
85
- ```
86
-
87
- ### Push selected .env entries to AWS Systems Manager Parameter Store
88
-
89
- Edit the `dotsec.config.ts` file. Add the following to the `aws` object:
90
-
91
- ```ts
92
- {
93
- ...
94
- variables: {
95
- "I_BLESS_THE_RAINS": {
96
- push: {
97
- aws: {
98
- ssm: true
99
- }
100
- }
101
- }
102
- }
103
- }
104
- ```
105
-
106
- Run the following command:
107
-
108
- ```sh
109
- npx dotsec push
110
- ```
111
-
112
- > You might want to set AWS_REGION before running the command. If you don't, the region will be set to `eu-west-1`.
70
+ - An AWS KMS key with an alias. -->
113
71
  <!--
114
72
  ## Usage
115
73
 
@@ -127,15 +85,15 @@ Take not of the `KeyMetadata.KeyId` value, and create an alias for it:
127
85
  aws kms create-alias --alias-name alias/dotsec --target-key-id <key-id>
128
86
  ```
129
87
 
130
- ### Execute a command and use the values of a .env file in its environment
88
+ ### Execute a command and use the values of a `.env` file in its environment
131
89
 
132
- Create a .env file if you don't have one already, and add some values:
90
+ Create a `.env` file if you don't have one already, and add some values:
133
91
 
134
92
  ```sh
135
- echo "MY_FANCY_ENV_VAR='yes yes yallzies'\nHEY_HO='Let\'s go'" > .env
93
+ echo "MY_FANCY_ENV_VAR='yes yes yallzies'\nHEY_HO='Let\'s go'" > `.env`
136
94
  ```
137
95
 
138
- The following command will create an encrypted version of the `.env` file, and store it in a file called `.sec`. It will also create a config file called `dotsec.config.ts` which contains the KMS key alias, and AWS region. (Note: you don't have to add the key alias and region to the config file, you can also pass them as options to the dotsec aws sub command. See `dotsec init aws --help` for more information.)
96
+ The following command will create an encrypted version of the ``.env`` file, and store it in a file called ``.sec``. It will also create a config file called `dotsec.config.ts` which contains the KMS key alias, and AWS region. (Note: you don't have to add the key alias and region to the config file, you can also pass them as options to the dotsec aws sub command. See `dotsec init aws --help` for more information.)
139
97
 
140
98
  ```sh
141
99
  npx dotsec init --aws-region eu-west-1 [--aws-key-alias alias/dotsec]
@@ -143,28 +101,28 @@ npx dotsec init --aws-region eu-west-1 [--aws-key-alias alias/dotsec]
143
101
 
144
102
  The following files will be created:
145
103
 
146
- - `.sec` - The encrypted version of the `.env` file.
104
+ - ``.sec`` - The encrypted version of the ``.env`` file.
147
105
  - `dotsec.config.ts` - The config file containing the KMS key alias and AWS region.
148
106
 
149
107
  ### Add files to Git
150
108
 
151
- Add the `.sec` and `dotsec.config.ts` files to your repository, and commit these accordingly.
109
+ Add the ``.sec`` and `dotsec.config.ts` files to your repository, and commit these accordingly.
152
110
 
153
- ### Run a process with your .env file
111
+ ### Run a process with your `.env` file
154
112
 
155
113
  ```sh
156
- npx dotsec run --env .env command env
114
+ npx dotsec run --env `.env` command env
157
115
  ```
158
116
 
159
- ### Run a process with your .sec file
117
+ ### Run a process with your `.sec` file
160
118
 
161
119
  ```sh
162
- npx dotsec run --sec .sec command env
120
+ npx dotsec run --sec `.sec` command env
163
121
  ```
164
122
 
165
123
  For more options see `dotsec run --help`.
166
124
 
167
- ### Decrypt a .sec file to .env
125
+ ### Decrypt a `.sec` file to `.env`
168
126
 
169
127
  ```sh
170
128
  npx dotsec decrypt
@@ -172,7 +130,7 @@ npx dotsec decrypt
172
130
 
173
131
  For more options see `dotsec decrypt --help`.
174
132
 
175
- ### Encrypt a .env file to .sec
133
+ ### Encrypt a `.env` file to `.sec`
176
134
 
177
135
  ```sh
178
136
  npx dotsec encrypt
@@ -180,7 +138,7 @@ npx dotsec encrypt
180
138
 
181
139
  For more options see `dotsec encrypt --help`.
182
140
 
183
- ### Push selected .env/.sec entries to AWS Systems Manager Parameter Store
141
+ ### Push selected `.env`/`.sec` entries to AWS Systems Manager Parameter Store
184
142
 
185
143
  Take your favorite editor, and edit the `dotsec.config.ts` file. Add the following to the `aws` object:
186
144
 
@@ -204,7 +162,7 @@ Take your favorite editor, and edit the `dotsec.config.ts` file. Add the followi
204
162
  npx dotsec push --env --to-aws-ssm
205
163
  ```
206
164
 
207
- ### Push selected .env/.sec entries to AWS Secrets Manager
165
+ ### Push selected `.env`/`.sec` entries to AWS Secrets Manager
208
166
 
209
167
  Take your favorite editor, and edit the `dotsec.config.ts` file. Add the following to the `aws` object:
210
168
 
@@ -227,12 +185,12 @@ Take your favorite editor, and edit the `dotsec.config.ts` file. Add the followi
227
185
  ```sh
228
186
  npx dotsec push --env --to-aws-secrets-manager
229
187
  ``` -->
230
-
188
+ <!--
231
189
  ### FAQ
232
190
 
233
- #### Is it safe to commit a `.sec` and `dotsec.config.ts` file alongside your code?
191
+ #### Is it safe to commit a ``.sec`` and `dotsec.config.ts` file alongside your code?
234
192
 
235
- Yes it is. But it is up to you to make sure that access to the KMS key is restricted to the people who need to decrypt and/or encrypt the `.sec` file.
193
+ Yes it is. But it is up to you to make sure that access to the KMS key is restricted to the people who need to decrypt and/or encrypt the ``.sec`` file.
236
194
 
237
195
  #### Should I use this in production?
238
196
 
@@ -243,15 +201,15 @@ We do, however, since this package is relatively new, I don't think you should.
243
201
  - Write some tests already.
244
202
  - Add support in-code use like `dotsec.config()`
245
203
  - Add support for Node preload modules like `node -r dotsec/register index.js`
246
- - Add watcher for `.env` file changes and automatically encrypt
204
+ - Add watcher for ``.env`` file changes and automatically encrypt
247
205
  - Write guide on postinstall for npm/yarn/pnpm
248
- - ~~Add chunking for encoding larger files with assymetric keys. Current limit is 4kb.~~
206
+ - Add chunking for encoding larger files with assymetric keys. Current limit is 4kb.
249
207
  - Add support for other encryption SDKs like GCP KMS, Azure Key Vault, etc.
250
- - ~~Split up dotsec package in multiple packages, one for each encryption SDK.~~
208
+ - Split up dotsec package in multiple packages, one for each encryption SDK.
251
209
  - Add support for pulling entries to GitHub actions secrets.
252
210
 
253
211
  ## Limitations
254
212
 
255
213
  - The only supported encryption SDK is the AWS Encryption SDK. For now.
256
- - ~~Assymetric keys are supported, but the encrypted file size is limited to the payload size of the key. Until chunking is implemented, that is.~~
257
- - AWS Secrets Manager secrets which are marked for deletion **cannot** be updated until the deletion is complete. As of writing, the minimum deletion time is 7 days. This means that if you want to update a deleted AWS Secrets Manager secret, you have to wait at least 7 days before you can update it again. This is a limitation of AWS Secrets Manager, not dotsec
214
+ - Assymetric keys are supported, but the encrypted file size is limited to the payload size of the key. Until chunking is implemented, that is.
215
+ - AWS Secrets Manager secrets which are marked for deletion **cannot** be updated until the deletion is complete. As of writing, the minimum deletion time is 7 days. This means that if you want to update a deleted AWS Secrets Manager secret, you have to wait at least 7 days before you can update it again. This is a limitation of AWS Secrets Manager, not dotsec -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotsec",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -62,5 +62,5 @@
62
62
  "typescript": "~4.9.3",
63
63
  "yargs-parser": "^21.1.1"
64
64
  },
65
- "gitHead": "d3dce43680504a3d4252c884a2ac12b167ae3d74"
65
+ "gitHead": "d644cfca6d7ae41e7086ad80a320df6c842507da"
66
66
  }