You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/secrets.md
+26-9Lines changed: 26 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ This feature allows you to decouple the use of secrets in your pipelines from th
13
13
14
14
When a pipeline is launched, Nextflow injects the secrets into the run without leaking them into temporary execution files. Secrets are provided to tasks as environment variables.
15
15
16
+
Secrets can be used with the local executor and grid executors (e.g., Slurm or Grid Engine). Secrets can be used with the AWS Batch executor when launched from [Seqera Platform](https://seqera.io/blog/pipeline-secrets-secure-handling-of-sensitive-information-in-tower/).
17
+
16
18
## Command line
17
19
18
20
The Nextflow {ref}`cli-secrets` sub-command can be used to manage secrets:
@@ -45,9 +47,32 @@ aws {
45
47
The above snippet accesses the secrets `MY_ACCESS_KEY` and `MY_SECRET_KEY` and assigns them to the corresponding AWS config settings.
46
48
47
49
:::{warning}
48
-
Secrets cannot be assigned to pipeline parameters.
50
+
Secrets should not be assigned to pipeline parameters, as they can be leaked by the pipeline.
51
+
:::
52
+
53
+
:::{versionadded} 25.10.0
49
54
:::
50
55
56
+
Nextflow supports the use of secrets provided by plugins (e.g., AWS secrets) in configuration. However, due to the way that plugins are loaded, there are specific considerations when using config secrets:
57
+
58
+
-**Initial config load**: Nextflow first loads the configuration _without_ secrets enabled. Any reference to a secret will return the empty string `''`.
59
+
60
+
-**Plugin resolution**: Plugins are resolved after the initial configuration load. This is because the configuration can specify additional plugins.
61
+
62
+
-**Config reloading**: If secrets are accessed during configuration and the initial load succeeds, Nextflow will reload the configuration with secrets enabled.
63
+
64
+
As a result, config secrets must be used in a way that does not cause the config resolution to fail when secrets are not present.
The above snippet includes a secured config only if the secret is present. Otherwise, it includes `/dev/null`, which is equivalent to including an empty file. The reference to `secrets.MY_SECRET` in the condition causes the config to be reloaded with secrets enabled, including secrets from plugins such as AWS secrets.
75
+
51
76
(secrets-pipeline-script)=
52
77
53
78
## Pipeline script
@@ -67,10 +92,6 @@ workflow {
67
92
The above example is only meant to demonstrate how to access a secret, not how to use it. In practice, sensitive information should not be printed to the console or output files.
68
93
:::
69
94
70
-
:::{note}
71
-
Secrets can only be used with the local or grid executors (e.g., Slurm or Grid Engine). Secrets can be used with the AWS Batch executor when launched from [Seqera Platform](https://seqera.io/blog/pipeline-secrets-secure-handling-of-sensitive-information-in-tower/).
72
-
:::
73
-
74
95
## Process directive
75
96
76
97
Secrets can be accesses by processes using the {ref}`process-secret` directive. For example:
@@ -92,7 +113,3 @@ In the above example, the secrets `MY_ACCESS_KEY` and `MY_SECRET_KEY` are inject
92
113
:::{warning}
93
114
Secrets are made available as environment variables in the process script. To prevent evaluation in the Nextflow script context, escape variable names with a backslash (e.g., `\$MY_ACCESS_KEY`) as shown above.
94
115
:::
95
-
96
-
:::{note}
97
-
Secrets can only be used with the local or grid executors (e.g., Slurm or Grid Engine). Secrets can be used with the AWS Batch executor when launched from [Seqera Platform](https://seqera.io/blog/pipeline-secrets-secure-handling-of-sensitive-information-in-tower/).
0 commit comments