dotsec 4.0.0-alpha.3 → 4.0.0-alpha.31

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,135 @@
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.31](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.30...v4.0.0-alpha.31) (2023-08-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * **dotsec:** docs, output background color options ([328445e](https://github.com/jpwesselink/dotsec/commit/328445e7c067a532ab27b3f0667aabd060ba5109))
12
+
13
+
14
+
15
+
16
+
17
+ # [4.0.0-alpha.30](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.29...v4.0.0-alpha.30) (2023-08-17)
18
+
19
+ **Note:** Version bump only for package dotsec
20
+
21
+
22
+
23
+
24
+
25
+ # [4.0.0-alpha.29](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.28...v4.0.0-alpha.29) (2023-08-17)
26
+
27
+ **Note:** Version bump only for package dotsec
28
+
29
+
30
+
31
+
32
+
33
+ # [4.0.0-alpha.28](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.27...v4.0.0-alpha.28) (2023-08-17)
34
+
35
+ **Note:** Version bump only for package dotsec
36
+
37
+
38
+
39
+
40
+
41
+ # [4.0.0-alpha.25](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.24...v4.0.0-alpha.25) (2023-08-16)
42
+
43
+ **Note:** Version bump only for package dotsec
44
+
45
+
46
+
47
+
48
+
49
+ # [4.0.0-alpha.24](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.23...v4.0.0-alpha.24) (2023-08-16)
50
+
51
+ **Note:** Version bump only for package dotsec
52
+
53
+
54
+
55
+
56
+
57
+ # [4.0.0-alpha.22](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.21...v4.0.0-alpha.22) (2023-06-26)
58
+
59
+ **Note:** Version bump only for package dotsec
60
+
61
+
62
+
63
+
64
+
65
+ # [4.0.0-alpha.20](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.19...v4.0.0-alpha.20) (2023-06-02)
66
+
67
+ **Note:** Version bump only for package dotsec
68
+
69
+
70
+
71
+
72
+
73
+ # [4.0.0-alpha.18](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.17...v4.0.0-alpha.18) (2023-05-24)
74
+
75
+ **Note:** Version bump only for package dotsec
76
+
77
+
78
+
79
+
80
+
81
+ # [4.0.0-alpha.16](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.15...v4.0.0-alpha.16) (2023-05-22)
82
+
83
+ **Note:** Version bump only for package dotsec
84
+
85
+
86
+
87
+
88
+
89
+ # [4.0.0-alpha.14](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.13...v4.0.0-alpha.14) (2023-05-22)
90
+
91
+
92
+ ### Features
93
+
94
+ * test ([f6398b0](https://github.com/jpwesselink/dotsec/commit/f6398b0f6a5829be93640421aba28dd73e012df4))
95
+
96
+
97
+
98
+
99
+
100
+ # [4.0.0-alpha.13](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.12...v4.0.0-alpha.13) (2023-05-22)
101
+
102
+
103
+ ### Features
104
+
105
+ * test ([535c584](https://github.com/jpwesselink/dotsec/commit/535c5844c06fda4b8bdd6d359e080f42033ef3a4))
106
+
107
+
108
+
109
+
110
+
111
+ # [4.0.0-alpha.12](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.11...v4.0.0-alpha.12) (2023-05-22)
112
+
113
+
114
+ ### Features
115
+
116
+ * test ([0694639](https://github.com/jpwesselink/dotsec/commit/06946392e67b69f6bf7e29417a29784871f6c0fe))
117
+
118
+
119
+
120
+
121
+
122
+ # [4.0.0-alpha.11](https://github.com/jpwesselink/dotsec/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2023-05-22)
123
+
124
+
125
+ ### Features
126
+
127
+ * test ([fd59d34](https://github.com/jpwesselink/dotsec/commit/fd59d34bc06d148557b3a97dfc5869b239b4f08c))
128
+
129
+
130
+
131
+
132
+
133
+ # [4.0.0-alpha.10](https://github.com/jpwesselink/dotsec/compare/v2.0.0-alpha.1...v4.0.0-alpha.10) (2023-05-22)
134
+
135
+ **Note:** Version bump only for package dotsec
package/README.md CHANGED
@@ -1,45 +1,7 @@
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
5
-
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
- ```
14
-
15
- With PKE support:
16
-
17
- ```sh
18
- npm install --save 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)
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.
43
5
 
44
6
  ## Features
45
7
 
@@ -67,7 +29,87 @@ When using the AWS plugin, dotsec can also push selected `.env`/`.sec` entries t
67
29
 
68
30
  - For initialisation enough credentials for creating a KMS key, and alias.
69
31
  - For usage enough credentials for using the KMS key to encrypt and/or decrypt.
70
- - An AWS KMS key with an alias. -->
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`.
71
113
  <!--
72
114
  ## Usage
73
115
 
@@ -85,15 +127,15 @@ Take not of the `KeyMetadata.KeyId` value, and create an alias for it:
85
127
  aws kms create-alias --alias-name alias/dotsec --target-key-id <key-id>
86
128
  ```
87
129
 
88
- ### Execute a command and use the values of a `.env` file in its environment
130
+ ### Execute a command and use the values of a .env file in its environment
89
131
 
90
- Create a `.env` file if you don't have one already, and add some values:
132
+ Create a .env file if you don't have one already, and add some values:
91
133
 
92
134
  ```sh
93
- echo "MY_FANCY_ENV_VAR='yes yes yallzies'\nHEY_HO='Let\'s go'" > `.env`
135
+ echo "MY_FANCY_ENV_VAR='yes yes yallzies'\nHEY_HO='Let\'s go'" > .env
94
136
  ```
95
137
 
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.)
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.)
97
139
 
98
140
  ```sh
99
141
  npx dotsec init --aws-region eu-west-1 [--aws-key-alias alias/dotsec]
@@ -101,28 +143,28 @@ npx dotsec init --aws-region eu-west-1 [--aws-key-alias alias/dotsec]
101
143
 
102
144
  The following files will be created:
103
145
 
104
- - ``.sec`` - The encrypted version of the ``.env`` file.
146
+ - `.sec` - The encrypted version of the `.env` file.
105
147
  - `dotsec.config.ts` - The config file containing the KMS key alias and AWS region.
106
148
 
107
149
  ### Add files to Git
108
150
 
109
- Add the ``.sec`` and `dotsec.config.ts` files to your repository, and commit these accordingly.
151
+ Add the `.sec` and `dotsec.config.ts` files to your repository, and commit these accordingly.
110
152
 
111
- ### Run a process with your `.env` file
153
+ ### Run a process with your .env file
112
154
 
113
155
  ```sh
114
- npx dotsec run --env `.env` command env
156
+ npx dotsec run --env .env command env
115
157
  ```
116
158
 
117
- ### Run a process with your `.sec` file
159
+ ### Run a process with your .sec file
118
160
 
119
161
  ```sh
120
- npx dotsec run --sec `.sec` command env
162
+ npx dotsec run --sec .sec command env
121
163
  ```
122
164
 
123
165
  For more options see `dotsec run --help`.
124
166
 
125
- ### Decrypt a `.sec` file to `.env`
167
+ ### Decrypt a .sec file to .env
126
168
 
127
169
  ```sh
128
170
  npx dotsec decrypt
@@ -130,7 +172,7 @@ npx dotsec decrypt
130
172
 
131
173
  For more options see `dotsec decrypt --help`.
132
174
 
133
- ### Encrypt a `.env` file to `.sec`
175
+ ### Encrypt a .env file to .sec
134
176
 
135
177
  ```sh
136
178
  npx dotsec encrypt
@@ -138,7 +180,7 @@ npx dotsec encrypt
138
180
 
139
181
  For more options see `dotsec encrypt --help`.
140
182
 
141
- ### Push selected `.env`/`.sec` entries to AWS Systems Manager Parameter Store
183
+ ### Push selected .env/.sec entries to AWS Systems Manager Parameter Store
142
184
 
143
185
  Take your favorite editor, and edit the `dotsec.config.ts` file. Add the following to the `aws` object:
144
186
 
@@ -162,7 +204,7 @@ Take your favorite editor, and edit the `dotsec.config.ts` file. Add the followi
162
204
  npx dotsec push --env --to-aws-ssm
163
205
  ```
164
206
 
165
- ### Push selected `.env`/`.sec` entries to AWS Secrets Manager
207
+ ### Push selected .env/.sec entries to AWS Secrets Manager
166
208
 
167
209
  Take your favorite editor, and edit the `dotsec.config.ts` file. Add the following to the `aws` object:
168
210
 
@@ -185,12 +227,12 @@ Take your favorite editor, and edit the `dotsec.config.ts` file. Add the followi
185
227
  ```sh
186
228
  npx dotsec push --env --to-aws-secrets-manager
187
229
  ``` -->
188
- <!--
230
+
189
231
  ### FAQ
190
232
 
191
- #### Is it safe to commit a ``.sec`` and `dotsec.config.ts` file alongside your code?
233
+ #### Is it safe to commit a `.sec` and `dotsec.config.ts` file alongside your code?
192
234
 
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.
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.
194
236
 
195
237
  #### Should I use this in production?
196
238
 
@@ -201,15 +243,15 @@ We do, however, since this package is relatively new, I don't think you should.
201
243
  - Write some tests already.
202
244
  - Add support in-code use like `dotsec.config()`
203
245
  - Add support for Node preload modules like `node -r dotsec/register index.js`
204
- - Add watcher for ``.env`` file changes and automatically encrypt
246
+ - Add watcher for `.env` file changes and automatically encrypt
205
247
  - Write guide on postinstall for npm/yarn/pnpm
206
- - Add chunking for encoding larger files with assymetric keys. Current limit is 4kb.
248
+ - ~~Add chunking for encoding larger files with assymetric keys. Current limit is 4kb.~~
207
249
  - 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.
250
+ - ~~Split up dotsec package in multiple packages, one for each encryption SDK.~~
209
251
  - Add support for pulling entries to GitHub actions secrets.
210
252
 
211
253
  ## Limitations
212
254
 
213
255
  - 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 -->
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
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");