aboutsummaryrefslogtreecommitdiffstats
path: root/src/access
Commit message (Collapse)AuthorAgeFilesLines
* holding: the tests' other nodes write under writers of their owntv20 hours1-1/+18
| | | | | | | | A writer's changes are its first change's author's, so a node writing in a test after another under the same writer wrote as that one: a decision by another than the coordinator was taken as the coordinator's. Another node now writes under a fresh writer. The proposal written again differs, as one written the same makes no change.
* holding: a node writes its acks and the compactions it coordinatestv20 hours2-31/+200
| | | | | | | | | | | A change of a swarm holding a store may write its node's own protocol data a remake needs (`docs/store.md`, What a change writes): its acks, a remake's record and proposal, where there is none, of a compaction it coordinates, and, as the coordinator, its decision, or the record of the remake that made the epoch, carried into it whole; and the maps holding them, where there are none. An abort asked for by another than the coordinator stays closed, as does any other kind of remake. Rows 14 and 21 are judged here.
* sync: ask for what changes waiting in screening lacktv21 hours1-0/+16
| | | | | | | | | | Screening keeps a change whose dependencies haven't come from Automerge, waiting, so Automerge never learns what it lacks: our next message asks for the peer's heads alone, and the peer, forgetting having sent those, sends them again, and what they build on only as far as it still counts it as sent. So the session asks for what changes waiting build on and the document lacks too (`Waiting::lacking`, `SyncSession::lacks`), as Automerge asks for what the changes it holds back lack.
* simtest: show what screening holds back in a failed simulation's dumptv22 hours1-0/+6
| | | | | | | | A failed simulation prints, for each node, the writer it writes as, the changes its screening keeps waiting (the latest few: whose writer and seq, how many of their dependencies it holds, whether a signature vouches for them) and the latest changes it refused, and, holding a store, the store's checkpoint, current version and what it took and refused.
* access: the changes founding a fork's swarm taken, unsigned, as built byte ↵tv23 hours2-6/+122
| | | | | | | | | | | for byte A change of a swarm holding a store naming no node is taken where it is one of those founding the swarm (`events::is_founding`): built from the root its document holds and the events the root keeps, those at its history and those it puts, by the fold (`access::holding`). A change of the genesis change's writer waits for no signature, as every node builds it and nobody signs it (`screen::built_by_every_node`); judged, it is refused unless it is one of them.
* document: the changes founding a fork's swarm, built from its root and what ↵tv23 hours2-2/+2
| | | | | | | | | | | it keeps A fork's root keeps events (`docs/store.md`, On Automerge): they follow its genesis change in changes of the same writer, built the same way, filled in the order of their IDs, events going into a change until their bytes there reach 1 MiB, the next event beginning the next change (`events::founding`). A swarm holding a store starts from all of them (`events::started`, given the events the root keeps; none for a federation's root).
* access: a generated change's closed path, picked by itselftv24 hours1-1/+2
| | | | | | Picked where the path goes, rustc 1.95 takes the pick's type from that place, a slice of strings, and refuses the paths offered: picked by itself, as `rng.pick(&KEYS)` is, it is one of the paths, which goes where a slice of strings does.
* access: what a generated change picks from, given its typetv24 hours1-7/+6
| | | | | | The closed paths a generated write picks one of are an array of their own, and the events a node put a slice: picked from an array written in place, a path's type is left to be inferred from where it goes, which some compilers don't.
* access: what a node of a swarm holding a store takes leaves its events soundtv25 hours1-0/+143
| | | | | | | | | Three nodes write at random: events at their IDs, larger than the fold allows or not, again, or at other keys; strings and maps under the events; deletions; their entries or others'; and what is closed. Each now and then catches up with a node that takes their changes as it receives them (`screen::apply_bytes`). What it takes leaves at every key under `_continuum/events` the bytes whose ID it is, the root's among them; its document saves and loads; and another node, given all it took, takes it all.
* store: a test per attack row marked unittv25 hours2-25/+86
| | | | | | | | | Each row of `docs/store.md`, Attacks, marked unit has its test, `store_attack_<row>`: where it is judged (`access::holding`, `access::token`), where the store held in memory meets it (`federation::store::memory`), and where a node reads its store from its document (`federation::held`). Tests that checked a row already take its name; a check reads the doc's rows and fails on a unit row without its test, but for rows 21 and 22, which the remakes bring.
* api: in a swarm holding a store, a node takes no token another issuedtv27 hours1-0/+43
| | | | | | | | At its API, a node of a swarm holding a store takes no token another node issued (`docs/store.md`, Members): whoever its operator lets in may use it, and its operator lets in nobody through another node. A token every node of a swarm takes would let whoever another operator let in in here too. `token::issued_here` refuses such a token (`ElsewhereIssued`), behind the `federation` feature.
* access: a put at an event's key held already, judged as made by handtv27 hours1-8/+18
| | | | | | Automerge writes no put of the value a key holds already, so the test can't have a node write one: it judges such a change made by hand, a put of the event's bytes at its key, at a history holding it.
* node: a swarm holding a store, started from its root or joined by its IDtv27 hours1-0/+78
| | | | | | | | | | | | | | | | | | | | Behind the `federation` feature, two options: * `--store-root PATH` starts a swarm holding a store, or goes on with one, from the store's root, as bytes in the file, which the federation must take as a root. With no document to start on, the node builds the genesis change from it, as every node given the root does, and is ready at once; a document to start on must be of the root's swarm. * `--store-id ID` joins one through seeds by its ID, the root's SHA-256 in hex. An empty document of the first epoch takes as its root only that store's genesis change, built again from the root it holds (`document::events::is_genesis`), whatever peers name: the root pin doesn't wait for seeds, nor is disputed. Either names the swarm the node joins, which a state file must remember too, and can't be combined with the other, nor with what makes a new swarm's first change (`--genesis`, `--bootstrap-users`, `--bootstrap-keys`, `--bootstrap-policy`, `--remake`, `--genesis-root`). The root is read as a file of its own kind (`store`), counted among the node's files.
* access: what a change of a swarm holding a store writestv27 hours3-0/+296
| | | | | | | | | | | | | | | | | | Every node judges a change of a swarm holding a store by what it writes, at its history (`docs/store.md`, What a change writes), in place of rules by path: `access::holding`. It writes events, each at `_continuum/events/<ID>` the bytes whose SHA-256 that is, no larger than the fold allows (the federation's 256 KiB), at a key held nowhere at the change's history; and its node's entry, with the member list's map where there is none. Everything else is refused, as closed: values outside `_continuum`, the policy, the swarm's ID, users, bans, the topology, remakes and their acks. Nothing deletes or replaces an event. A change names its node; the genesis change's writer names none, so no change under it is taken but the genesis change. In a swarm not holding a store, a change writing a policy naming one is refused: a swarm holds a store from its genesis change, or not at all. The inspector tells a put of bytes apart (`Action::PutBytes`), with the bytes, for the events' check. All of it behind the `federation` feature.
* access: the policy of a swarm holding a storetv27 hours1-15/+112
| | | | | | | | | | | `{"version": 2, "store": "<fold>"}` at the policy's place is a swarm holding a store of that fold (`docs/store.md`, What the document holds). Behind the `federation` feature, a node reads it as `Policy::Store` where the fold is one it has (`federation`) and nothing else is written there: changes judged, and signed, as required; not strict. Its `store` reads so only where it is a string, as `values` of a strict policy. A swarm holds a store from its genesis change only, so `--bootstrap-policy` takes none. Without the feature, a policy of version 2 stays one the node doesn't know.
* screen: `Screening::of`'s doc on `of`tv36 hours1-1/+1
| | | | | `of`'s doc line sat above `policed`'s, as its first line, and `of` had none.
* screen: a test's actor named through `document`tv36 hours1-1/+1
| | | | | | The test of a value hiding the policy's place made its actor through `automerge::` outside `src/document`, which the test that Automerge stays behind `document` refuses. It names `document::ActorId`.
* screen: what is at the policy's place found in every map on the waytv37 hours1-5/+64
| | | | | | | | | | | | | | | | A node judges what it receives once anything is at the policy's place (`Screening::policed`), as a read shows it. But a read shows the newest of the values written at once at a key, merging maps only where that one is a map: a string written at `_continuum/access` beside the map holding the policy, and newer, hides it. So the policy's place read as empty, a change putting `"signed"` into the hidden policy went unjudged where it came alone, and deleting the string left a strict policy no change was refused for. Whether anything is at the policy's place is asked of every map of each key on the way to it, read or not (`store::held_anywhere`), as `store::by_seq` walks them. A swarm with nothing there is screened as before.
* screen: what reads as no policy has what is received judgedtv44 hours1-5/+47
| | | | | | | | | | | | | | | | | A node judges what it receives only once the document holds a policy, or a batch writes at a key named `policy` (`Screening::policed`); and an envelope holding `null` at the policy's place reads as none. So a change putting `"signed"` at `values` in a map beside such an envelope, writing at no key named `policy`, went unjudged where it came alone, and a later change deleting the envelope left a strict policy that no change was refused for. Nodes that took the second in one batch with others refused it, and the rest dropped it once told: apart until then, by how changes were batched. A node judges what it receives once anything is at the policy's place, whatever it reads as. A swarm with nothing there is screened as before; one whose policy's place holds what reads as none is judged by none but the rule that refuses turning strict, as a swarm without a policy is.
* policy: strict only where its values is a stringtv46 hours1-31/+32
| | | | | | | | | | | | | | | The policy was read in typed JSON, so that an Automerge text spelling "signed" at its `values`, which no operation `rules::turns_strict` asks of writes, turns no swarm strict. But that read every policy anew: a setting that wasn't a string, or a text at `signatures`, made a policy no node knows in swarms that aren't strict, which read it as before. The policy is read in plain JSON again, as it was, and only its strictness asks more (`policy::of`): it reads strict only where its `values` is a string in typed JSON, an envelope read as its payload. A policy that would read strict only through a text, at `values` or holding the policy, is one no node knows. Every policy that doesn't read strict reads as it did.
* config: a strict bootstrap policy found as the document reads ittv2 days1-7/+11
| | | | | | | | A strict `--bootstrap-policy` is refused with `--remake`, but whether it was strict went by its JSON as given, where the node reads the policy as written into the document: a strict policy given as an envelope passed, and its genesis change was refused only once the node had started. Both now read it as written (`policy::as_written`).
* policy: read only as continuum writes ittv2 days1-10/+54
| | | | | | | | | | | | | | | | | | | A swarm turns strict only at its start or through a strict remake, and a change writing a strict policy where the policy isn't strict is refused, found by its operations: `"signed"` put at the policy's `values`, or an envelope asking for it put at its place. But the policy was read in plain JSON, where an Automerge text reads as a string, and writing a text is no such operation: `{"$text": "signed"}` at `values`, through the typed API, turned a swarm strict that nothing refused, with a time before it nothing closes. The policy is read in typed JSON now (`store::read_plain_as`): what continuum writes there reads as it is, plain JSON or an envelope, and a text, a counter or bytes as itself, tagged; a setting that isn't a string makes a policy no node knows (`policy::read`), as a version it doesn't know does. So no text turns a swarm strict, and the operations `rules::turns_strict` asks of are the only ways to. A policy holding none of these reads as before.
* rules: a swarm turns strict only at its start or through a strict remaketv2 days1-153/+74
| | | | | | | | | | | | | | | | | | | | | | A strict policy written into a running swarm left a time before it: changes written there, beside the turn, were refused by the nodes that took the turn first and taken by the others where they came first (a signed policy that isn't strict, among them, unseated the turn there); and a remake whose base preceded the turn had every switching node replay the turn as one of its own, each refusing the others'. A change writing a strict policy where the policy at its history isn't strict (`"signed"` at its `values`, or an envelope there asking for signed values) is now refused, in every swarm. A swarm turns strict at its start (`--bootstrap-policy`) or through a strict remake, each its epoch's first change: no change of a strict epoch is from before its policy, and the rule for the time before goes, with the walk that found the changes that turned a swarm strict and what kept them (`before_strict`, `turned_strict`, `Reads::strict_now`, `Reads::turned_now`, `store::writers`, `store::made`, `changes::in_history`). The strict swarm's simulation starts strict. access.md says so, and that a strict swarm can't move to a policy its nodes don't know by writing it.
* rules: the changes that turned a swarm strict found once for its headstv2 days1-6/+20
| | | | | | | | | | | | Every change judged under a policy that isn't strict, in a strict document, walked back to the changes that turned it strict, each step reading every change the document holds. Only changes from the time before reach it in an honest swarm, but a member can send crafted ones at an old history, each costing every node a walk. The changes are now read once per walk (`store::made`), and what the walk finds is kept for the document's heads (`Reads::turned_now`), as whether its policy is strict is.
* rules: a strict swarm stays stricttv2 days1-1/+31
| | | | | | | | | | | | | | | | | A strict policy could be written over with one that isn't, or deleted, by a user who may manage the policy. While the swarm was relaxed so, nothing was asked of the time before it turned strict: a change written beside that turn was taken, and once the swarm turned strict again, built on, a node judging that change while strict from the first turn (one back from away, a joiner) refused it, and every node it told dropped it with the second turn and everything after. Under a strict policy, the policy is now written again only as strict: an envelope there whose value isn't a strict policy, a signed `null` among them, is refused. So a strict swarm has one change that turned it, and the time before it stays closed; to leave it, start a new swarm from its content. A swarm that isn't strict writes its policy as it did.
* rules: the document's own policy read once for its headstv2 days1-4/+19
| | | | | | | | | Every change judged under a policy that isn't strict, in every swarm, read the document's own policy to ask whether the time before a strict policy applies: in a swarm without a policy, where a change was judged for nearly nothing, a read of the policy for each. It is now read once for the document's heads and kept while the batch is judged at others (`Reads::strict_now`), read again once the document takes more.
* store: values ordered by seq as the policy a read shows saystv2 days1-5/+9
| | | | | | | | | | | | | | | Whether values are read by `seq` went by whether any value at the policy's place asks for signed values, not by what the policy reads as. Where the place holds two, they part: a signed policy that isn't strict read before a plain one that is, or two maps, the newer not strict. Such a swarm judged as not strict and read by `seq`. Now the policy's own place is read by `seq` where any value there asks for signed values, so an older policy put back beside a strict one can't undo it; every other place is read by `seq` only where the policy that read shows is strict (`policy::read`, which `policy::of` reads with). A swarm whose policy doesn't read as strict reads every place as Automerge has it.
* rules: the time before strict is the change that turned it, written again or nottv2 days1-19/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | A change written under a policy that isn't strict was refused, in a strict document, unless it was in the history of the change that wrote the policy value the document read now. So the policy written again by a node that held a change from before, taken beside the strict policy, put that change in the new writer's history: that node kept it, every other node refused it, and the new policy with it, and the node was cut off. Now the reference is the change that turned the swarm strict: one that wrote a strict policy where the policy at its history wasn't, found by following back the writes of what the policy holds (`store::writers`). A change written under a policy that isn't strict is refused where such a change is beside it, neither in its history nor built on it. A policy written again, strict over strict, names the same change. One turning the swarm strict beside it is refused like any other. Of two at once neither is preferred: any rule choosing one, the lower hash say, would let a change made later to look as old take the place of the one every node took, and every node would drop it with all that was built on it. So two members turning a swarm strict at once split the nodes that took one from those that took the other; access.md says to turn it from one.
* rules: nothing added to the time before a swarm turned stricttv2 days1-0/+78
| | | | | | | | | | | | | | | | | | | A swarm turned strict by writing the policy into it kept the time before open: a change whose history lacks the policy's change is judged by the policy then, none or one that isn't strict, needs no signature there, and is taken whenever it comes, from any member. With values read by `seq`, an envelope planted at that time with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. Once a document's policy is strict, a change written under one that isn't is refused, received or held, unless it is in the history of the change that wrote the policy the document reads (`store::written_by`). A node that holds one beside that change, taken before it came, is told so by any peer that refused it (REFUSALS), judges it again, now refuses it too, and drops it with what builds on it, as for any change it took unjudged. A swarm strict from its genesis change has no such time; one whose policy isn't strict judges as before.
* swarm: a new swarm's policy recorded in its genesis changetv2 days1-0/+48
| | | | | | | | | | | | | | | | A swarm strict from its start had its policy written by its first user in a later change. A change is judged by the policy at its history, so any member could always add a change whose history is from before the policy: judged by none, needing no signature, taken whenever it comes. Since signed values are read by `seq`, an envelope planted there with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. `--bootstrap-policy JSON`, with `--genesis`, records the policy in the genesis change, with the first users: then no change of the swarm is from before it. It must be a policy this node knows, and a strict one needs `--bootstrap-keys`, or nobody could sign what decides who may do what.
* signed values: one reading of an envelope, everywheretv2 days2-108/+15
| | | | | | | | | | | | | | | | Three parts read an envelope three ways: the store's order took any string with the prefix whose meta held a `seq`, its reads any whose value decoded, the checks only one with four parts and a meta of exactly its fields. A string that the first two took and the checks refused was read first, read as the registry's or the policy's value, and treated as nothing by the check of the next write there. `document::signed` reads an envelope the one way: four parts, the value JSON, the meta exactly its six fields (one more, or one twice, and it isn't one), no newline in either, the signature decoding. The store's order, its plain reads, the checks, the API and the users API all go by it. What isn't one in every respect is a plain string, wherever it is read.
* signed values: value and meta apart, numbered; the highest seq is readtv2 days4-42/+185
| | | | | | | | | | | | | | | | | | | | | | | | | A member could put a user's older signed value back beside a newer one: a change made with dependencies from before both is judged where the place was empty, so the older envelope (`prev` empty) is taken; and of values written at once, the one read was the one with the highest operation, which whoever writes the change steers. A revoked capability, a lifted ban or an earlier policy came back that way, signed by whoever signed it then. An envelope is now `cv2.<value>.<meta>.<signature>`: the value as its user wrote it, and apart from it what continuum adds (swarm, path, user, at, seq, prev), the signature over the value's line and the meta's. `seq` is one more than that of the envelope it replaces, 0 where it replaces none; every node checks it with `prev`. Of the values a place holds, written at once, signed ones are read before any other, the highest `seq` first, of equal ones the lower digest (`store::candidates`): reads, snapshots and writes all go by it. An older envelope beside a newer one changes nothing. `application/continuum-signed` is the value's line, the meta's, then the signature; `scripts/continuum-signed` writes and checks it so. The wire version goes up: nodes must agree on what a place's value is.
* screen: a change refused after its checks stands in for nothingtv5 days1-0/+1
| | | | | | | | | | | | | | | | Screening checks that a change is one Automerge writes (`changes::Written`) before it looks for forks and judges the rules, and the checks recorded what a change made as soon as it passed them. A fork of a change the document holds has its actor and counters: if it was checked first in a batch, and refused as forged after, its record stood in for that change's operations, outside the history of the next. An honest change writing into what the real one made was then refused, for good. Anyone could make such a fork, its hash ground to sort first. What a change made is recorded once screening takes it (`Written::taken`), and an operation named is looked for in the batch and in the document, whichever the change's history holds.
* screen: a twin of this node's actor switches it only signed with its keytv5 days1-19/+57
| | | | | | | | | | | | | A node switched to a fresh actor whenever a peer showed it a change of its own actor that it didn't hold, signed or not. So any peer made a node start a writer at will, by sending a copy of its last change with another value: and every writer costs every node memory in proportion to the document's history. Copies of a node's data directory hold its key, and sign their changes with it; a stranger can't. A twin switches the node only where a signature by the node's own key of it is kept or waiting. Unsigned, it is refused as forged as before, and nothing switches.
* screen: what is asked of a change, asked of its own historytv5 days1-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A change is refused before Automerge sees it unless it is one Automerge writes (`document::changes::Written`). Three things about that, each of which let a crafted change through or parted nodes: * An operation a change names (the object written into, a list's element, an operation replaced) must be made in the change's own history, or before in the change itself, not anywhere in the document. Else a node that holds the operation takes the change and one that doesn't yet refuses it for good: nodes part by the order changes reach them. * And it must be what it is named as: an object of the kind written into, an element of that list, an operation at the place written. A change that replaces an operation elsewhere marks an unrelated value gone, and Automerge then gives back another change under its hash and saves a document that doesn't load; one that writes into an operation that made no object makes it panic. * A change that isn't its actor's first must have the one before it among its dependencies, as a transaction puts it there. A gap in an actor's numbers makes Automerge panic. What the document holds at the changes this one builds on is read there where it can be (a map's key, an object held by a map's key); else the operation's own change is decoded and the history walked back to it, no further than the operation's counter. So operations on a list's elements cost a walk each. Decoding a change can panic too (an operation naming an actor its change doesn't list): caught, and the change refused as one whose bytes aren't Automerge's.
* screen: refuse changes Automerge wouldn't have writtentv5 days1-0/+8
| | | | | | | | | | | | | | | | | | | | | Automerge 0.12.0 applies a change that lists an actor none of its operations names, or whose first operation is numbered below its dependencies' or near 2^32. It then gives back another change than the one it was given and saves a document that doesn't load, or panics at the next write. A member sending one stops the nodes that take it. Every change from elsewhere is looked at before Automerge sees it (`document::changes::Written`, from `access::screen::apply`, with or without a policy), and refused like one breaking a rule unless: * encoded again, it has the hash it came with; * its first operation is numbered one after the highest of its dependencies, 1 without any, as a transaction at the document's heads numbers it; * every operation it names (an object, a list's element, an operation replaced) is its own, or was made before it, in the document or by a change of the batch looked at before.
* login: a login given a lifetime of its own ends its session's record with ittv6 days1-4/+5
| | | | | | | | | | | | Ending a session records it in the document until the login's end (login_exp), so every token of the session, refreshed or handed over, is refused until none can live any longer. A login may ask a lifetime of its own (POST /auth/login with lifetime): its session ends with that token (session_exp), as a refresh never goes past it. Its login_exp is now that end too, so ending its session records it as long as one of its tokens can live, not for the node's whole session lifetime. A token refreshed with a lifetime (one handed to another member's dashboard) keeps the login's end.
* screen: refuse a change at a seq this node made under its own actortv6 days1-11/+21
| | | | | | | | | | | | | | | | | A node receiving a change of the actor it writes as, one it doesn't hold, writes on as a fresh actor (another node writes as it, from a copy of its files). Where the other node made it at a seq this node made a change at too, the change was taken to Automerge, which refuses the whole batch (duplicate seq): the message failed, and with it everything else it carried. Signatures::forks found it forged only where a signature verified a change of the actor at that seq, and this node signs its own latest change only as it sends it. forks now also finds a change forged where its actor is the one the document writes as and the document's latest change of it (get_last_local_change) is at its seq or later. apply_bytes switches to the fresh actor after judging the batch, not before, so the check still sees the actor; also where judging fails.
* screen: write as a fresh actor when another node writes as this onetv6 days1-1/+71
| | | | | | | | | | | | | | | | | | | With --keep-actor, a node on a document file that ends with a clean stop writes on as the actor the file names. Two nodes started on copies of one file (a copied data directory, a restored disk image while the original runs) both do, and both make that actor's next change number: peers holding one refuse the other as forged, and everything built on it. screen::apply_bytes, the way every received change comes in, now looks for a change of the actor the node writes as that the node doesn't hold: only another node can have made it. The node then writes on as a fresh actor at once, logs a warning, and its callers add the actor to the node's own (RemakeState::add_own_actor), which the document file's header follows. The change is judged as any other. lifecycle.md says not to start a copy of a node's data directory with --keep-actor, and what the switch leaves: what both wrote before stays refused where the other's came first.
* access: a limit that meets none of the user's capabilities gives nothing to ↵tv6 days1-1/+9
| | | | | | | | | | look with Looking at a node (its figures, peers, dashboard: Need::Observe) takes any capability, a token's limit applied. Caps::is_empty is now true where no capability of the user meets one of the limit's (Capability::meet), as well as where there are none: a token limited to the member list, for a user who may only read data/eu, may not look.
* access: a token with a limit changes no credentialstv6 days1-0/+5
| | | | | | | | | | | | | | | A token's limit narrows every endpoint but those under /auth, which any registered user may call. Among them, PUT and DELETE /auth/keys/{id} change the keys the user logs in with, and POST /auth/logout ends every token of the user. With the token a dashboard hands to another member's (the member list, read, five minutes), its holder could add a key of its own and log in by it as the user, with everything the user may do. These now take a password or a token without a limit (Need::Credentials, refused where Caps::limited). A narrowed token still refreshes within its limit, says who it is, lists the user's keys and ends its own session (DELETE /auth/session): a dashboard opened from another member's logs out with it.
* auth: whoami says what the request may dotv8 days1-0/+71
| | | | | | | | | `GET /auth/whoami` lists the user's capabilities (`caps`) and its token's `limit`, if any, side by side; what the request may do is what both give, as endpoints decide it. It says so now (`may`): the capabilities, or with a limit each capability met with each of the limit's (`Capability::meet`): at the deeper of the two paths, a `*` of one taking the other's key there, with the rights both name; nothing where the paths part, no right is shared, or the path is protocol data one of them doesn't name.
* docs: what is postponed or rejected stays in its own two filestv8 days2-4/+2
| | | | | | | | | Docs and comments outside future-work.md and review-rejections.md say what the code does, and point nowhere else for what it doesn't: the architecture page's map, the transports' forwarders, keys with `/`, a strict swarm's registry, trust.md's "Not yet" (now saying what isn't protected, in a sentence), the topology bench, and the comments of the change benchmarks, capabilities' grantor, tokens, dissemination, refusals and topology.
* access: a key's comment 256 bytes at mosttv8 days1-2/+17
| | | | | | | Review 4, 1250's note: a key's comment was kept as given, unbounded but by the request limit (2 MiB), in protocol data every node holds and the dashboard shows. It says whose and where the key is: at most 256 bytes now (`sshsig::MAX_COMMENT`), a longer one refused with the key.
* screen: that a policy was held kept across a swap of the documenttv8 days1-2/+6
| | | | | | | | | | | Review 4, F12: `Screening::of` started screening over when the document was swapped (a drop, a switch, a rejoin), the root pin alone carried on, so whether the document had held a policy (`policed`, 1211) was forgotten there too, not only across a restart as documented: after a drop with the policy removed meanwhile, late changes written under it went in unjudged again. It is carried on now, as the root pin is; what belongs to the old document (changes waiting, refusals, drops held) still starts over. access.md says so.
* api: a stream opened by password or a proxy's header ends with its usertv8 days1-5/+15
| | | | | | | | | | | | Review 4, F11: only streams answered to a token ended with it (1273); one opened by password (basic authentication) or a proxy's header went on after its user was disabled or removed. `streams_end` now wraps those too, by the user `basic_auth` leaves on the answer: such a stream ends once the document no longer has its user, enabled (`token::user_taken`, the part of a token's check about its user, which `still_taken` uses too), looked at as the stream begins and as protocol data changes. No expiry: a password has none.
* access: an ended session recorded until the login's endtv8 days1-1/+9
| | | | | | | | | | | | | Review 4, F7: `DELETE /auth/session` recorded the session as ended until the `session_exp` of the token it came with. A token handed to another member's dashboard has its `session_exp` cut to its own end (five minutes), and so has the session that dashboard keeps with it: logging out there recorded an end minutes away, the next remake's snapshot left it out, and the original browser's tokens of the same session, refreshable for days, were taken again. A token now keeps the login's end as it logged in (`Claims::login_exp`), which no refresh changes, and an ended session is recorded until then (or the token's `session_exp`, if later, as for a token from before the field).
* api: a stream opened with a token ends with ittv8 days1-11/+33
| | | | | | | | | | | | | | | | | | | | A token was checked when a request came, and a stream answered to it (the dashboard's events, a subscription's links and messages, the store's streams) then went on for as long as the client kept it open: past the token's expiry, past its user's tokens being revoked, its user disabled or removed, its session ended. Now a middleware inside `login::bearer` (`login::streams_end`) ends a streaming answer (`text/event-stream`, `application/x-ndjson`) to a request with a token at the token's deadline, its expiry, or as soon as the document no longer takes it (`token::still_taken`, the checks `verify` makes of the document, now its own function): looked at when a change touches protocol data (the root, a switch, among it), and when a session ends on the node itself in a swarm without a registry (`AppState::session_ended`). No polling: a timer for the expiry, and the changes as they come. The client reconnects with the token it has then; a refreshed token is a new one, so a stream lasts a token's lifetime at most (12 hours by default). `futures` is a dependency of every build now (for `take_until`), not only of libp2p's and Tor's.
* access: ending a single sessiontv8 days3-2/+39
| | | | | | | | | | | | | | | | | | | | Logging out of the dashboard (`DELETE /auth/session`) only cleared the cookie: the session's tokens stayed taken until they expired, by every node. Ending them took `POST /auth/logout`, which ends all of a user's sessions. Now `DELETE /auth/session` ends the session of the token it comes with (the cookie, or a bearer token): where the swarm has a registry, it is recorded as `_continuum/sessions/<user>/<session>` (`registry::session_path`), its value until when the session would have lasted, and every node refuses the session's tokens once the change reaches it (`token::Refused::Ended`): the page's own, its narrow tokens, and one handed to another member's dashboard, all refreshed from it and keeping its ID. The rules take the entry from the user itself or one who manages users, as a logout. A remake's snapshot leaves out entries past that time, a user's map where none is left: their tokens are expired anyway. Without a registry the document can't record it: the node ending it refuses the session's tokens itself (`AppState::ended_sessions`, until it restarts), others take them until they expire, as a logout there is refused.
* access: what a node holds alone by `_continuum/local/<node ID>/<name>`tv9 days1-0/+2
| | | | | | | | | | | | | | | | Setting a node's log filter took `write` on `_continuum`, all of the protocol data: whoever could change one node's logging could change the swarm's members, remakes and users too. Now what a node holds alone has paths of its own for capabilities, under `_continuum/local/<node ID>/`: `log` (`/admin/log`), `config` (`/admin/config`) and `debug` (`/debug`, always `write`), `read` to look and `write` to act (`api::access::needed`, which takes the node's ID). So `_continuum/local/<node ID>` is everything on one node, `_continuum/local/*/log` the log filter on every node, and holders of `_continuum` keep it all. Nothing is stored there: the store refuses writes under `_continuum/local`, and the rules refuse a change touching it, as for epoch metadata. The quarantine stays with `_continuum`: its entries are everyone's writes, which a node-local capability mustn't show.