Repository navigation
entries: access rules on an entry and on each protocol (draft, after #294) - #320
Draft
jseifeddine wants to merge 5 commits into
Draft
jseifeddine wants to merge 5 commits into
jseifeddine wants to merge 5 commits into
Conversation
A machine reached over more than one protocol needed one entry per protocol, with the hostname, display name and credentials copied between them. An entry can now hold a list of protocols. The entry's own fields are the host's defaults. Each item in `protocols` inherits them and sets only what differs; an empty value clears an inherited one, and `port` is never inherited. The first protocol is the primary. An optional `name` tells two protocols of the same type apart. - Existing flat entries are read as one protocol and connect exactly as before. An entry is stored in the flat form whenever that loses nothing, so older instances keep reading it, and the write API still accepts the flat body, including the NetBox webhook's. - Connecting resolves host and protocol to one flat entry, so folder defaults, credential variables, recording and the rest apply per protocol unchanged. Credentials come from the protocol, then the host, then the folder's defaults for that type. - The connect endpoint and `/api/connect` take an optional `protocol` (a name, or a type), defaulting to the primary. Sessions and recordings record the protocol they used. - Updates keep stored secrets per protocol, matched by name. - Connections: the editor has a Host section and a tab per protocol. The list shows a badge per protocol, the primary first, folding the rest into a +N chip. Connect is a split button whose menu lists every protocol, the primary marked as default. - Docs: entries in api.md, a multi-protocol NetBox webhook in netbox.md, and an upgrade note in migration.md. Refs sol1#296
The Type cell of an entry with several protocols kept to two lines and hid the rest behind a +N chip, so seeing them all took a hover or the Connect menu. It now shows a badge for every protocol, the primary first, and wraps onto as many lines as it needs. Refs sol1#296
An update keeps each protocol's stored secrets by matching names, so a protocol renamed through the API lost its password or key. The editor does not allow renaming, but an API client or script can. A protocol in an update body can now name its old name in `renamed_from`, and its stored secrets move with it to the new name. It is used for that update only and never stored or returned; a malformed one is refused like a malformed name. Refs sol1#296
An ad-hoc connection is one protocol to one host. A body with a `protocols` list failed with "unknown session type", since it has no top-level type; it now says what is wrong. Refs sol1#296
Optional `allowed_groups` / `allowed_users` on the host and on each protocol narrow access inside the folder, in the same form as a folder `.config`. The folder stays the boundary; admins bypass them. - A protocol's own rule wins over the host's, and the host's applies to protocols without one. An entry is listed while one of its protocols is usable, and lists only those. - Listings, search, the credential variable list, the connect endpoint and `/api/connect` all filter on the server. A protocol a user may not use answers as if it did not exist. - An entry with a rule is always stored in the list form, which older instances cannot read, so they leave it out rather than ignore the rule. A flat body with a rule, as a script or the NetBox webhook would send it, is converted before it is stored. - Editor: allowed groups and users in the Host box, and an own rule per protocol. The rules are shown only to admins. Split from the multi-protocol entries change, to be settled with the permissions design in sol1#294. Refs sol1#296
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft: waiting on #294 (permissions and custom roles). Stacked on #299.
This PR has the entry- and protocol-level access rules that were split out of #299, as suggested in the review there. It has one commit of its own,
entries: access rules on an entry and on each protocol, on top of #299's branch. Until #299 merges, GitHub also shows #299's commits here.What it adds
Optional
allowed_groups/allowed_userson the host and on each protocol of a multi-protocol entry. They use the same form and matching as a folder.config, and only narrow access inside the folder. Admins bypass them./api/addressbook, the search index, the credential variable list, connect and/api/connect. A protocol a user may not use is answered as if it did not exist.Fixed from the #299 review
prepare_entry_bodynow converts a flat body with a rule to the list form beforecompact(), which older instances cannot read. Every write path (POST,PUT,?move=true) goes through it. A test sends the flat body a script or the NetBox webhook would send.Open items, to settle with #294
PUT, which sends no rules, drops rules an admin set in the UI. They should be kept when omitted, asexternal_idis. That needs a way to clear a rule on purpose: today the editor leaves out an empty rule and the server stores an empty host rule as absent. I'd rather settle that together with how Design: permissions and custom roles #294 handles access than patch it here.Testing
On top of #299:
cargo clippy --all-targets -- -D warningsis clean, andcargo testpasses 455 tests. The twovault::tests::test_build_client_mtls_*tests fail, the same as on unchanged main in this container (UnsupportedCertVersion). Playwright: 92/92.