pub struct LocalStoragePolicy { /* private fields */ }Expand description
An allowlist of host filesystem roots that may back file:// storage
locations.
Construct via LocalStoragePolicy::new; an empty policy denies all local
storage. Held on the server handler and reached by request handlers through
ProvidesLocalStoragePolicy.
Implementations§
Source§impl LocalStoragePolicy
impl LocalStoragePolicy
Sourcepub fn new<I, P>(roots: I) -> Result<Self>
pub fn new<I, P>(roots: I) -> Result<Self>
Build a policy from configured root paths.
Each root is canonicalized (resolving symlinks and ..) so later prefix
checks compare against a stable, real path. A root that does not exist or
cannot be canonicalized is a configuration error — surfacing it at
startup is preferable to silently denying every local location later.
Sourcepub fn deny_all() -> Self
pub fn deny_all() -> Self
A deny-all policy (no allowed roots). The default for a server with no
local_storage configuration.
Sourcepub fn check(&self, location: &StorageLocationUrl) -> Result<()>
pub fn check(&self, location: &StorageLocationUrl) -> Result<()>
Authorize a storage location.
Cloud schemes pass through untouched. A file:// location is accepted
only when its host path — with .. rejected and . collapsed — sits at
or beneath an allowed root. With no allowed roots, every file://
location is rejected.
Trait Implementations§
Source§impl Clone for LocalStoragePolicy
impl Clone for LocalStoragePolicy
Source§fn clone(&self) -> LocalStoragePolicy
fn clone(&self) -> LocalStoragePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalStoragePolicy
impl Debug for LocalStoragePolicy
Source§impl Default for LocalStoragePolicy
impl Default for LocalStoragePolicy
Source§fn default() -> LocalStoragePolicy
fn default() -> LocalStoragePolicy
Auto Trait Implementations§
impl Freeze for LocalStoragePolicy
impl RefUnwindSafe for LocalStoragePolicy
impl Send for LocalStoragePolicy
impl Sync for LocalStoragePolicy
impl Unpin for LocalStoragePolicy
impl UnsafeUnpin for LocalStoragePolicy
impl UnwindSafe for LocalStoragePolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request