dotsec 4.0.0-alpha.4 → 4.0.0-alpha.41

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,184 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [4.0.0-alpha.41](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.35...v4.0.0-alpha.41) (2023-09-28)
7
+
8
+ **Note:** Version bump only for package dotsec
9
+
10
+
11
+
12
+
13
+
14
+ # [4.0.0-alpha.35](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.34...v4.0.0-alpha.35) (2023-08-17)
15
+
16
+ **Note:** Version bump only for package dotsec
17
+
18
+
19
+
20
+
21
+
22
+ # [4.0.0-alpha.34](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.33...v4.0.0-alpha.34) (2023-08-17)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **dotsec:** removed default background color value ([365d774](https://github.com/jpwesselink/dotsec/commit/365d77470a5b33509d2c65ab20853c65a758be80))
28
+
29
+
30
+
31
+
32
+
33
+ # [4.0.0-alpha.33](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.32...v4.0.0-alpha.33) (2023-08-17)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **dotsec:** booleans are hard ([e6624f4](https://github.com/jpwesselink/dotsec/commit/e6624f4f8ea46a2af154fb08903a8e02087f9b8e))
39
+
40
+
41
+
42
+
43
+
44
+ # [4.0.0-alpha.32](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.31...v4.0.0-alpha.32) (2023-08-17)
45
+
46
+
47
+ ### Features
48
+
49
+ * **dotsec:** docs, output background color options ([2dd7d74](https://github.com/jpwesselink/dotsec/commit/2dd7d747ac3cf55165ebc410eaceb584d3978849))
50
+
51
+
52
+
53
+
54
+
55
+ # [4.0.0-alpha.31](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.30...v4.0.0-alpha.31) (2023-08-17)
56
+
57
+
58
+ ### Features
59
+
60
+ * **dotsec:** docs, output background color options ([328445e](https://github.com/jpwesselink/dotsec/commit/328445e7c067a532ab27b3f0667aabd060ba5109))
61
+
62
+
63
+
64
+
65
+
66
+ # [4.0.0-alpha.30](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.29...v4.0.0-alpha.30) (2023-08-17)
67
+
68
+ **Note:** Version bump only for package dotsec
69
+
70
+
71
+
72
+
73
+
74
+ # [4.0.0-alpha.29](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.28...v4.0.0-alpha.29) (2023-08-17)
75
+
76
+ **Note:** Version bump only for package dotsec
77
+
78
+
79
+
80
+
81
+
82
+ # [4.0.0-alpha.28](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.27...v4.0.0-alpha.28) (2023-08-17)
83
+
84
+ **Note:** Version bump only for package dotsec
85
+
86
+
87
+
88
+
89
+
90
+ # [4.0.0-alpha.25](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.24...v4.0.0-alpha.25) (2023-08-16)
91
+
92
+ **Note:** Version bump only for package dotsec
93
+
94
+
95
+
96
+
97
+
98
+ # [4.0.0-alpha.24](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.23...v4.0.0-alpha.24) (2023-08-16)
99
+
100
+ **Note:** Version bump only for package dotsec
101
+
102
+
103
+
104
+
105
+
106
+ # [4.0.0-alpha.22](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.21...v4.0.0-alpha.22) (2023-06-26)
107
+
108
+ **Note:** Version bump only for package dotsec
109
+
110
+
111
+
112
+
113
+
114
+ # [4.0.0-alpha.20](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.19...v4.0.0-alpha.20) (2023-06-02)
115
+
116
+ **Note:** Version bump only for package dotsec
117
+
118
+
119
+
120
+
121
+
122
+ # [4.0.0-alpha.18](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.17...v4.0.0-alpha.18) (2023-05-24)
123
+
124
+ **Note:** Version bump only for package dotsec
125
+
126
+
127
+
128
+
129
+
130
+ # [4.0.0-alpha.16](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.15...v4.0.0-alpha.16) (2023-05-22)
131
+
132
+ **Note:** Version bump only for package dotsec
133
+
134
+
135
+
136
+
137
+
138
+ # [4.0.0-alpha.14](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.13...v4.0.0-alpha.14) (2023-05-22)
139
+
140
+
141
+ ### Features
142
+
143
+ * test ([f6398b0](https://github.com/jpwesselink/dotsec/commit/f6398b0f6a5829be93640421aba28dd73e012df4))
144
+
145
+
146
+
147
+
148
+
149
+ # [4.0.0-alpha.13](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.12...v4.0.0-alpha.13) (2023-05-22)
150
+
151
+
152
+ ### Features
153
+
154
+ * test ([535c584](https://github.com/jpwesselink/dotsec/commit/535c5844c06fda4b8bdd6d359e080f42033ef3a4))
155
+
156
+
157
+
158
+
159
+
160
+ # [4.0.0-alpha.12](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.11...v4.0.0-alpha.12) (2023-05-22)
161
+
162
+
163
+ ### Features
164
+
165
+ * test ([0694639](https://github.com/jpwesselink/dotsec/commit/06946392e67b69f6bf7e29417a29784871f6c0fe))
166
+
167
+
168
+
169
+
170
+
171
+ # [4.0.0-alpha.11](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2023-05-22)
172
+
173
+
174
+ ### Features
175
+
176
+ * test ([fd59d34](https://github.com/jpwesselink/dotsec/commit/fd59d34bc06d148557b3a97dfc5869b239b4f08c))
177
+
178
+
179
+
180
+
181
+
182
+ # [4.0.0-alpha.10](https://github.com/jpwesselink/dotsec/compare/v2.0.0-alpha.1...v4.0.0-alpha.10) (2023-05-22)
183
+
184
+ **Note:** Version bump only for package dotsec
package/README.md CHANGED
@@ -1,45 +1,15 @@
1
1
  # dotsec
2
2
 
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
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. The AWS plugin adds the ability to push selected `.env`/`.sec` entries to AWS Systems Manager Parameter Store and AWS Secrets Manager.
5
4
 
6
- ## Installation
7
-
8
- With AWS support:
9
-
10
- ```sh
11
- npm install --save dotsec @dotsec/plugin-aws
12
- npx dotsec --plugin @dotsec/plugin-aws aws init
13
- ```
5
+ Currently there are two methods of encryption supported:
14
6
 
15
- With PKE support:
7
+ - [`@dotsec/plugin-pke`](./packages/plugin-pke/README.md) - Using Public Key Encryption
8
+ - [`@dotsec/plugin-aws`](./packages/plugin-aws/README.md) - Using AWS Key Management Service (AWS KMS)
16
9
 
17
- ```sh
18
- npm install --save dotsec @dotsec/plugin-pke
19
- npx dotsec --plugin @dotsec/plugin-pke pke init
20
- ```
10
+ ## Why?
21
11
 
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)
12
+ Environment variables are a great way to configure your application. However, they shouldn't be committed to your repository. This is because they often contain sensitive information, like passwords, API keys, and other secrets. This is where `dotsec` comes in. It allows you to encrypt your environment variables, and store them in a `.sec` file, which can be committed to your repository.
43
13
 
44
14
  ## Features
45
15
 
@@ -67,8 +37,89 @@ When using the AWS plugin, dotsec can also push selected `.env`/`.sec` entries t
67
37
 
68
38
  - For initialisation enough credentials for creating a KMS key, and alias.
69
39
  - For usage enough credentials for using the KMS key to encrypt and/or decrypt.
70
- - An AWS KMS key with an alias. -->
71
- <!--
40
+ - An AWS KMS key with an alias.
41
+
42
+ ## Installation
43
+
44
+ ```sh
45
+ npm install --save-dev dotsec @dotsec/plugin-aws
46
+ ```
47
+
48
+ Add the folowing to dotsec.config.ts:
49
+
50
+ ```ts
51
+ import { DotsecPluginAws } from "@dotsec/plugin-aws";
52
+ import { DotsecConfig } from "dotsec";
53
+
54
+ export const dotsec: DotsecConfig<{ plugins: DotsecPluginAws }> = {
55
+ defaults: {
56
+ encryptionEngine: "aws",
57
+ },
58
+ };
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ If you don't have a .env file, create one:
64
+
65
+ ```sh
66
+ I_CAN_SEE="clearly now"
67
+ SINGING="in the rain"
68
+ I_BLESS_THE_RAINS="down in Africa"
69
+ ```
70
+
71
+ ### Execute a command and use the values of a .env file in its environment
72
+
73
+ ```sh
74
+ npx dotsec run --with-env node -e "console.log(process.env.I_BLESS_THE_RAINS)"
75
+ ```
76
+
77
+ ### Encrypt a .env file to .sec
78
+
79
+ ```sh
80
+ npx dotsec encrypt
81
+ ```
82
+
83
+ ### Execute a command and use the values of a .sec file in its environment
84
+
85
+ ```sh
86
+ npx dotsec run --with-sec node -e "console.log(process.env.I_BLESS_THE_RAINS)"
87
+ ```
88
+
89
+ ### Decrypt a .sec file to .env
90
+
91
+ ```sh
92
+ npx dotsec decrypt
93
+ ```
94
+
95
+ ### Push selected .env entries to AWS Systems Manager Parameter Store
96
+
97
+ Edit the `dotsec.config.ts` file. Add the following to the `aws` object:
98
+
99
+ ```ts
100
+ {
101
+ ...
102
+ variables: {
103
+ "I_BLESS_THE_RAINS": {
104
+ push: {
105
+ aws: {
106
+ ssm: true
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ Run the following command:
115
+
116
+ ```sh
117
+ npx dotsec push
118
+ ```
119
+
120
+ > You might want to set AWS_REGION before running the command. If you don't, the region will be set to `eu-west-1`.
121
+
122
+ <!--
72
123
  ## Usage
73
124
 
74
125
  If you don't have an AWS KMS key with an alias, you can create one with the following command:
@@ -85,15 +136,15 @@ Take not of the `KeyMetadata.KeyId` value, and create an alias for it:
85
136
  aws kms create-alias --alias-name alias/dotsec --target-key-id <key-id>
86
137
  ```
87
138
 
88
- ### Execute a command and use the values of a `.env` file in its environment
139
+ ### Execute a command and use the values of a .env file in its environment
89
140
 
90
- Create a `.env` file if you don't have one already, and add some values:
141
+ Create a .env file if you don't have one already, and add some values:
91
142
 
92
143
  ```sh
93
- echo "MY_FANCY_ENV_VAR='yes yes yallzies'\nHEY_HO='Let\'s go'" > `.env`
144
+ echo "MY_FANCY_ENV_VAR='yes yes yallzies'\nHEY_HO='Let\'s go'" > .env
94
145
  ```
95
146
 
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.)
147
+ 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.)
97
148
 
98
149
  ```sh
99
150
  npx dotsec init --aws-region eu-west-1 [--aws-key-alias alias/dotsec]
@@ -101,28 +152,28 @@ npx dotsec init --aws-region eu-west-1 [--aws-key-alias alias/dotsec]
101
152
 
102
153
  The following files will be created:
103
154
 
104
- - ``.sec`` - The encrypted version of the ``.env`` file.
155
+ - `.sec` - The encrypted version of the `.env` file.
105
156
  - `dotsec.config.ts` - The config file containing the KMS key alias and AWS region.
106
157
 
107
158
  ### Add files to Git
108
159
 
109
- Add the ``.sec`` and `dotsec.config.ts` files to your repository, and commit these accordingly.
160
+ Add the `.sec` and `dotsec.config.ts` files to your repository, and commit these accordingly.
110
161
 
111
- ### Run a process with your `.env` file
162
+ ### Run a process with your .env file
112
163
 
113
164
  ```sh
114
- npx dotsec run --env `.env` command env
165
+ npx dotsec run --env .env command env
115
166
  ```
116
167
 
117
- ### Run a process with your `.sec` file
168
+ ### Run a process with your .sec file
118
169
 
119
170
  ```sh
120
- npx dotsec run --sec `.sec` command env
171
+ npx dotsec run --sec .sec command env
121
172
  ```
122
173
 
123
174
  For more options see `dotsec run --help`.
124
175
 
125
- ### Decrypt a `.sec` file to `.env`
176
+ ### Decrypt a .sec file to .env
126
177
 
127
178
  ```sh
128
179
  npx dotsec decrypt
@@ -130,7 +181,7 @@ npx dotsec decrypt
130
181
 
131
182
  For more options see `dotsec decrypt --help`.
132
183
 
133
- ### Encrypt a `.env` file to `.sec`
184
+ ### Encrypt a .env file to .sec
134
185
 
135
186
  ```sh
136
187
  npx dotsec encrypt
@@ -138,7 +189,7 @@ npx dotsec encrypt
138
189
 
139
190
  For more options see `dotsec encrypt --help`.
140
191
 
141
- ### Push selected `.env`/`.sec` entries to AWS Systems Manager Parameter Store
192
+ ### Push selected .env/.sec entries to AWS Systems Manager Parameter Store
142
193
 
143
194
  Take your favorite editor, and edit the `dotsec.config.ts` file. Add the following to the `aws` object:
144
195
 
@@ -162,7 +213,7 @@ Take your favorite editor, and edit the `dotsec.config.ts` file. Add the followi
162
213
  npx dotsec push --env --to-aws-ssm
163
214
  ```
164
215
 
165
- ### Push selected `.env`/`.sec` entries to AWS Secrets Manager
216
+ ### Push selected .env/.sec entries to AWS Secrets Manager
166
217
 
167
218
  Take your favorite editor, and edit the `dotsec.config.ts` file. Add the following to the `aws` object:
168
219
 
@@ -185,12 +236,12 @@ Take your favorite editor, and edit the `dotsec.config.ts` file. Add the followi
185
236
  ```sh
186
237
  npx dotsec push --env --to-aws-secrets-manager
187
238
  ``` -->
188
- <!--
239
+
189
240
  ### FAQ
190
241
 
191
- #### Is it safe to commit a ``.sec`` and `dotsec.config.ts` file alongside your code?
242
+ #### Is it safe to commit a `.sec` and `dotsec.config.ts` file alongside your code?
192
243
 
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.
244
+ 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.
194
245
 
195
246
  #### Should I use this in production?
196
247
 
@@ -201,15 +252,15 @@ We do, however, since this package is relatively new, I don't think you should.
201
252
  - Write some tests already.
202
253
  - Add support in-code use like `dotsec.config()`
203
254
  - Add support for Node preload modules like `node -r dotsec/register index.js`
204
- - Add watcher for ``.env`` file changes and automatically encrypt
255
+ - Add watcher for `.env` file changes and automatically encrypt
205
256
  - Write guide on postinstall for npm/yarn/pnpm
206
- - Add chunking for encoding larger files with assymetric keys. Current limit is 4kb.
257
+ - ~~Add chunking for encoding larger files with assymetric keys. Current limit is 4kb.~~
207
258
  - Add support for other encryption SDKs like GCP KMS, Azure Key Vault, etc.
208
- - Split up dotsec package in multiple packages, one for each encryption SDK.
259
+ - ~~Split up dotsec package in multiple packages, one for each encryption SDK.~~
209
260
  - Add support for pulling entries to GitHub actions secrets.
210
261
 
211
262
  ## Limitations
212
263
 
213
264
  - The only supported encryption SDK is the AWS Encryption SDK. For now.
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 -->
265
+ - ~~Assymetric keys are supported, but the encrypted file size is limited to the payload size of the key. Until chunking is implemented, that is.~~
266
+ - 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/bin/dotsec.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../dist/cli');
3
+ require("../dist/cli");