Skip to content

Commit 8cea831

Browse files
committed
Add section on trusted projects
1 parent 466960b commit 8cea831

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

docs/02-usage/070_security.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,59 @@ Sandboxing is the most effective way to mitigate risks when using coding agents.
4444

4545
While setting up a sandboxed environment may require some initial effort, we highly recommend it for all security-conscious users.
4646

47+
(trusted-projects)=
48+
## Trusted Projects
49+
50+
Sandboxing limits what Serena can affect while doing what it was asked to do.
51+
The notion of *trusted projects* addresses a different question: to what extent may the repository being worked on
52+
influence Serena's behaviour in the first place?
53+
54+
A project is an input authored by whoever produced the repository, and it comprises more than source code:
55+
it also carries configuration (`.serena/project.yml`) as well as file system structure.
56+
Trust determines whether such repository-supplied input may influence Serena beyond having the code read and
57+
analysed as code — for example, by executing commands, by changing how dependencies are acquired, or by causing
58+
Serena to access locations outside the project root.
59+
Trust is decided by the project's root path, which is matched against `trusted_project_path_patterns` in Serena's
60+
[global configuration](global-config).
61+
62+
We gate a feature on project trust whenever honouring repository-supplied input could have an effect beyond the
63+
scope of what the user visibly requested: activating a project is not a request to run a command, and searching a
64+
project's files is not a request to read files outside of it.
65+
66+
### A Functionality Boundary, Not a Containment Boundary
67+
68+
Untrusted projects are not sandboxed, restricted or otherwise contained.
69+
They are read, analysed and edited just like any other project; the only difference is that a small set of
70+
capabilities is unavailable to them.
71+
As soon as the agent is asked to do anything at all, the full tool surface applies to an untrusted project as well:
72+
commands can be executed, files can be modified, and the repository's contents can influence the LLM.
73+
74+
Consequently, our assumption that the repository being worked on is trusted (see above) remains fully in force.
75+
Trust patterns eliminate a class of particularly straightforward attacks, namely those requiring no user
76+
interaction beyond opening a project, but exploits can generally not be prevented by such means.
77+
The question to ask is therefore not "is this project safe to work on because it is untrusted?" but rather
78+
"do I trust this repository enough to grant it the additional capabilities?".
79+
If a repository is not trustworthy, [sandboxing](sandboxing) is the answer, not the trust configuration.
80+
81+
### Trust-Gated Features
82+
83+
The set of trust-gated features is subject to change and can be expected to grow.
84+
The settings that require trust are annotated accordingly in the project configuration (see
85+
[configuration](050_configuration)); the two following current examples illustrate the principle:
86+
87+
- `activation_command` is a shell command that a project can request to be run whenever it is activated.
88+
Without trust gating, merely opening a repository in Serena would execute code chosen by its author,
89+
before the user has issued a single request.
90+
- `ls_specific_settings` can, among other things, override the package version and the package registry from
91+
which a language server is acquired.
92+
Without trust gating, a repository could thereby silently circumvent the supply chain protections described
93+
below (version pinning, host restrictions) and cause attacker-controlled code to be downloaded and executed.
94+
95+
Note that the effective set of trusted paths depends on the age of your configuration: installations predating
96+
the introduction of this setting retain a pattern that trusts all projects, ensuring that existing workflows are
97+
not broken, whereas newly created configurations trust no project by default.
98+
The applicable value can be inspected in the dashboard.
99+
47100
(network-security)=
48101
## Network Security
49102

0 commit comments

Comments
 (0)