Skip to main content

Module acl

Module acl 

Source
Expand description

Regenerating the readable half of an ACL file (D46). Regenerating the readable half of an ACL file (D46).

Grants are written against handles, because a channel is what signing_hash covers and therefore what the log keeps forever. That leaves the operator auditing lines like 7f3ac2ab19cd choir/choir.git own, which is unreadable, and unreadable authorization is unaudited authorization.

The settled answer is a generated trailing comment naming the person, and the reason it is safe is one asymmetry: the node’s ACL parser ignores everything after #. A comment that has gone stale can mislead a reader; it can never change a grant. The two rejected options both failed on that axis — resolving names at load time turns a deleted account into a config error someone has to notice, and a separate roster file means auditing one grant needs two files open, which in practice means the audit stops happening.

This module is the pure half: text and a roster in, text out, no network and no filesystem. The command that fetches the roster and writes the file lives in main.rs, so everything with a decision in it can be tested without either.

§Examples

let mut roster = std::collections::BTreeMap::new();
roster.insert("7f3ac2ab19cd".to_string(), "Ada Lovelace".to_string());

let rendered = choir_cli::acl::render("7f3ac2ab19cd choir/choir.git own\n", &roster);
assert!(rendered.contains("# Ada Lovelace"));
assert!(rendered.contains("7f3ac2ab19cd choir/choir.git own"));

Constants§

HEADER
The line written above a rendered file, telling the next reader that the comments are output rather than input.

Functions§

counts
How many grant lines were rendered, and how many of them a name could be found for.
render
Rewrites every grant line’s trailing comment from roster.

Type Aliases§

Roster
Handle to readable name, as GET /api/accounts reports it.