#[non_exhaustive]pub struct Launch {
pub environment: Option<Vec<EnvironmentVariable>>,
pub home: Option<Home>,
pub identity: Option<Identity>,
pub network: NetworkRights,
}Expand description
Optional parameters of a launch beyond the program’s arguments and streams.
A handler applies the home capability only if its format supports one. It must
apply environment in every case and fail the launch if it cannot: an explicit
environment is a confinement request, so ignoring it would hand the program the
caller’s whole environment (fail closed).
An identity is applied to mounted native executables only: the launch of any
registered file format (WebAssembly, native images) with an identity is refused,
so a format handler never has to apply one (fail closed).
network is denied by default: a program gets network authority only from an
explicit Launch::with_network, and only formats with a socket interface apply
it (native executables, through XilaStartup.network). WebAssembly applications
get no sockets, so a grant has no effect on them.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.environment: Option<Vec<EnvironmentVariable>>The program’s whole environment, replacing the copy its task makes of the parent’s. A later variable overrides an earlier one of the same name.
home: Option<Home>Home directory capability for programs that take one (native executables).
identity: Option<Identity>The user and group of the new task, replacing the ones it inherits from its
parent. Deciding who may run a program as another user is the caller’s job
(see Launch::with_identity).
network: NetworkRightsThe network rights of the program. None by default (see Launch::with_network).
Implementations§
Source§impl Launch
impl Launch
Sourcepub fn with_environment(self, environment: Vec<EnvironmentVariable>) -> Self
pub fn with_environment(self, environment: Vec<EnvironmentVariable>) -> Self
Give the program this whole environment instead of a copy of its parent’s.
Sourcepub fn with_identity(self, user: UserIdentifier, group: GroupIdentifier) -> Self
pub fn with_identity(self, user: UserIdentifier, group: GroupIdentifier) -> Self
Run the program as user and group instead of the caller’s identity.
The identity is set on the new task before the program starts, and only on
that task (and the tasks it starts): the caller’s own identity never changes.
The new task and all its descendants are marked as running with a granted
identity, which they cannot clear (task::Manager::is_identity_granted), so
runtimes for untrusted code can refuse to run under it.
The execute permission is checked for user. The caller must have
authorized the change itself, for example by authenticating an
administrator, because this function grants it unconditionally.
Sourcepub fn with_network(self, rights: NetworkRights) -> Self
pub fn with_network(self, rights: NetworkRights) -> Self
Grant the program these network rights. Without this call it has no network.
A native process that spawns a child can pass it a subset of these rights and never more. Deciding which programs may use the network is the caller’s job: this function grants the rights unconditionally.