-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dagger: support secrets in mounts + env
- Loading branch information
Showing
7 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
(def *memos* *dir*/bass.lock) | ||
|
||
; these tests are tricky, since we have to prevent the assertions themselves | ||
; from leaking secrets. so we just test against their hash. | ||
|
||
(def stdin-secret | ||
(from (linux/alpine) | ||
(.cat (mask "stdin hunter2" :stdin-secret)))) | ||
(-> ($ sh -c "test $(cat | sha1sum | awk '{print $1}') = 633f9fe12bfc15c301898555bfca62d852a1ad36") | ||
(with-stdin [(mask "stdin hunter2" :stdin-secret)])))) | ||
|
||
(def env-secret | ||
(from (linux/alpine) | ||
(-> ($ sh -c "echo $SECRET") | ||
(-> ($ sh -c "test $(echo -n $SECRET | sha1sum | awk '{print $1}') = 2ce29a2cf01ba01a109ce23a6d98d9fa59c6410c") | ||
(with-env {:SECRET (mask "env hunter2" :env-secret)})))) | ||
|
||
(def file-secret | ||
(from (linux/alpine) | ||
(-> ($ cat /tmp/secret) | ||
(-> ($ sh -c "test $(sha1sum /tmp/secret | awk '{print $1}') = 0a1980f57ebfb1b2cc022a6722a653be2f6eaaf2") | ||
(with-mount (mask "mount hunter2" :mount-secret) /tmp/secret)))) | ||
|
||
(def results | ||
[(-> stdin-secret (read :json) next) | ||
(-> env-secret (read :lines) next) | ||
(-> file-secret (read :lines) next)]) | ||
(run stdin-secret) | ||
(run env-secret) | ||
(run file-secret) | ||
|
||
(assert-does-not-contain-secret (*display*)) | ||
|
||
(map assert-export-does-not-contain-secret | ||
[stdin-secret env-secret file-secret]) | ||
|
||
results | ||
null |