Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

userspace permissions #6493

Open
wants to merge 137 commits into
base: develop
Choose a base branch
from
Open

Conversation

tinnus-napbus
Copy link
Contributor

@tinnus-napbus tinnus-napbus commented Apr 19, 2023

Long-awaited userspace permission PR.

This is one of three fully separate prongs that aim to provide better privacy & security within userspace. This prong aims to restrict the effects Gall agents may emit based on permissions they have requested either statically as prerequisites (in a /desk.seal file), or dynamically as opt-in during runtime.

The other prongs are: 2) some form of userspace provenance (of which #6499 is a proposal), and 3) a permissioning scheme for Eyre/frontends. We intentionally exclude those two prongs here, because they can and should be implemented fully independently.

For the initial release, userspace permissions will only be warned about, but they will not block agent installation.

The latest announcement for this work was made here, but some changes have been made since then. A brief summary of the current form of this work follows:

  • All %pass cards emitted by agents, and all .^ scries made by agents are now subject to permission control. Only agents running on the %base desk are fully exempt from this.
  • Permissions are granted to desks. All agents running from that desk have the same permissions.
  • There are no implicit permissions. Every %pass and .^ requires a corresponding permission. Even when %passing to an agent that runs off the same desk.
  • An app may require that it be granted certain permissions in order to be installed or run. These are defined in the /desk.seal file on an app's desk. When agents run off that desk, they are guaranteed to have these permissions.
  • An app may request optional permissions at runtime by %passing a %pine to Clay. Users may grant or revoke optional permissions at any time.
  • The bowl given to Gall agents when they run now contains the set of permissions they have been granted. +cred:gall and +rite:gall may be used by agents to check for permission on a card or scry, respectively.
  • For the initial release, failure of an agent to comply with its un/granted permissions will simply cause a printf, but let the %pass or scry through as normal. In a future, this will become a crash. Developers are encouraged to adopt permissions for their apps as soon as possible. The urbit-dev announcement contains instructions on how to find the permissions your app needs, those remain accurate.

The %treaty agent has already been updated to propagate the required permissions as part of apps' metadata, see tloncorp/landscape#164.

Differences from the now-defunct #6560: resolve merge conflicts with develop (mostly gall/clay state migration functions), fix tests and add missing arvo tasks to perms:

  • ames %snub: create new [%ames %block ~] perm to allow
    blocking/unblocking ships
  • clay %crew and %crow: add to [%clay %creds ~] perm
  • clay %park: add to [%clay %write `desk ~] - can't rive this into
    paths unfortunately cos of complexity with the unified rang. Can
    only set by desk.
  • clay %rein: add to [%clay %liven `desk]
  • clay %tomb: create new [%clay %grave ship=(unit ship) desk=(unit desk)]. For the clue: %lobe, %all, %seek %pick and %seek
    require [%clay %grave ~ ~] global tombstoning perms, while
    %norm and %worn can be take specific ship and desk if
    desired.
  • clay %wick: add to [%clay %liven ~]. Can't only bump a
    particular desk so require null desk.
  • ames %keen: create new [%ames %order ship=(unit ship) =path]. Can remote-scry any ship if ship
    is null, otherwise specified ship. Simple all-subpaths of given path logic is applied to the
    path.
  • ames %yawn: always allowed as you an only cancel on original duct so you always requested it
    in the first place.
  • ames %wham: add [%ames %whack ship=(unit ship) =path], same
    behaviour as %keen.
  • %grow/%tomb/cull note:agent: add [%press =spur] to
    $perm-gall with all-subpaths of given path logic applied to
    spur.

TODOs before merge:

  • Check to make sure this PR is compatible with the next/kelvin/412 branch.
  • add optional arg to |free generator to grant all requested perms
  • make perm printing in vats just a number and add a separate generator to prettily list perms for a desk.
  • pre-release testing checklist, i.e. what features need to be exercised before we can determine that this is safe to release?
    • test default desks with appropriate desk.seals. This fork/branch of %garden has one and should work. Will upload for other default desks shortly.
    • test |free and |lock generators
    • test migration from non-perms to perms
    • test remote app install
    • test %pine (set app-desired permissions) and %curb (set user-approved permissions) clay tasks
    • test %ward (subscribe to receive permission diffs) and %wink (unsubscribe from receiving permission diffs) gall tasks.
    • actual enforcement of perms is currently disabled, gall only warns. Edit gall in the two places it says ::TODO PERM to enable enforcement and test it correctly crashes on unapproved scries & tasks.
    • also test with enforcement disabled, make sure it warns but allows
    • run normal kernel /tests suite, make sure all pass.
    • enable enforcement as described above then edit the tests/sys/vane/gall test where it says ::TODO PERM so it'll test enforcement correctly.

Fang- and others added 30 commits July 12, 2022 19:16
Adds a permission configuration to each running gall agent, based on the
recent additions to lull. Whenever a gall agent emits effects, they are
checked against its current permission set, and... allow through
regardless. An agent may inspect its current permission set from the
bowl.

A couple obvious challenges immediately arise, mostly surrounding what
agents should do when they are not allowed to emit effects they want to
emit. This gets especially nasty in +on-init, ie the install-new-app
case.

To prevent major breakage while we work on solving these issues, we
simply printf when we would drop cards, instead of actually dropping
them.

Includes simple |free and |lock generators for manually tweaking
permissions on an agent.

More work to follow.

Co-authored-by: drbeefsupreme <drbeefsupreme@users.noreply.github.com>
Clay and gall perms can now be limited to individual desks and agents
respectively.
We punt on the question of agent->desk resolution during +cred calls.
Affected agents always get them. Agents may subscribe to all permission
notifications using %ward, with %wink to unsubscribe.
In a similar vein to /desk/bill, contains the required and optional
permissions for agents on a desk. These will eventually be used during
installation, upgrade, and for managing permissions on demand.

Includes minimal logic for reading out these files from specific desks.
this adds some prepared gall cores and utilities, mostly intended for
testing userspace permissions, but will also be useful more broadly.

interfaces for +call, +take, and +scry to gall cores are added

several arms for creating a dummy agent named %bunt in the %test desk,
as well as poking it, and scrying its bowl, are added

also adds a scry endpoint to the dbug agent wrapper for the bowl.
previously, you could only poke the agent to request its bowl, which
just printed it to terminal and didnt return it. the scry endpoint
actually returns the bowl
adds gall unit test that performs a %free task on a dummy agent and
checks to see that the dummy agent's bowl has the correct permissions
Separate pokes, subscriptions, and scrying.
should probably be squashed with other commits adding tests
Adds a permission updating task to clay (%visa) and makes sure
permissions get included in gall's %load task.

Squashed commit of the following:

commit 7713932
Author: fang <git@fang.io>
Date:   Thu Aug 4 15:56:08 2022 +0200

    clay, gall: include permissions on loadout comms

commit afdd03b
Author: drbeefsupreme <jon@tlon.io>
Date:   Wed Aug 3 18:46:35 2022 -0400

    wip: fill in clay userspace permissions todos

commit eebf84d
Author: fang <git@fang.io>
Date:   Wed Aug 3 23:47:22 2022 +0200

    wip: permissions-via-clay todos

Co-authored-by: drbeefsupreme <drbeefsupreme@users.noreply.github.com>
@tinnus-napbus tinnus-napbus changed the title add missing arvo tasks to userspace perms userspace perms: resolve merge conflicts with develop, add missing perms May 11, 2023
@belisarius222 belisarius222 changed the base branch from m/userspace-permissions to develop May 16, 2023 19:48
@belisarius222 belisarius222 mentioned this pull request May 16, 2023
3 tasks
@belisarius222 belisarius222 changed the title userspace perms: resolve merge conflicts with develop, add missing perms userspace permissions May 16, 2023
@belisarius222 belisarius222 changed the base branch from develop to next/kelvin/412 May 16, 2023 20:00
tomholford added a commit to tloncorp/landscape that referenced this pull request Jun 9, 2023
This implements the first draft of types as specified by the backend implementations:
- urbit/urbit#6493
- master...tinnus-napbus:landscape:tinnus/userspace-permissions

Based on out-of-band conversation with @tinnus-napbus, there is possibly some changes coming to this interface. (to be addressed in a follow up commit).
tomholford added a commit to tloncorp/landscape that referenced this pull request Jun 9, 2023
This implements the first draft of types as specified by the backend implementations:
- urbit/urbit#6493
- master...tinnus-napbus:landscape:tinnus/userspace-permissions

Based on out-of-band conversation with @tinnus-napbus, there is possibly some changes coming to this interface. (to be addressed in a follow up commit).
tomholford added a commit to tloncorp/landscape that referenced this pull request Jun 9, 2023
This implements the first draft of types as specified by the backend implementations:
- urbit/urbit#6493
- master...tinnus-napbus:landscape:tinnus/userspace-permissions

Based on out-of-band conversation with @tinnus-napbus, there is possibly some changes coming to this interface. (to be addressed in a follow up commit).
tomholford added a commit to tloncorp/landscape that referenced this pull request Jun 9, 2023
This implements the first draft of types as specified by the backend implementations:
- urbit/urbit#6493
- master...tinnus-napbus:landscape:tinnus/userspace-permissions

Based on out-of-band conversation with @tinnus-napbus, there is possibly some changes coming to this interface. (to be addressed in a follow up commit).
Base automatically changed from next/kelvin/412 to develop August 29, 2023 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants