Commit 18d66c0
committed
feat(helix-loader): allow managing trust from configuration
This allows managing trust via the `config.toml` via the `paths` vector
in the `[editor.trust]` section. The path of the workspace is matched
against the entries in the `path` array while expanding globbing (a
`*` matches a single unspecified path component, a `**` matches all
subdirectories) and supporting a leading `~/` as shorthand for the home
directory. Prefixing a path with `!` can be used to deny trust. The last
matching entry wins.
For the following example:
```toml
[editor.trust]
paths = [
"~/repos/helix",
"~/repos/foo/*",
"~/repos/bar/**",
"!~/repos/bar/untrusted"
]
```
This would result in the following trust levels assuming the home
directory `/home/user`:
| Path | Decision |
|:----------------------------------------------- |:------------------- |
| `/home/user/foobar` | undecided |
| `/home/user/repos/helix` | trusted |
| `/home/other/repos/helix` | undecided |
| `/home/user/repos/helix/branch_a` | undecided |
| `/home/user/repos/foo` | undecided |
| `/home/user/repos/foo/branch_a` | trusted |
| `/home/user/repos/foo/remote_a/branch_a` | undecided |
| `/home/user/repos/bar/branch_a` | trusted |
| `/home/user/repos/bar/remote_a/branch_a` | trusted |
| `/home/user/repos/bar/untrusted` | untrusted |
In case the configuration does not decide to trust or untrust a given
working directory, the existing trust mechanism to prompt the user for
each new working directory and storing the decision in an internal
database is used.
In other words: Users that don't want to make use of the new interface
and only use the old model can just leave the `config.toml` unchanged
and will never be bothered with this. On the other hand users only
wanting to use the configuration can do so using:
```toml
[editor.trust]
paths = [
"!**",
"~/repos/helix",
...
]
```
Since the first item (`!**`) matches every work space and denies trust,
this configuration will deny trust to all workspaces unless later items
override this.
The `insecure` configuration from the editor has been removed, as the
same result can be achieved with:
```toml
[editor.trust]
paths= [ "**" ]
```1 parent ad6a0db commit 18d66c0
13 files changed
Lines changed: 302 additions & 43 deletions
File tree
- book/src
- helix-core/src
- helix-loader
- src
- helix-term/src
- handlers
- helix-view/src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
| 21 | + | |
| 22 | + | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
0 commit comments