Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit c341bbd

Browse files
authored
Merge pull request #1417 from dsalaza4/main
refac(back): #1378 deprecate secrets for gpg
2 parents addffc7 + 9a27d5a commit c341bbd

File tree

16 files changed

+10
-493
lines changed

16 files changed

+10
-493
lines changed

.github/workflows/dev.yml

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,6 @@ jobs:
5555
env:
5656
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
5757

58-
linux_envVars_example:
59-
runs-on: ubuntu-latest
60-
steps:
61-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
62-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
63-
name: /envVars/example
64-
with:
65-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /envVars/example"
66-
macos_envVars_example:
67-
runs-on: macos-latest
68-
steps:
69-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
70-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
71-
- name: /envVars/example
72-
run: nix-env -if . && m . /envVars/example
73-
7458
linux_formatBash:
7559
runs-on: ubuntu-latest
7660
steps:
@@ -244,38 +228,6 @@ jobs:
244228
with:
245229
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /lintWithAjv/test"
246230

247-
linux_secretsForEnvFromSops_example:
248-
runs-on: ubuntu-latest
249-
steps:
250-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
251-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
252-
name: /secretsForEnvFromSops/example
253-
with:
254-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /secretsForEnvFromSops/example"
255-
macos_secretsForEnvFromSops_example:
256-
runs-on: macos-latest
257-
steps:
258-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
259-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
260-
- name: /secretsForEnvFromSops/example
261-
run: nix-env -if . && m . /secretsForEnvFromSops/example
262-
263-
linux_secretsForGpgFromEnv_example:
264-
runs-on: ubuntu-latest
265-
steps:
266-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
267-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
268-
name: /secretsForGpgFromEnv/example
269-
with:
270-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /secretsForGpgFromEnv/example"
271-
macos_secretsForGpgFromEnv_example:
272-
runs-on: macos-latest
273-
steps:
274-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
275-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
276-
- name: /secretsForGpgFromEnv/example
277-
run: nix-env -if . && m . /secretsForGpgFromEnv/example
278-
279231
linux_testLicense:
280232
runs-on: ubuntu-latest
281233
steps:
@@ -340,22 +292,6 @@ jobs:
340292
- name: /tests/makeScript
341293
run: nix-env -if . && m . /tests/makeScript
342294

343-
linux_tests_secretsForGpgFromEnv:
344-
runs-on: ubuntu-latest
345-
steps:
346-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
347-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
348-
name: /tests/secretsForGpgFromEnv
349-
with:
350-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /tests/secretsForGpgFromEnv"
351-
macos_tests_secretsForGpgFromEnv:
352-
runs-on: macos-latest
353-
steps:
354-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
355-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
356-
- name: /tests/secretsForGpgFromEnv
357-
run: nix-env -if . && m . /tests/secretsForGpgFromEnv
358-
359295
linux_testTerraform_module:
360296
runs-on: ubuntu-latest
361297
steps:

.github/workflows/prod.yml

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,6 @@ jobs:
133133
env:
134134
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
135135

136-
linux_envVars_example:
137-
runs-on: ubuntu-latest
138-
steps:
139-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
140-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
141-
name: /envVars/example
142-
with:
143-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /envVars/example"
144-
env:
145-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
146-
macos_envVars_example:
147-
runs-on: macos-latest
148-
steps:
149-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
150-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
151-
- name: /envVars/example
152-
run: nix-env -if . && m . /envVars/example
153-
env:
154-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
155-
156136
linux_formatBash:
157137
runs-on: ubuntu-latest
158138
steps:
@@ -368,46 +348,6 @@ jobs:
368348
env:
369349
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
370350

371-
linux_secretsForEnvFromSops_example:
372-
runs-on: ubuntu-latest
373-
steps:
374-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
375-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
376-
name: /secretsForEnvFromSops/example
377-
with:
378-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /secretsForEnvFromSops/example"
379-
env:
380-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
381-
macos_secretsForEnvFromSops_example:
382-
runs-on: macos-latest
383-
steps:
384-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
385-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
386-
- name: /secretsForEnvFromSops/example
387-
run: nix-env -if . && m . /secretsForEnvFromSops/example
388-
env:
389-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
390-
391-
linux_secretsForGpgFromEnv_example:
392-
runs-on: ubuntu-latest
393-
steps:
394-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
395-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
396-
name: /secretsForGpgFromEnv/example
397-
with:
398-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /secretsForGpgFromEnv/example"
399-
env:
400-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
401-
macos_secretsForGpgFromEnv_example:
402-
runs-on: macos-latest
403-
steps:
404-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
405-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
406-
- name: /secretsForGpgFromEnv/example
407-
run: nix-env -if . && m . /secretsForGpgFromEnv/example
408-
env:
409-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
410-
411351
linux_testLicense:
412352
runs-on: ubuntu-latest
413353
steps:
@@ -484,26 +424,6 @@ jobs:
484424
env:
485425
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
486426

