# Application Boundaries

---

# Capability Policy

_Peios / Using Peios / Application Boundaries_

> Distinguish capability grants from confinement and plan the token and resource sides together.

A capability SID names an audience for access policy. Its effect depends on
where the token carries it, not on its name. A capability called
`internetClient` does not itself intercept network traffic or grant a socket.
An enforcing object manager and matching resource policy must exist.

## Grants and confinement

| Token field | Effect of a capability SID |
|---|---|
| Ordinary groups | Participates in the normal DACL walk, subject to group attributes. |
| Confinement capabilities | Participates in the additional confinement intersection when that pass is active. Presence matters; disabling a capability does not remove it from that identity. |
| Both | Can satisfy both walks, but does not bypass any other access restriction. |

Using capability SIDs in ordinary groups is sometimes called *positive
confinement*. It is an administrative convention for grants, not a sandbox.
It does not remove unrelated rights, privileges, or existing handles.

For example, a media library can grant read access to a `media-library-read`
SID. An administrator can arrange for approved service tokens to carry that
SID as an enabled group, without listing every service account in every
file's DACL. A service given that SID only in its confinement capabilities
still needs its ordinary identity to obtain the read grant. An intersection
cannot create rights missing from the first walk.

Keep the account, token-creation policy, and object grants distinct. Changing
a policy document does not update an already-created token. Verify the
launcher's actual token construction rather than assuming an application
manifest is automatically interpreted by authd.

## Confinement as a second check

An active confinement pass intersects the existing grant with the rights
justified by the confinement SID and capability list. Backup and restore
privilege grants do not escape that intersection. Owner implicit rights are
not added by the confinement walk. A null DACL still means no discretionary
restriction, so confinement is not an unconditional deny-by-default wrapper
around every object.

A library file can therefore grant ordinary read access to the service's
account and confinement read access to its package SID. The service can read
it but cannot change its DACL merely because the account owns it. Granting a
capability alone cannot overcome MIC, PIP, central policy, or a denial in the
ordinary walk.

Normal confinement includes `ALL_APPLICATION_PACKAGES`; strict confinement
omits it and consequently does not match broad grants to that SID. These
are supplied SID sets, not a separate mode flag. Supply every intended
capability explicitly. The [kernel confinement
reference](/kernel/internals/kacs/access-check/application-confinement.md)
defines virtual groups, conditional expressions, null DACLs, and ordering.

Confinement constrains AccessCheck-mediated operations. It does not remove
standalone kernel privileges, isolate namespaces, make inaccessible objects
invisible, or retroactively revoke transferred file handles. Treat the
reserved isolation-boundary field as unavailable functionality.

## Naming and deploying capabilities

The capability namespace is `S-1-15-3-*`. Well-known names include network,
enterprise authentication, certificate-store, and removable-storage
capabilities. Custom names use the defined SHA-256 derivation: eight
little-endian 32-bit subauthorities after `S-1-15-3`. Use the same exact name
and derivation on the token and resource sides. The
[package specification](/specifications/pspu/package-format-and-repository-protocol/derived-capabilities.md)
owns the encoding; a recognizable name is not evidence of enforcement.

Before deploying a capability-based service:

1. Identify each resource and required operation, including startup,
   maintenance, and recovery paths.
2. Inspect ordinary groups, privileges, confinement identity, and inherited
   descriptors independently. A confinement exemption skips that pass.
3. Arrange explicit grants on the resources and explicit token creation by
   the launcher. Keep a separate authorized management path.
4. Test both permitted and refused operations with fresh handles. Test
   failures without granting broad fallback access.
5. Recheck a replacement process after policy changes. Record the policy and
   deployed identities so the result can be reproduced.

Restricted tokens offer a different way to narrow authority inside a program.
They can coexist with confinement, but their privilege-restoration rules
are different. See [restricted
tokens](/kernel/internals/kacs/access-check/restricted-tokens.md).

---

# Process Trust

_Peios / Using Peios / Application Boundaries_

> Separate account authority, executable trust, and process hardening when operating services.

A process has an identity token, a security descriptor, and a Process
Security Block (PSB). They answer different questions:

- The token identifies the caller and its authority.
- The target process descriptor controls which operations that caller can
  request.
- PIP fields in the PSB describe executable trust. Mitigation fields describe
  committed process protections.

Impersonation changes the effective token, not the process's PIP tier.
An administrator identity does not turn an unsigned debugger into a trusted
process, and a trusted service does not acquire every client's authority
merely by receiving a request.

## Interpreting a refused process operation

For protected process boundaries, the caller needs the required descriptor
right and sufficient PIP dominance. Dominance compares both type and trust;
it does not replace the operation-specific descriptor check.
`SeDebugPrivilege` can rescue the descriptor check, but cannot rescue failed
dominance. Kernel-mediated service control through Peinit is distinct from
directly signaling the service from a shell.

Inspect the target's PSB separately from its token and descriptor. PSB queries
have a documented limited-query exception to dominance; that does not imply
permission to trace, signal, or open the target's token. A visible PID also
does not imply access to its metadata. The
[kernel reference](/kernel/internals/kacs/executable-trust/process-integrity-protection.md)
owns operation mappings, self-operation exceptions, partial multi-target
signal success, and the limits of PIP.

