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
@@ -133,6 +134,58 @@ For more information how to use the `crdsToDiscover` parameter, please refer to
133
134
134
135
</TabItem>
135
136
137
+
<TabItemvalue="jqConfiguration">
138
+
139
+
The K8s exporter supports configuration options to control access to environment variables within JQ queries used in resource mappings.
140
+
141
+
<h3> `allowAllEnvironmentVariablesInJQ` </h3>
142
+
143
+
The `allowAllEnvironmentVariablesInJQ` parameter controls whether all environment variables are accessible in JQ queries.
144
+
145
+
-**Default value**: `true` (all environment variables are accessible within JQ queries)
146
+
-**Security implications**: When set to `true`, JQ queries in your resource mappings can access any environment variable available to the exporter pod, including sensitive information like API keys, passwords, and other secrets (if those are mapped to the exporter pod as environment variables).
147
+
148
+
:::warning Security Risk
149
+
Setting `allowAllEnvironmentVariablesInJQ` to `true` can expose sensitive environment variables to JQ queries. This includes:
150
+
- Port credentials (`PORT_CLIENT_ID`, `PORT_CLIENT_SECRET`)
151
+
- Kubernetes service account tokens.
152
+
- Any other environment variables injected into the pod.
153
+
- Secrets mounted as environment variables.
154
+
155
+
Due to the potential security implication, if you have a need to limit the exposure of environment variables in the exporter's JQ, please set this parameter to `false` and explicitly specify the variables that need to be accessed using JQ through the `allowedEnvironmentVariablesInJQ` parameter.
156
+
:::
157
+
158
+
<h3> `allowedEnvironmentVariablesInJQ` </h3>
159
+
160
+
The `allowedEnvironmentVariablesInJQ` parameter specifies which environment variables are allowed in JQ queries when `allowAllEnvironmentVariablesInJQ` is set to `false`. This parameter accepts a list of JQ expressions that evaluate to environment variable names or patterns.
161
+
162
+
Each entry in the list is a JQ expression that should return:
163
+
- A specific environment variable name (e.g., `"CLUSTER_NAME"`)
164
+
- A pattern for matching multiple variables (e.g., `"^CLUSTER_"` to match all cluster-related environment variables)
165
+
- An array of environment variable names or patterns.
166
+
167
+
-**Default value**: `^PORT_, CLUSTER_NAME`
168
+
-**Use case**: Restrict access to only specific, safe environment variables in JQ queries for enhanced security. Use JQ expressions to dynamically determine which environment variables should be accessible.
169
+
170
+
<h3> Configuration Example </h3>
171
+
172
+
```yaml
173
+
allowAllEnvironmentVariablesInJQ: false
174
+
allowedEnvironmentVariablesInJQ:
175
+
- ^CLUSTER_
176
+
- AWS_REGION
177
+
- AWS_ACCOUNT_ID
178
+
resources:
179
+
- kind: v1/namespaces
180
+
...
181
+
```
182
+
183
+
This configuration allows:
184
+
- All environment variables starting with `CLUSTER_` (e.g., `CLUSTER_NAME`, `CLUSTER_ID`)
185
+
- Specific variables: `AWS_REGION` & `AWS_ACCOUNT_ID`
186
+
187
+
</TabItem>
188
+
136
189
</Tabs>
137
190
138
191
## Security Configuration
@@ -155,12 +208,12 @@ By using the `--set` flag, you can override specific exporter configuration para
For example, to set the parameters from the [security configuration](#security-configuration) section:
@@ -175,7 +228,6 @@ For example, to set the parameters from the [security configuration](#security-c
175
228
- A complete list of configuration parameters available when using the helm chart is available [here](https://github.com/port-labs/helm-charts/tree/main/charts/port-k8s-exporter#chart);
176
229
- An example skeleton `values.yml` file is available [here](https://github.com/port-labs/helm-charts/blob/main/charts/port-k8s-exporter/values.yaml).
177
230
178
-
179
231
## Extra environment variables
180
232
To pass extra environment variables to the exporter's runtime, you can use the Helm chart provided with the installation. You can do this in one of two ways:
0 commit comments