Skip to content

Commit 87ee129

Browse files
authored
fix(docs): fix schema and add documentation for rules prefixes in scenario settings (#669)
2 parents d0d3316 + c8bfc77 commit 87ee129

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

docs/reference/qdt_profile.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ You can also deploy profiles based on environment variables. In the following ex
7070
}
7171
```
7272

73+
By default, only prefixed variables can be used in rules. Default prefixes are `QDT_` and `QGIS_`. You can use your own prefixes in scenario settings:
74+
75+
```json
76+
[...]
77+
78+
settings:
79+
RULES_VARIABLES_PREFIX: "QDT_,QGIS_,MYPREFIX_,MYOTHERPREFIX_"
80+
81+
[...]
82+
```
83+
84+
You can by-pass prefix check by setting `RULES_ONLY_PREFIXED_VARIABLES` to `false` in scenario settings.
85+
86+
:::{warning}
87+
Be careful if you allow all variables, as it could cause security issues.
88+
:::
89+
7390
### Conditions and rules context
7491

7592
Rules is a set of conditions that use logical operators to compare values with context (a set of facts) which is exposed as a JSON object. Here comes the context for a Linux environment:

docs/schemas/scenario/settings.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,13 @@
8888
"type": "boolean"
8989
},
9090
"RULES_VARIABLES_PREFIX": {
91-
"default": [
92-
"QDT_,QGIS_"
91+
"default": "QDT_,QGIS_",
92+
"description": "List of prefixes of environment variables considered in rules. Only relevant if RULES_ONLY_PREFIXED_VARIABLES is set to `true`. The list is comma-separated. For example: `QDT_,QGIS_,MYPREFIX_`. The default value is `QDT_,QGIS_`.",
93+
"examples": [
94+
"QGIS_,QDT_,MYPREFIX_,MYOTHERPREFIX_"
9395
],
94-
"description": "List of prefixes of environment variables considered in rules. Only relevant if RULES_ONLY_PREFIXED_VARIABLES is set to `true`.",
9596
"title": "Variables prefixes",
96-
"type": "array",
97-
"items": {
98-
"type": "string"
99-
}
97+
"type": "string"
10098
},
10199
"SCENARIO_VALIDATION": {
102100
"default": false,

docs/usage/scenario.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A step consists of 3 elements:
2323

2424
- `name`: the name of the step
2525
- `uses` : the job identifier to use
26-
- with` : the parameters to pass to the Job
26+
- `with` : the parameters to pass to the Job
2727

2828
```{button-link} ../jobs/index.html
2929
:color: primary

docs/usage/settings.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Some others parameters can be set using environment variables.
2525
| `QDT_LOGS_DIR` | Folder where QDT writes the log files, which are automatically rotated. | `~/.cache/qgis-deployment-toolbelt/logs/` |
2626
| `QDT_OSGEO4W_INSTALL_DIR` | Path to the OSGEO4W install directory. Used to search for installed QGIS and shortcuts creation. | `C:\\OSGeo4W`. |
2727
| `QDT_QGIS_EXE_PATH` | Path to the QGIS executable to use. Used in shortcuts. | `/usr/bin/qgis` on Linux and MacOS, `%PROGRAMFILES%/QGIS 3.28/bin/qgis-ltr-bin.exe` on Windows. |
28+
| `QDT_RULES_ONLY_PREFIXED_VARIABLES` | If set to `true`, only environment variables prefixed with prefixes listed in RULES_VARIABLES_PREFIX are considered in rules for security concerns. If set to `false`, all environment variables are considered in rules. | `true` |
29+
| `QDT_RULES_VARIABLES_PREFIX` | List of prefixes of environment variables considered in rules. Only relevant if RULES_ONLY_PREFIXED_VARIABLES is set to `true`. The list is comma-separated. For example: `QDT_,QGIS_,MYPREFIX_`. | `QDT_,QGIS_` |
2830
| `QDT_STREAMED_DOWNLOADS` | If set to `false`, the content of remote files is fully downloaded before being written locally. | `true` |
2931
| `QDT_SSL_USE_SYSTEM_STORES` | By default, a bundle of SSL certificates is used, through [certifi](https://pypi.org/project/certifi/). If this environment variable is set to `true`, QDT tries to uses the system certificates store. Based on [truststore](https://truststore.readthedocs.io/). See also [How to use custom SSL certificates](../guides/howto_use_custom_ssl_certs.md). | `False` |
3032
| `QDT_SSL_VERIFY` | Enables/disables SSL certificate verification. Useful for environments where the proxy is unreliable with HTTPS connections. Boolean: `true` or `false`. | `True` |

0 commit comments

Comments
 (0)