487-
linux_tests_secretsForGpgFromEnv:
488-
runs-on: ubuntu-latest
489-
steps:
490-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
491-
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
492-
name: /tests/secretsForGpgFromEnv
493-
with:
494-
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /tests/secretsForGpgFromEnv"
495-
env:
496-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
497-
macos_tests_secretsForGpgFromEnv:
498-
runs-on: macos-latest
499-
steps:
500-
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
501-
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
502-
- name: /tests/secretsForGpgFromEnv
503-
run: nix-env -if . && m . /tests/secretsForGpgFromEnv
504-
env:
505-
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
506-
507427
linux_testTerraform_module:
508428
runs-on: ubuntu-latest
509429
steps:

docs/src/api/builtins/secrets.md

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -192,90 +192,6 @@ Example:
192192
}
193193
```
194194

195-
## secretsForGpgFromEnv
196-
197-
Load GPG public or private keys
198-
from environment variables
199-
into an ephemeral key-ring.
200-
201-
Each key content must be stored
202-
in a environment variable
203-
in [ASCII Armor](https://www.techopedia.com/definition/23150/ascii-armor) format.
204-
205-
Types:
206-
207-
- secretsForGpgFromEnv (`attrsOf (listOf str)`): Optional.
208-
Mapping of name
209-
to a list of environment variable names
210-
where the GPG key contents are stored.
211-
Defaults to `{ }`.
212-
213-
Example:
214-
215-
=== "secrets.yaml"
216-
217-
```yaml
218-
# /path/to/my/project/secrets.yaml
219-
password: ENC[AES256_GCM,data:cLbgzNHgBN5drfsDAS+RTV5fL6I=,iv:2YHhHxKg+lbGqdB5nhhG2YemeKB6XWvthGfNNkVgytQ=,tag:cj/el3taq1w7UOp/JQSNwA==,type:str]
220-
# ...
221-
```
222-
223-
=== "makes.nix"
224-
225-
```nix
226-
# /path/to/my/project/makes.nix
227-
{
228-
outputs,
229-
...
230-
}: {
231-
# Load keys into an ephemeral GPG keyring
232-
secretsForGpgFromEnv = {
233-
example = [
234-
"ENV_VAR_FOR_PRIVATE_KEY_CONTENT"
235-
"ENV_VAR_FOR_PUB_KEY_CONTENT"
236-
];
237-
};
238-
# Use sops to decrypt an encrypted file
239-
secretsForEnvFromSops = {
240-
example = {
241-
manifest = "/secrets.yaml";
242-
vars = [ "password" ];
243-
};
244-
};
245-
}
246-
```
247-
248-
=== "main.nix"
249-
250-
```nix
251-
# /path/to/my/project/makes/example/main.nix
252-
{
253-
makeScript,
254-
outputs,
255-
...
256-
}:
257-
makeScript {
258-
name = "example";
259-
searchPaths.source = [
260-
# First setup an ephemeral GPG keyring
261-
outputs."/secretsForGpgFromEnv/example"
262-
# Now sops will decrypt secrets using the GPG keys in the ring
263-
outputs."/secretsForEnvFromSops/example"
264-
];
265-
entrypoint = ''
266-
echo Decrypted password: $password
267-
'';
268-
}
269-
```
270-
271-
=== "Invocation"
272-
273-
```bash
274-
$ m . /example
275-
276-
Decrypted password: 123
277-
```
278-
279195
## secretsForTerraformFromEnv
280196

281197
Export secrets in a format suitable for Terraform

docs/src/security/threat-model.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@
118118
For example:
119119
`secretsForAwsFromEnv`,
120120
`secretsForAwsFromGitlab`,
121-
`secretsForEnvFromSops`,
122-
`secretsForGpgFromEnv`, and
121+
`secretsForEnvFromSops`, and
123122
`secretsForTerraformFromEnv`.
124123
125124
However, we don't currently have a way to protect the user

src/args/agnostic.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ let
8080
import ./make-secret-for-aws-from-gitlab/default.nix self;
8181
makeSecretForEnvFromSops =
8282
import ./make-secret-for-env-from-sops/default.nix self;
83-
makeSecretForGpgFromEnv =
84-
import ./make-secret-for-gpg-from-env/default.nix self;
8583
makeSecretForKubernetesConfigFromAws =
8684
import ./make-secret-for-kubernetes-config-from-aws/default.nix self;
8785
makeSecretForNomadFromEnv =

src/args/make-secret-for-gpg-from-env/default.nix

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/args/make-secret-for-gpg-from-env/template.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/evaluator/modules/default.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
(import ./secrets-for-aws-from-env/default.nix args)
2828
(import ./secrets-for-aws-from-gitlab/default.nix args)
2929
(import ./secrets-for-env-from-sops/default.nix args)
30-
(import ./secrets-for-gpg-from-env/default.nix args)
3130
(import ./secrets-for-terraform-from-env/default.nix args)
3231
(import ./test-license/default.nix args)
3332
(import ./test-terraform/default.nix args)

src/evaluator/modules/secrets-for-gpg-from-env/default.nix

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/makes.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
./makeSearchPaths/makes.nix
99
./makeTemplate/makes.nix
1010
./pipelines/makes.nix
11-
./secretsForEnvFromSops/makes.nix
12-
./secretsForGpgFromEnv/makes.nix
1311
./terraform/makes.nix
1412
];
1513
}

0 commit comments

Comments
 (0)