pub enum WorkspaceRegistriesSetting {
Off,
PublicOnly,
All,
}Expand description
Controls which workspace-declared registry index hosts this LSP will ever fetch.
Shared by every ecosystem with a workspace-declared-registry concept (spec #443,
plan-1b §1.1/§1.7; 032-npm-npmrc-registry-support FR-008 widened this from Cargo-only
to cross-ecosystem).
Applies to Cargo’s registry/registry-index alias path (#440), a
[source.crates-io] replace-with chain (1b), and npm’s .npmrc registry=/
@scope:registry= resolution alike. Never affects a $CARGO_HOME/config.toml-configured
Cargo registry, which is the user’s own trusted configuration, not something a cloned
repository controls — npm’s .npmrc has no equivalent always-trusted tier (both its
project and user tiers are policy-symmetric, since phase 1 carries no credential
provenance to protect).
§Defaults
"public_only" — blocking the observed attack shape (an IP literal in a metadata/RFC1918
range) without breaking a legitimate corporate https://index.mycorp.dev registry (a DNS
name cannot be classified as internal without resolving it — see
deps_core::net_policy’s module docs for the residual risk this leaves and why off
is the only complete boundary).
§Examples
use deps_lsp::config::WorkspaceRegistriesSetting;
let setting: WorkspaceRegistriesSetting = serde_json::from_str("\"off\"").unwrap();
assert_eq!(setting, WorkspaceRegistriesSetting::Off);Variants§
Off
Block every workspace-declared registry index — the only complete boundary. This
blocks the registry/registry-index alias path as well as [source]; it does
not affect $CARGO_HOME-configured registries, which keep working.
PublicOnly
Allow only a host classified as public (spec deps_core::net_policy::HostClass::Global).
All
Allow every workspace-declared index, including loopback/RFC1918/metadata-range hosts — today’s pre-#443 behavior, the escape hatch for a workspace that legitimately points at one.
Implementations§
Source§impl WorkspaceRegistriesSetting
impl WorkspaceRegistriesSetting
Sourcepub const fn to_policy(self) -> WorkspaceRegistryAccess
pub const fn to_policy(self) -> WorkspaceRegistryAccess
Converts this LSP-facing setting into the deps-core policy value threaded through
deps_cargo::config::RegistryIndex::new.
§Examples
use deps_core::net_policy::WorkspaceRegistryAccess;
use deps_lsp::config::WorkspaceRegistriesSetting;
assert_eq!(
WorkspaceRegistriesSetting::Off.to_policy(),
WorkspaceRegistryAccess::Off
);Trait Implementations§
Source§impl Clone for WorkspaceRegistriesSetting
impl Clone for WorkspaceRegistriesSetting
Source§fn clone(&self) -> WorkspaceRegistriesSetting
fn clone(&self) -> WorkspaceRegistriesSetting
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WorkspaceRegistriesSetting
Source§impl Debug for WorkspaceRegistriesSetting
impl Debug for WorkspaceRegistriesSetting
Source§impl Default for WorkspaceRegistriesSetting
impl Default for WorkspaceRegistriesSetting
Source§fn default() -> WorkspaceRegistriesSetting
fn default() -> WorkspaceRegistriesSetting
Source§impl<'de> Deserialize<'de> for WorkspaceRegistriesSetting
impl<'de> Deserialize<'de> for WorkspaceRegistriesSetting
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for WorkspaceRegistriesSetting
Source§impl PartialEq for WorkspaceRegistriesSetting
impl PartialEq for WorkspaceRegistriesSetting
Source§fn eq(&self, other: &WorkspaceRegistriesSetting) -> bool
fn eq(&self, other: &WorkspaceRegistriesSetting) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for WorkspaceRegistriesSetting
Auto Trait Implementations§
impl Freeze for WorkspaceRegistriesSetting
impl RefUnwindSafe for WorkspaceRegistriesSetting
impl Send for WorkspaceRegistriesSetting
impl Sync for WorkspaceRegistriesSetting
impl Unpin for WorkspaceRegistriesSetting
impl UnsafeUnpin for WorkspaceRegistriesSetting
impl UnwindSafe for WorkspaceRegistriesSetting
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more