Skip to content

feat(core): access control policies, manifests and named permissions - #336

Draft
0xxlegolas wants to merge 22 commits into
mainfrom
feat/0007-access-control
Draft

0xxlegolas wants to merge 22 commits into
mainfrom
feat/0007-access-control

Conversation

@0xxlegolas

@0xxlegolas 0xxlegolas commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

No description provided.

0xxlegolas and others added 19 commits November 30, 2026 17:56
A manifest holds characters only. Bot and org keys use a builder rule
that checks the sender; wallet entries can be added later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- entity::new adds the policy to every entity
- owner-only actions need the owner cap and skip resolve; set_rule and
  enable_action reject core::access requirement types
- members prove identity with their Character's current cap
- game-client rules are never skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Request gains action: Option<String>, set by entity::interact, so access
rules can target one named action (ADR 0007, task 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
core::manifest holds one shared list of character ids, edited by whoever
holds its ManifestCap (max 1000 entries, never deleted). A Member(id)
requirement is met by verify_character with the Character's current cap
(ADR 0007, task 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
access_cap::receive lends a cap parked on any object with a return-only
receipt; return_to puts it back and release moves a transferable cap on.
transfer_with_receipt refuses a return-only receipt (ADR 0007, task 3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
entity::new adds a Policy (open switch, Owned/Released/Abandoned status,
main manifest, per-permission and per-action rules) to every entity.
core::access adds the Access(P) requirement: the owner meets it with
verify_owner; resolve swaps it for the policy's rule in ADR order
(Abandoned, action rule, permission rule, open, main manifest)
(ADR 0007, task 4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…witch

access::set_open, attach_manifest / attach_listed_manifest,
detach_manifest, set_rule, set_list_rule / set_listed_rule and clear_rule
return an owner-cap request. Attaching a manifest needs its author cap or
a listed character. set_rule and entity::enable_action reject access
requirements, and set_rule rejects Member so list rules pass the attach
check (ADR 0007, task 5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cleanup

access::release / recall / abandon move the policy status (owner cap and
game sponsor; abandon is final). settle_claim (admin) sets a Released or
Abandoned entity back to Owned after the claimant's cap is minted.
entity::destroy_stale_access deletes a parked cap that no longer opens its
Creation (ADR 0007, task 6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
set_power_grid needs SwitchGrid, set_generator / set_generator_fuel_type
need OperateGenerator, set_fuel_bay needs OperateFuelBay, and
set_desired_state / set_priority need OperateModule, in place of the owner
cap. The owner meets them with access::verify_owner; others through the
Creation's policy (ADR 0007, task 7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deposit / deposit_batch push CargoIn and withdraw / withdraw_batch push
CargoOut, so cargo follows the Creation's policy (owner and main manifest
by default). The swap tests open their vending action with per-action
empty rules (ADR 0007, task 8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
grid_fuel::deposit_fuel (and so inventory::deposit_fuel_item) needs Refuel
instead of the owner cap; the game bridges push GameCargoIn and
GameCargoOut. The sponsor is still required. Rules are pushed as they
are, never skipped (ADR 0007, task 9).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
access::migrate (admin) copies a Creation's policy, status included, onto
the section split off from it; the game server then mints the section's
cap to the original cap's holder. Merge needs no new code: the absorbed
cap goes stale and destroy_stale_access removes it (ADR 0007, task 11).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chain records no Shell or Command Module (ADR 0007): layout loses
set_shell, clear_shell and the Shell views; power loses its Shell checks
and shut_down, so switching needs only the permission and modules keep
running while fuel and power allow. Migrated modules and generators keep
their desired and online state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New access and manifest modules: permission requirements, owner and
policy proofs (satisfyAccess), policy edits, release / recall / abandon,
settle_claim, policy migrate, stale-cap cleanup, and manifest edits and
membership proofs. Power and inventory helpers take an AccessProof (the
owner cap still works). Shell and shut_down helpers are gone (ADR 0007).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ADR data model: Policy lives in core::policy, rule keys hold the
permission's type-name string, Access(TypeName) is the requirement, and
detach uses access::migrate. Dock's on-chain check is an open question.
CONTEXT.md gains Policy, Permission and Manifest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xxlegolas
0xxlegolas requested a review from a team as a code owner December 1, 2026 11:48
@0xxlegolas 0xxlegolas changed the title feat(core): ADR 0007 access control: policies, manifests and named permissions feat(core): access control policies, manifests and named permissions Dec 1, 2026
@0xxlegolas
0xxlegolas marked this pull request as draft December 1, 2026 11:55
The seed script still called setShell, removed with the on-chain Shell,
so the localnet integration seed step failed to load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread contracts/core/sources/entity.move Resolved
0xxlegolas and others added 2 commits December 1, 2026 12:43
entity::delete left the PolicyKey dynamic field behind on the deleted UID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps shell_tests.move and shut_down_tests.move deleted; main only reformatted them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cap_id: ID,
name: String,
characters: Table<ID, bool>,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend adding a nonce where the nonce gets incremented whenever a player gets removed from the characters list. It can act as a quality of life "roster version" trigger for gating access to Seal decryption keys for removed characters.

This branch has not been deployed

No deployments
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.

3 participants