# Permissions

---

# Object Security Policy

_Peios / Using Peios / Permissions_

> Read descriptor components, ordered grants, inheritance, and conditional policy without treating one part as the whole decision.

A security descriptor carries an owner, primary group, DACL, and SACL.
The object manager supplies the object type and rights mapping; the caller
supplies the subject token and request. The descriptor contains neither the
object's data nor a live pointer to its parent's permissions.

## Read the whole applicable decision

The DACL's ordered ACEs contribute discretionary grants and denials. The
walk decides each right at its first applicable entry; a later deny does
not retroactively reverse an earlier allow. Builders should use canonical
explicit-before-inherited and deny-before-allow ordering rather than relying
on a later sort to repair intent.

An absent DACL has no discretionary restriction; a present, zero-entry DACL
contributes no grants. Neither result bypasses the rest of the pipeline.
An empty DACL can still coexist with owner or privilege contributions.
Do not describe either state as an unconditional whole-system verdict.

The owner normally receives descriptor-read and DACL-edit rights, not
automatic file-data access. An applicable Owner Rights ACE suppresses that
implicit grant through a pre-scan, even when its conditional expression
would not later grant access. Mandatory policy and later narrowing still
matter. Ownership change alone neither removes stale ACEs nor establishes a
safe recovery route.

[PCDS](/specifications/pcds/security-descriptor/structure.md) owns the structure;
the [kernel DACL reference](/kernel/internals/kacs/access-check/the-dacl-walk.md)
owns evaluation, matching, and maximum-access behavior. A successful
`MAXIMUM_ALLOWED` check still requires inspecting the returned rights mask.

## Inherit at creation

A creator can supply explicit policy, and a parent can contribute inheritable
entries. The token's default DACL is a fallback when explicit and inherited
sources supply none; it is not always combined with inherited entries.
A protected ACL prevents accepting parent entries into that ACL.

Creator Owner and Creator Group placeholders resolve for each created child.
A container can receive an effective resolved entry plus an inherit-only
unresolved entry for later descendants. Generic rights can require the same
two-part treatment. This keeps one creator's concrete SID from becoming the
owner policy for every future descendant.

Inheritance does not recompute during access, retroactively update children,
or automatically reapply after moving an existing object. An explicit
propagation operation is different from changing a parent's descriptor.
Copying creates a new object and has its own preservation options. See
[PCDS inheritance](/specifications/pcds/security-descriptor/inheritance.md) and
the [SDK inheritance interface](/peios/developing-for-peios/sdk-reference/sdk-security/sd-inheritance.md).

## Conditions and resource attributes

User, device, resource, and local claims come from different authorities.
A resource claim resides in the object's SACL, not in its contents or the
caller's token. Attribute names can contain dots without becoming nested
objects: `@Resource.Project.Code` names the attribute `Project.Code`.
Coordinate names and types with the policy owner.

Conditions use three-valued logic. For a deny condition equivalent to
`Classification == "TopSecret" && not-cleared`, a missing classification
makes the comparison UNKNOWN. UNKNOWN AND TRUE remains UNKNOWN, so the deny
applies to an uncleared subject. UNKNOWN AND FALSE is FALSE, so the same
condition does not deny a cleared subject. Missing data does not make every
expression UNKNOWN; evaluate the complete expression.

An UNKNOWN allow does not grant. An UNKNOWN deny applies according to the
conditional-ACE rule. Review missing and mistyped attributes explicitly,
rather than assuming that any absent claim denies everyone or grants nobody
through other entries. The [conditional-ACE
specification](/specifications/pcds/security-descriptor/conditional-aces.md)
defines the operators and truth tables.

## The SACL has several jobs

Audit and continuous-audit ACEs, integrity labels, process-trust labels,
central-policy references, and resource attributes share the SACL. Its name
does not mean every entry produces an audit record. Access rights for reading
or replacing the SACL differ from `WRITE_DAC`; owner status alone is not
sufficient.

The label-only security-information interface affects the mandatory label
subset. It does not read or replace audit and central-policy entries. Full
SACL replacement and label-only update are different operations with their
own checks; do not infer their authority from a partial `sd show` display.
Mandatory resource attributes have additional TCB protection against changes
or removal. Use the [descriptor-management
reference](/kernel/internals/kacs/file-security/the-set-security-interface.md) for exact gates.

## Preserve an authorized repair route

