Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions book/src/workspace-trust.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
# Workspace trust

Helix has a number of potentially dangerous features, namely LSP and ability to use local to workspace configurations. Those features can lead to unexpected code execution. To protect against code execution in dangerous contexts, Helix has a workspace trust protection, which will prevent these potentially dangerous features from running automatically.
Helix includes two potentially dangerous features, both of which can execute arbitrary code:

Helix will not trust any workspace by default.
- Language servers (LSP)
- Local workspace configurations (`.helix/config.toml` and `.helix/languages.toml`)

By default, it will prompt about trust when you open new file in a workspace where you didn't make a decision about trust yet.
To protect against this, Helix includes workspace trust protection, which prevents these features from running automatically unless the workspace is explicitly trusted.

If you decide not to trust a workspace and don't want to be prompted about trust every time you start a new session in it, you can exclude the workspace by choosing `Never` option in trust selection window.
## Default trust behavior

You can always make current workspace trusted by running `:workspace-trust` command, and untrust it with `:workspace-untrust`.
Helix does not trust any workspace by default and will prompt you to choose the trust level when you open a file in a workspace where trust has not yet been set.

Lists of trusted and excluded workspaces, delimited by newline characters, are stored in `~/.local/share/helix/trusted_workspaces` and `~/.local/share/helix/excluded_workspaces` correspondingly.
<!-- TODO: Windows paths -->
## Changing workspace trust status

# Configuration
You can always make the current workspace trusted by running the `:workspace-trust` command, and untrust it using `:workspace-untrust`.

You can return to the old behaviour of loading every local `.helix/config.toml` and `.helix/languages.toml` and starting LSP's without an explicit permission by setting following option:
Lists of trusted and excluded workspaces, delimited by newline characters, are stored in:

- Linux and macOS: `~/.local/share/helix/trusted_workspaces` and `~/.local/share/helix/excluded_workspaces`
- Windows: `%AppData%\Roaming\helix\trusted_workspaces` and `%AppData%\Roaming\helix\excluded_workspaces`

## Configuration

You can disable workspace trust completely with:

```toml
[editor]
Expand Down
2 changes: 1 addition & 1 deletion helix-term/src/handlers/workspace_trust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn prompt(path: PathBuf, compositor: &mut Compositor) {

const TRUST_MESSAGE: &str = "Trust this workspace?

Trusted workspaces may load local config files and auto-start language servers. Config and language servers can execute arbitrary code. Only trust workspaces which you know contain harmless config and code.";
Trusted workspaces can load local Helix config files and automatically start language servers, both of which may execute arbitrary code. Only trust workspaces you know are safe.";

fn select() -> ui::Select<TrustUntrustStatus> {
ui::Select::new(
Expand Down