#[non_exhaustive]pub struct ReferencePolicy { /* private fields */ }Expand description
The external resources a config of one origin may reach.
Every dimension is either open (None — anything) or an allow-list
(Some(list); an empty list allows nothing). ReferencePolicy::default
is ReferencePolicy::deny_all: a policy only allows what it is told to.
Implementations§
Source§impl ReferencePolicy
impl ReferencePolicy
Sourcepub fn with_path_roots<I, P>(self, roots: I) -> Self
pub fn with_path_roots<I, P>(self, roots: I) -> Self
Allow local paths only under these directories.
Sourcepub fn with_url_schemes<I, S>(self, schemes: I) -> Self
pub fn with_url_schemes<I, S>(self, schemes: I) -> Self
Allow URLs only with these schemes (https, postgres, …).
Sourcepub fn any_url_scheme(self) -> Self
pub fn any_url_scheme(self) -> Self
Allow URLs of any scheme.
Sourcepub fn with_url_hosts<I, S>(self, hosts: I) -> Self
pub fn with_url_hosts<I, S>(self, hosts: I) -> Self
Allow URLs only to these hosts (api.example.com, *.example.com,
10.0.0.5). A link-local or metadata host is reachable only when listed.
Sourcepub fn any_url_host(self) -> Self
pub fn any_url_host(self) -> Self
Allow URLs to any host except link-local and metadata endpoints.
Sourcepub fn with_env<I, S>(self, names: I) -> Self
pub fn with_env<I, S>(self, names: I) -> Self
Allow only these environment variables (NAME or PREFIX*).
Sourcepub fn with_secret_schemes<I, S>(self, schemes: I) -> Self
pub fn with_secret_schemes<I, S>(self, schemes: I) -> Self
Allow only these secret-manager schemes (vault, aws-sm, …).
Sourcepub fn any_secret_scheme(self) -> Self
pub fn any_secret_scheme(self) -> Self
Allow any secret-manager scheme.
Sourcepub fn with_subprocess(self, allowed: bool) -> Self
pub fn with_subprocess(self, allowed: bool) -> Self
Whether connectors that run a program are allowed.
Sourcepub fn path_roots(&self) -> Option<&[PathBuf]>
pub fn path_roots(&self) -> Option<&[PathBuf]>
The allowed path roots, None when any path is allowed.
Sourcepub fn url_schemes(&self) -> Option<&BTreeSet<String>>
pub fn url_schemes(&self) -> Option<&BTreeSet<String>>
The allowed URL schemes, None when any scheme is allowed.
Sourcepub fn url_host_patterns(&self) -> Option<&[String]>
pub fn url_host_patterns(&self) -> Option<&[String]>
The allowed URL hosts, None when any host is allowed.
Sourcepub fn env_patterns(&self) -> Option<&[String]>
pub fn env_patterns(&self) -> Option<&[String]>
The allowed environment variables, None when any is allowed.
Sourcepub fn secret_schemes(&self) -> Option<&BTreeSet<String>>
pub fn secret_schemes(&self) -> Option<&BTreeSet<String>>
The allowed secret-manager schemes, None when any is allowed.
Sourcepub fn allows_subprocess(&self) -> bool
pub fn allows_subprocess(&self) -> bool
Whether connectors that run a program are allowed.
Sourcepub fn check_env(&self, name: &str) -> Result<(), Refusal>
pub fn check_env(&self, name: &str) -> Result<(), Refusal>
Check an ${env:NAME} / ${secret:NAME} reference.
Sourcepub fn check_secret(&self, scheme: &str, reference: &str) -> Result<(), Refusal>
pub fn check_secret(&self, scheme: &str, reference: &str) -> Result<(), Refusal>
Check a secret-manager reference (${vault:…}, …).
Sourcepub fn check_path(&self, value: &str) -> Result<(), Refusal>
pub fn check_path(&self, value: &str) -> Result<(), Refusal>
Check a path a connector reads or writes. A value with a remote scheme
(s3://…) is checked as a URL.
Sourcepub fn check_url(&self, value: &str) -> Result<(), Refusal>
pub fn check_url(&self, value: &str) -> Result<(), Refusal>
Check a URL a connector connects to. file: / sqlite: URLs are
checked as paths, a scheme-less host[:port] as a host, and a relative
reference (/jobs, ./x) names no host of its own and passes.
Trait Implementations§
Source§impl Clone for ReferencePolicy
impl Clone for ReferencePolicy
Source§impl Debug for ReferencePolicy
impl Debug for ReferencePolicy
Source§impl Default for ReferencePolicy
impl Default for ReferencePolicy
impl Eq for ReferencePolicy
Source§impl PartialEq for ReferencePolicy
impl PartialEq for ReferencePolicy
impl StructuralPartialEq for ReferencePolicy
Auto Trait Implementations§
impl Freeze for ReferencePolicy
impl RefUnwindSafe for ReferencePolicy
impl Send for ReferencePolicy
impl Sync for ReferencePolicy
impl Unpin for ReferencePolicy
impl UnsafeUnpin for ReferencePolicy
impl UnwindSafe for ReferencePolicy
Blanket Implementations§
impl<T> Allocation for T
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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