PIP is enforced by a trusted kernel. It does not defend against a compromised
kernel, unrestricted DMA, or a hostile hypervisor. Protected-process core
dumps are disabled in the maintained implementation; do not assume a
high-trust crash collector is installed.

## Signing and running a binary

A valid executable signature establishes a tier only if the running kernel
trusts its public key. The maintained validator accepts Protected/PeiosTcb
entries; adding entries for hypothetical tiers requires an implementation
change. A listed key does not prove the complete table passes validation.

Ordinary unsigned binaries can run without a PIP tier. That is different from
failure of the verification machinery, which can refuse execution, and from
kernel-initiated helpers, which require TCB trust. Executing under a tracer
or supervisor can cap a would-be trust increase. Read back the running
process's state instead of inferring its tier from a package or filename.

For a script, the final interpreter determines the execution tier. A symlink
resolves to the target file. Verified content can be pinned against in-place
mutation; pinning is not released merely because the process exits. A failed
exec can leave content pinned. Use the deployment's replacement-file workflow
for updates rather than assuming signed files remain editable in place.

The [verification reference](/kernel/internals/kacs/executable-trust/signature-verification.md)
and [exec lifecycle](/kernel/internals/kacs/executable-trust/exec-and-library-integrity.md)
define these rules. The
[signature specification](/specifications/pspk/binary-signing-and-pip/signature-format.md)
owns the wire format and hashing rules. Detached package signatures are a
transport convention, not another kernel runtime lookup path.

## Build and release trust

Keep private signing keys in controlled signing infrastructure. Runtime
verification needs public keys and signatures, not private keys. Record the
kernel's trusted public-key fingerprints and the signing provenance of the
artifacts deployed with it. A development or KUnit key is not release trust.

Package authenticity, executable PIP signatures, module signatures, and
firmware verification serve different purposes. Successfully producing a
Bazel package does not establish that every required signing step or image
composition step occurred. The retired Pekit image recipe is not a supported
replacement for the deferred Peios package (PPK) image composer.

The kernel has no runtime signing-key replacement or per-binary revocation
service. Key compromise requires a coordinated kernel/key and artifact
replacement plan; removing a file alone does not revoke copies elsewhere.
Do not promise additional signing tiers or a third-party signing service
until their verification and operational support exists.

---

# Boot Authority

_Peios / Using Peios / Application Boundaries_

> Follow authority from kernel bootstrap through the temporary root and the service graph.

The kernel must establish an initial identity before an identity service can
run. It constructs SYSTEM and Anonymous bootstrap tokens directly. SYSTEM
provides the initial authority; Anonymous represents a minimal identity for
anonymous impersonation. They are not accounts loaded from a user database.
Their exact fields and lifetime belong to the
[kernel bootstrap reference](/kernel/internals/kacs/tokens/token-lifecycle.md).

Prelude runs as PID 1 in the initramfs. It prepares kernel filesystems and
runs image-supplied hooks that make the real root available. When it hands
off, the same process number executes the real-root init, normally Peinit.
The programs perform different jobs; a successful handoff does not establish
that every later service or security policy is ready.

Peinit prepares the system's foundational state, starts the registry, then
loads and supervises the service graph. SYSTEM platform tokens and
authd-issued
service identities use separate launch paths. The child receives its intended
token before its service executable runs. User sign-in is an authd
conversation
followed by the requesting session launcher's work, not a universal Peinit
sign-in procedure.

## Distinct trust decisions

An initramfs archive is a build artifact, not intrinsically authenticated or
immutable runtime memory. Its contents become privileged boot code. Record
which image, kernel, hooks, drivers, and signatures are deployed; a successful
archive build does not prove firmware Secure Boot enforcement.

The token inherited through early boot gives authority. Executable signing
establishes PIP at exec. A SYSTEM identity alone does not prove TCB signing,
and signing alone does not give SYSTEM identity. Service management requires
both the relevant authority and sufficient process trust.

Policy caches, mount policies, descriptors, and process mitigations are
separate responsibilities. Neither authd readiness nor reaching the service
graph proves that a CAAP or TLP loader populated kernel policy. The maintained
Peinit path does not install those global policies or add a per-service
mitigation mask.

## Follow a boot failure to its owner

- Before real-root handoff, use
  [Prelude's boot diagnosis](/peios/using-peios/boot/debugging-initramfs-boot.md).
- For service dependencies, readiness, and recovery, use
  [Peinit boot modes](/peios/using-peios/boot/boot-and-boot-modes.md).
- For identity-source readiness and sign-in failures, use the accounts and
  sign-in guides. Transport availability does not prove every source loaded.
- For executable trust, check the kernel verifier and the running process's
  PSB. Inspect replacement processes separately after a restart.

A privileged recovery shell belongs to the failed stage and its deployment
policy. Do not assume every critical service failure opens a sign-in shell or
that exiting a failure shell resumes the failed operation.
