Skip to main content

UntrustedRefusal

Enum UntrustedRefusal 

Source
#[non_exhaustive]
pub enum UntrustedRefusal {
Show 19 variants NotAllowed { builtin: Option<BuiltinServer>, }, WorkspaceExecutable { executable: PathBuf, }, UnresolvedExecutable { command: ServerCommand, }, AutoSelectionTarget { executable: ServerCommand, cause: InvalidAutoSelection, }, WorkspaceHome { variable: HomeVariable, home: PathBuf, }, EmptyHome { variable: HomeVariable, }, UnknownHome, WorkspaceTsserver { tsserver: PathBuf, }, ProjectLauncher { command: ServerCommand, cause: LauncherRefusal, }, WorkspaceExecutableArgument { index: usize, executable: PathBuf, }, UnreadableWorkspaceArgument { index: usize, path: PathBuf, }, UnresolvedWrappedProgram { program: EchoedPath, }, WrappedProgramPathContainsEquals { program: EchoedPath, }, UnpinnedTypescriptLauncher { command: ServerCommand, }, NonUtf8Path { what: ResolvedItem, path: PathBuf, }, BlankResolvedPath { what: ResolvedItem, }, NulInResolvedPath { what: ResolvedItem, }, NoSafeWorkingDirectory, EnvTooLarge { error: EnvTooLarge, },
}
Expand description

Why untrusted-workspace mode refused to start a server.

§Examples

use mcpls_core::config::BuiltinServer;
use mcpls_core::error::UntrustedRefusal;

let refusal = UntrustedRefusal::NotAllowed {
    builtin: Some(BuiltinServer::RustAnalyzer),
};
assert!(refusal.to_string().contains("Cargo build scripts"));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

NotAllowed

The server was not named with --allow-server.

Fields

§builtin: Option<BuiltinServer>

The built-in server this is, whose workspace-code class is named in the message; None for a custom server.

§

WorkspaceExecutable

The server’s executable lies inside the workspace. Naming the server does not consent to running a binary the workspace supplies.

Fields

§executable: PathBuf

The canonical path of the executable.

§

UnresolvedExecutable

The executable was not found on a search path outside the workspace, so untrusted mode cannot tell what would run.

Fields

§command: ServerCommand

The configured command.

§

AutoSelectionTarget

The auto-selected TypeScript command resolved to an executable that is not typescript-language-server (a PATH entry symlinked to another program), so it cannot be hardened without dropping the tsserver pin.

Fields

§executable: ServerCommand

The resolved executable the command would have been replaced with.

§cause: InvalidAutoSelection

Why the selection cannot follow the resolved executable.

§

WorkspaceHome

The login home directory is unknown and the inherited HOME lies inside the workspace, where rustup, cargo and npm would read their configuration from.

Fields

§variable: HomeVariable

The variable that names the home directory.

§home: PathBuf

The path the server would inherit, inside the workspace.

§

EmptyHome

The login home directory is unknown and a home variable is empty, so tools resolve it against the working directory, which is the checkout.

Fields

§variable: HomeVariable

The variable that is empty.

§

UnknownHome

The login home directory is unknown and HOME is not set, so tools would resolve ~ against the working directory, which is the checkout.

§

WorkspaceTsserver

The tsserver the TypeScript server would use lies inside the workspace.

Fields

§tsserver: PathBuf

The canonical path of the tsserver.

§

ProjectLauncher

The configured command is a launcher that chooses the server from files in the workspace (a package runner, task runner or toolchain wrapper), so what would run is under the workspace’s control.

Fields

§command: ServerCommand

The configured command.

§cause: LauncherRefusal

What about the launch the analysis refused.

§

WorkspaceExecutableArgument

An argument of the configured command names an executable file inside the workspace, which whatever launcher precedes it would start.

Fields

§index: usize

The position of the argument in the configured args.

§executable: PathBuf

The canonical path of the executable.

§

UnreadableWorkspaceArgument

An argument of the configured command lies inside the workspace and cannot be read, so untrusted mode cannot tell whether it is an executable.

Fields

§index: usize

The position of the argument in the configured args.

§path: PathBuf

The path the argument names, lexically normalized.

§

UnresolvedWrappedProgram

A program an exec wrapper or env starts was not found on a search path outside the workspace, so untrusted mode cannot tell what would run.

Fields

§program: EchoedPath

The wrapped program, as configured.

§

WrappedProgramPathContainsEquals

The vetted path of a program that env starts contains =, which env would read as an assignment, so it cannot be passed on unchanged.

Fields

§program: EchoedPath

The wrapped program, as configured.

§

UnpinnedTypescriptLauncher

The configured command starts the TypeScript server through a launcher that untrusted mode cannot pin to a binary outside the workspace.

Fields

§command: ServerCommand

The configured command.

§

NonUtf8Path

A resolved path is not valid UTF-8, so untrusted mode cannot pass it on unchanged.

Fields

§what: ResolvedItem

What the path belongs to.

§path: PathBuf

The path, as resolved.

§

BlankResolvedPath

A resolved path is blank, so there is nothing to start.

Fields

§what: ResolvedItem

What the path belongs to.

§

NulInResolvedPath

A resolved path contains a NUL, which the operating system cannot pass in a path or environment variable.

Fields

§what: ResolvedItem

What the path belongs to.

§

NoSafeWorkingDirectory

No directory outside the workspace is available for the server to start in.

§

EnvTooLarge

The variables untrusted mode sets for the server do not fit in its env table.

Fields

§error: EnvTooLarge

Which limit the table would be over.

Trait Implementations§

Source§

impl Clone for UntrustedRefusal

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UntrustedRefusal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for UntrustedRefusal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for UntrustedRefusal

Source§

impl PartialEq for UntrustedRefusal

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UntrustedRefusal

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more