Expand description
§coqui-access-acl
Access control lists on items: each item carries a list of entries naming who may do what to it, and this crate decides a request against that list. One model writes each product’s lists as they are: Windows and NFSv4 (ordered allow and deny, inheritance flags), POSIX.1e (classes and a mask), NetBox and TrueNAS RBAC (additive), Proxmox (a walk where the most specific level wins). The consumer stores items and their lists; the crate evaluates. See the narrative docs.
§Features
- Named rights per item type - a
RightsSchematurns names into bits of a growableRightsset; aliases stand for several (generic rights, NFSv4 basic permissions, Proxmox roles), and a cancelling name refuses everything. - Five evaluation modes -
Ordered,DenyOverrides(the default, since no order can be wrong),Additive,Posix,MostSpecific. ADecisionsays what was granted, what was denied and which entry decided. - Inheritance, both ways - copied at creation (
Acl::inherited_by, Windows’ flag table) or walked at check time (AclStore, Proxmox paths). - An
Authorizer-AclAuthorizeranswers coqui-access’s authorizer kind over anyAclStore; a store that cannot answer is an error, never a denial. - Conditions and tokens - entry conditions are the consumer’s callback (unknown: an allow
is skipped, a deny applies);
Decision::intersectnarrows a person’s decision to a token’s,Decision::union_where_unsetadds a second parent’s (a Proxmox pool). - Options, not floors - every bound is a default the caller lifts, and what sets a
decision off the default (
OnMissing::AllowAll, anEveryoneallow) is reported as data.
§Installation
cargo add coqui-access-acl --git https://github.com/Boriken-Dev/coqui-accessNo Cargo features. It depends on coqui-access alone.
§Quick start
use coqui_access::Person;
use coqui_access_acl::{Acl, Context, Entry, Mode, RightsSchema};
let schema = RightsSchema::builder()
.rights(["read", "write"])
.alias("full", ["read", "write"])
.build()?;
let acl = Acl::new(Mode::DenyOverrides)
.entry(Entry::allow("group:staff".parse::<coqui_access::Subject>()?, ["full"]))
.entry(Entry::deny("account:guest".parse::<coqui_access::Subject>()?, ["write"]));
let guest = Person {
name: "guest".into(),
groups: vec!["staff".into()],
..Person::default()
};
let decision = acl.check(&Context::new(&schema).person(&guest), &schema.rights(["write"])?)?;
assert!(!decision.allowed);
assert_eq!(decision.deciding, Some(1));§API overview
| Item | Purpose |
|---|---|
Rights, RightsSchema | Rights as bits, and the names and aliases of one item type. |
Principal, Entry, Effect, Inherit | One line of a list: who, allow or deny, which rights, how it is inherited. |
Acl, Mode, ItemAcl | A list, how its entries combine, and an item’s list with its owner. |
Context, Decision | Who asks and with what options; what the check came to. |
AclAuthorizer | coqui-access’s Authorizer kind over an AclStore. |
Child, AclStore | Copied inheritance for a new child; walked inheritance over the consumer’s tree. |
Options, Limits, OnMissing, NonDefault | Bounds and choices, and what sets them off the default. |
Conditions, Truth | The consumer’s decision on an entry’s condition. |
AclError | Why a schema, list or walk could not be used. |
§Development
cargo test -p coqui-access-acl
cargo clippy -p coqui-access-acl --all-targets -- -D warnings§Releasing
This project follows Semantic Versioning and keeps a
CHANGELOG.md.
Pushing a tag matching v* triggers the release workflow of the repository.
§License
MPL-2.0 — see LICENSE.
Structs§
- Acl
- An access control list.
- AclAuthorizer
- Answers [
Authorizer] from the ACLs in a store: the request’sresourceis the item, itsactiona right or alias ofschema, its person the requester (signed in, soAuthenticatedandEveryoneentries match). - Context
- Everything a check needs besides the ACL and the rights wanted: the schema, who asks, the item’s owner, the consumer’s conditions and the options.
- Decision
- What a check came to.
- Entry
- One line of an ACL: who, allow or deny, which rights, and how it is inherited.
- Inherit
- How an entry passes to what an item contains, in Windows’ terms (NFSv4 uses the same
four flags):
itemsis OBJECT_INHERIT,containersCONTAINER_INHERIT,no_propagateNO_PROPAGATE_INHERIT andinherit_onlyINHERIT_ONLY. InMostSpecificmode,containersis Proxmox’spropagate. - ItemAcl
- The ACL of one item, with the owner and owning group its
OwnerandOwnerGroupentries resolve against. As configuration the subjects are their text. - Limits
- Bounds on work and memory. Each is
Some(n)by default andNonelifts it; none is a security property. - Options
- The choices one evaluation runs with.
- Principal
Error - Text that names no principal.
- Rights
- A set of rights, one bit per right a
RightsSchemadefines. It grows as wide as the schema needs: Windows uses 32 bits, NFSv4 14, Proxmox about 60. - Rights
Schema - The rights one type of item has, by name, and the aliases that stand for several.
- Rights
Schema Builder - Builds a
RightsSchema.
Enums§
- AclError
- Why a schema, an ACL or a walk could not be used. Messages give positions, never the names or values involved.
- Child
- What is made inside a container: a leaf, or a container of its own.
- Effect
- Whether an entry grants or refuses its rights.
- Mode
- How an ACL’s entries combine into a decision.
- NonDefault
- A choice that grants more than the default does, reported as data.
- OnMissing
- What an item with no ACL at all gets.
- Principal
- Who an entry applies to, written as text in an entry: a [
Subject] (account:<name>,person:<id>,group:<name>), oreveryone,authenticated,owner,owner_group,mask. - Truth
- What a condition comes to for one request.
Traits§
- AclStore
- Where items’ ACLs and their places in a tree are kept: the consumer’s storage.
- Conditions
- Decides an entry’s
condition, in whatever language the consumer writes them in: a NetBox-style constraint checked against its database, a Windows conditional expression, a time window.