Before changing policy, establish who can restore the intended descriptor
and what backup actually preserves. A text dump from a partial query cannot
reconstruct omitted SACL state. Neither ownership-taking nor a saved string
guarantees rollback. Verify actual application access with fresh handles
after a change and use [access diagnosis](/peios/using-peios/identity-and-access/diagnosing-access.md)
when the result differs from intent.

---

# The Permissions Editor

_Peios / Using Peios / Permissions_

> Understand descriptor editing and the authority retained by its caller.

The permissions editor is a shared dialog for security descriptors.
A caller identifies the object, supplies the readable descriptor parts and
named rights, and applies changes returned by the dialog. The dialog does
not gain authority over the object or write its descriptor directly.

## Views of one descriptor

**Access & Auditing** presents identities, grants, denies, conditions,
specific rights, and audit rules. Other views cover resource claims,
central access policies, and effective access. Owner, group, integrity,
and process trust are available through the owner controls.

**Advanced Mode** shows the ordered access-list entries, control flags,
and text representation. Entries the simpler views cannot edit remain
preserved. An unchanged entry is returned with its original bytes.
Unsupported text-form entries are represented by retention comments;
removing such a comment removes that entry.

The caller's declared capabilities restrict what can be changed. An
otherwise valid owner also has to satisfy the kernel's ownership rules.
A read-only dialog reports why it cannot apply changes.

## Inheritance and existing objects

Changing a container's inheritable rules governs new children. When the
caller supports propagation, the dialog asks whether to update existing
children too. The caller performs that operation, reports progress, and
handles a stop request. Read the final report of failures; partial
propagation is not a completed update of every child.

## Claim suggestions

The dialog suggests claims declared in the machine's Security Descriptor
Builder catalog, then claims and values recorded by permitted callers
when rules were applied. Suggestions help spelling; they do not create a
claim on the caller's token or make a condition true.

See `gxwi-sd-editor(1)` and the registry manual for
`Machine\Common\SecurityDescriptorBuilder`. Shared descriptor semantics
and the dialog protocol remain owned by the Peios specifications.

---

# Inspecting and Editing File Security

_Peios / Using Peios / Permissions_

> Understand the scope of security-descriptor queries before changing access rules.

`sd` reads and edits security descriptors on files. A descriptor identifies an
owner and holds access, audit, and integrity information. Inspect the relevant
components before deciding which change addresses an access problem.

## A displayed descriptor is a selected view

`sd show` requests the owner, group, discretionary access control list (DACL),
and mandatory integrity-label view. It does not request the full system access
control list (SACL), which also contains audit rules.

Formatting switches do not widen that selection. The `--all` spelling does not
turn the query into a full export. Human and ordinary JSON summaries also omit
some access-control entry payload details.

Do not use `sd show --sddl` as a complete descriptor backup. It formats the
queried subset in security-descriptor definition language (SDDL). Matching two
summaries does not establish complete descriptor equality.

## Changes depend on the component

An allow or deny operation appends or replaces selected rules. Removing a
principal's rules removes both grants and denials for that principal, so it
can broaden access as well as narrow it. Rule order matters when rights are
decided.

An access-check simulation helps explain a possible decision without
performing the requested operation. It cannot reserve the object's state or
guarantee the outcome of a later open.

Ownership, audit rules, and integrity are distinct components with their own
access requirements. A change to one does not automatically supply the
authority needed to change another.

## Inheritance is stored state

Permitting inheritance lets a descriptor receive inheritable parent rules. It
does not create a live link that automatically updates existing children
whenever the parent changes. Propagation explicitly refreshes descendants.

Protected descendants retain their own rules. A propagation walk can report
individual failures and continue, so inspect the summary rather than assuming
the whole tree changed.

Recursive operations treat symbolic links as objects rather than descending
through them. A nonrecursive path normally follows the final link unless the
physical-link option is selected.

`sd(1)` owns principal syntax, permission names, component-selection rules,
and the exact subcommand interfaces.

## Make and verify a bounded change

Resolve the intended path and decide whether the final symlink or its target
is the object to change. Inspect the selected descriptor components and the
parent's inheritance before editing. State whether the goal concerns
ownership,
ordinary access, audit policy, or integrity; avoid replacing unrelated parts.

Choose the smallest supported operation, then read back the affected
components
and retry the original operation through a fresh handle. A recursive update
can partially succeed. Preserve individual failures, and do not treat a
matching
summary as full descriptor equality or as proof of application-level success.

