Skip to content

Commit 45a26da

Browse files
authored
Project trust - general settings (#10499)
2 parents f176434 + 3537b16 commit 45a26da

6 files changed

Lines changed: 58 additions & 9 deletions

File tree

docs/user_manual/expressions/expression.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ To create a new function:
361361
Custom Python functions stored as Project functions can be easily shared
362362
by sharing the project file where they were saved.
363363
When opening a project with project functions, QGIS can load or ignore them
364-
depending on whether :ref:`embedded Python code is enabled <load_project_code>`.
364+
depending on whether :ref:`embedded Python code is enabled <project_trust>`.
365365

366366
A new item is added in the left panel of the :guilabel:`Function Editor` tab.
367367

38.7 KB
Loading
131 KB
Loading
71.9 KB
Loading
179 KB
Loading

docs/user_manual/introduction/qgis_configuration.rst

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ displayed at the bottom of the frame.
109109

110110
**Project files**
111111

112+
.. _figure_project_files_settings:
113+
114+
.. figure:: img/project_files_settings.png
115+
:align: center
116+
117+
Project Files Settings
118+
112119
* :guilabel:`Open project on launch`
113120

114121
* 'Welcome Page' (default): can display the "News" feed, the project
@@ -132,14 +139,6 @@ displayed at the bottom of the frame.
132139
version of QGIS`. You can always open projects created with older version of
133140
QGIS but once the project is saved, trying to open with older release may fail
134141
because of features not available in that version.
135-
136-
.. _load_project_code:
137-
138-
* :guilabel:`Enable project's embedded Python code` |selectString|. This option
139-
handles execution of macros that are written to perform an action on project
140-
events, as well as custom Python functions to be used as expressions. You can
141-
choose between 'Never', 'Ask', 'For this session only' and
142-
'Always (not recommended)'.
143142
* :guilabel:`Default paths`: defines whether paths to files and layers used
144143
in new projects are stored as 'Absolute' or 'Relative' to the project file.
145144
This setting can be overwritten at the project level.
@@ -151,6 +150,56 @@ displayed at the bottom of the frame.
151150
embed auxiliary data`: the auxiliary data is stored in a separate :file:`.qgd`
152151
file along with the project file.
153152

153+
.. _project_trust:
154+
155+
**Project Trust**
156+
157+
These options control how QGIS handles execution of scripts
158+
in project files. Embedded code includes :ref:`macros <project_macros>`, :ref:`custom expression functions <vector_expressions>`,
159+
:ref:`actions <actions_menu>` and :ref:`attribute form initialization code <form_custom_functions>`. QGIS allows you to
160+
manage trust on a per-project or per-folder basis. When a project or folder is trusted, this applies to **all embedded scripts**
161+
contained within. Trust cannot be granted to individual scripts.
162+
163+
.. _figure_project_trust_settings:
164+
165+
.. figure:: img/project_trust_general.png
166+
:align: center
167+
168+
Project Trust Settings
169+
170+
* :guilabel:`Behavior for embedded scripts within projects of undetermined trust`:
171+
Use the dropdown menu to select how QGIS should respond when opening a project
172+
whose trust status has not yet been decided. Options include:
173+
174+
* :guilabel:`Never Execute`: block execution of all embedded scripts.
175+
* :guilabel:`Never Ask for Trust`: no request for project trust is made;
176+
undetermined or already denied projects have their embedded scripts blocked.
177+
Only trusted projects or folders have their embedded scripts executed.
178+
* :guilabel:`Ask for trust`: QGIS displays a trust dialog listing all embedded scripts
179+
and prompts you to allow or deny their execution. This is the default behavior.
180+
181+
.. _figure_security_prompt:
182+
183+
.. figure:: img/security_prompt.png
184+
:align: center
185+
186+
Security Prompt for Project Trust
187+
188+
* :guilabel:`Always Execute (Not recommended)`: enable execution of all embedded scripts;
189+
not recommended because it bypasses all safety checks and can run untrusted or malicious code without prompting.
190+
191+
* :guilabel:`Trusted projects and folders allowing embedded script execution`:
192+
This list shows project files or folders that you have explicitly marked as
193+
trusted. Projects located in these paths are allowed to run their embedded
194+
scripts without prompting. Use the |symbologyAdd|:sup:`Add new trusted project` or
195+
|symbologyRemove|:sup:`Remove trusted project or folder` buttons to manage the list.
196+
197+
* :guilabel:`Untrusted projects and folders denied embedded script execution`:
198+
Paths listed here are explicitly marked as untrusted. Projects stored in these
199+
locations will never run embedded scripts. Use the |symbologyAdd|:sup:`Add new project denial` or
200+
|symbologyRemove|:sup:`Remove denied project or folder` buttons to
201+
maintain the list.
202+
154203

155204
.. index:: Environment variables
156205
.. _`env_options`:

0 commit comments

Comments
 (0)