Use the descriptor API instead of manipulating the sealed xattr directly.
Linux mode bits and `chmod` do not express the complete Peios policy. Missing
and corrupt descriptors need the kernel's documented repair contract; granting
a broad synthesis template is not a generic repair.

---

# Executable Marks and Access

_Peios / Using Peios / Permissions_

> Distinguish marking a file executable from granting permission to run it.

`mkexec` marks a regular file as executable. The mark identifies intended
executable content; it is separate from the security descriptor that
authorizes a process to execute that content.

## Two different questions

A file can have an executable mark while its descriptor denies execution to a
particular token. Conversely, an access rule does not identify random data as
an intended program. Keep the content decision and the access decision
separate.

The mark does not grant privileges, change the user's identity, or create a
trusted signature. Inspect a downloaded program and its provenance before
making it eligible to execute.

## Select the actual file

`mkexec` accepts regular files and operates on their executable metadata. It
is not a recursive permission editor. Use `sd` when the intended change is who
can access the file, and use the packaging workflow when executable metadata
should be reproducible across installations.

`mkexec(1)` describes accepted operands and errors.

---

# Editing Object Permissions

_Peios / Using Peios / Permissions_

> Apply a descriptor change through the application that owns the object.

Open the permissions dialog from the application responsible for the
object. That application names its rights and applies the resulting
descriptor using the access it already holds.

## Before you start

You need access to read the relevant descriptor parts and to change the
parts you intend to edit. Record the existing owner and rules when you
need a recovery path. Application-specific rights are meaningful only in
that object's context.

## Review and apply

1. Open **Permissions** for the intended file, registry key, service, or
   policy object. Check the object name and type in the dialog.
2. Inspect the owner and existing rules. Use **Advanced Mode** when order,
   conditions, or entries outside the simple view matter.
3. Make the intended change and select **Apply** or **OK**.
4. If asked about existing children, choose propagation only for the
   intended scope and review its progress and failures.

## Check the result

Read the caller's apply response. Reopen or refresh the descriptor to
inspect what was stored, then test the intended operation with the
relevant account. Existing open handles can retain rights granted before
the descriptor changed.

An effective-access view explains a calculation from the information it
has; it is not a substitute for the consuming component's full operation
and runtime policy. Do not remove an unfamiliar advanced entry merely
because another view cannot display it.

---

# Changing Default Security Descriptors

_Peios / Using Peios / Permissions_

> Distinguish a supported creation-time descriptor override from the permissions already applied to objects.

A component can accept a security descriptor to apply when creating or
preparing an object. Such a setting is policy for that component; it is not a
registry feature that rewrites objects automatically.

## Before you start

Find a documented override for the object in the component's registry manual.
The proposed `Machine\Software\<Software>\SdDefaults` convention is not
implemented universally. Creating a plausible key does nothing unless the
component reads it. In particular, Peinit's static device-node policy uses
compiled descriptors; a planned override name in its source is not an active
setting.

Read when the component applies the descriptor and how it handles absent or
invalid input. Do not assume every descriptor setting has the same fallback:
rejection, retaining a prior value, and using a compiled default are distinct
policies.

## Change and verify the default

1. Record the existing override, including whether it is absent, and the
   actual descriptor on the affected object.
2. Prepare the component's documented recovery path. Preserve the previous
   descriptor separately if permission changes need to be undone.
3. Change only the supported setting, with its documented type and layer.
4. Use the component's normal creation or preparation workflow. Do not
   delete a live state file merely to force it to be recreated.
5. Inspect the resulting object's descriptor and component diagnostics.
   Test the intended reader and writer identities, not only an administrator.

Valid descriptor syntax does not establish that its grants are appropriate.
A fallback after invalid input can also differ from the intended policy.

## What does not follow from an override

Changing the stored default does not automatically update existing objects
or descendants that already inherited permissions. Removing the registry
layer cannot undo descriptors stamped while that layer's value was effective.

The registry key's own permissions govern who can edit the configuration.
A descriptor stored as a value governs the different object whose creator
reads it. Review both boundaries; changing **Permissions…** on the key is
not the same operation as editing the stored descriptor.

Bootstrap descriptors, kernel mount-policy templates, and package payload
permissions have their own owners and application points. A token's
`DefaultDacl` is another mechanism, supplied by [authentication
policy](/peios/using-peios/authentication/granting-access.md#defaults-for-newly-created-objects).
Do not substitute one mechanism for another without the consumer's explicit
support.
