Skip to content

feat(permissions): add the sandbox permission sets - #395

Open
ItamarZand88 wants to merge 1 commit into
itamar/alien-75-sandbox-2-agentfrom
itamar/alien-75-sandbox-3-permissions
Open

feat(permissions): add the sandbox permission sets#395
ItamarZand88 wants to merge 1 commit into
itamar/alien-75-sandbox-2-agentfrom
itamar/alien-75-sandbox-3-permissions

Conversation

@ItamarZand88

Copy link
Copy Markdown
Contributor

Summary

Adds the four cloud permission sets a sandbox needs — provision, management, execute and heartbeat — so a deployment can build a sandbox image, start and stop sessions, and run code in one, each with only the access that job requires.

The sets divide along one line: reaching inside a live session is separate from managing sessions.

  1. provision builds and tears down the image a session launches from, and tags it — that tag is the boundary everything else scopes against.
  2. management starts, stops and lists sessions. It can end a session it cannot read.
  3. execute mints the credential that reaches inside a session, and is the only set that does. This is the line the whole split exists to draw.
  4. heartbeat counts sessions and reads image metadata, and nothing else.

A resource link hands a workload execute, so anything a workload should not have has to live outside it.

What I did

Each cloud authorizes these operations differently, and the sets follow the platform rather than a house shape:

  • AWS authorizes every MicroVM operation against the image, not the running MicroVM — there is no resource type for a running one. So RunMicrovm, TerminateMicrovm, SuspendMicrovm, ResumeMicrovm, GetMicrovm and the auth-token mint are all scoped to this sandbox's own image ARNs. Three actions (CreateMicrovmImage, ListMicrovmImages, ListMicrovms) are authorized against no resource type at all; creation is bounded by boundary tags in the request instead, and the two list actions are name-only reads.
  • Azure exposes session lifecycle and session contents as separate data actions, so management takes the lifecycle four and execute takes the role that carries the data plane.
  • GCP has no entry, and needs none: a GCP sandbox is a subprocess of the workload's own instance, so it creates no cloud resource.

Files touched

  • crates/alien-permissions/permission-sets/sandbox/*.jsonc — the four sets.
  • crates/alien-permissions/src/generators/azure_runtime.rs — one role-id mapping.
  • crates/alien-permissions/tests/* — the invariant and coverage tests below.

How I tested

  • Checked every action in the four sets against the pinned AWS IAM dataset and the Azure provider-operations dataset the repository already validates against, confirming each action's required resource type matches what the set binds it to. This is what a scoped role will actually enforce, and it is not something a deployment test would surface — broad credentials never refuse.
  • Extended the sensitive-content invariant to name the Azure actions that reach inside a session, then confirmed by mutation that putting one of them into management fails the test. It passed before the change, which is why the test was extended.
  • Confirmed by mutation that the tag condition on image creation is load-bearing: removing it fails the wildcard-resource test.
  • Confirmed by mutation that an unscoped MicroVM ARN now fails the scoping test. Two exemptions previously described these actions as impossible to scope; both were removed, and the statements they covered are checked again.
  • cargo test -p alien-permissions — 134 tests.

Security review of this diff, since these grants are what a customer's cloud enforces:

  • A management, provision or heartbeat holder reaching session contents — refused by construction and pinned by test on both clouds; the auth-token mint and the Azure data-plane role appear in execute alone.
  • A workload reaching another stack's sandbox — every MicroVM statement is scoped to image ARNs carrying this stack's prefix, and image creation carries the stack, resource and managed-by tags in the request.
  • A workload reaching another sandbox in its own stack — the resource binding narrows further, to the sandbox's own name.
  • An interactive shell into a session — CreateMicrovmShellAuthToken is granted nowhere, and is named in the test constants so adding it has to be deliberate.
  • Wildcard resources — the three that carry one are the actions AWS authorizes with no resource type; creation is tag-conditioned and the other two are reads.

Nothing turned up.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds provision, management, execute, and heartbeat permission sets for sandbox resources while separating session-content access from lifecycle and monitoring permissions.

  • Adds AWS and Azure grants for sandbox image provisioning, session lifecycle, execution credentials, and heartbeat metadata.
  • Restricts Azure execute, management, and heartbeat grants to individual sandbox-group resource bindings.
  • Adds Azure predefined-role resolution and updates Terraform emission to skip unsupported stack targets for resource-only grants.
  • Extends provider-operation coverage and sensitive-permission invariants for the new sandbox capabilities.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/alien-permissions/permission-sets/sandbox/execute.jsonc Adds execution-only AWS token minting and an Azure Data Owner assignment scoped to one sandbox group.
crates/alien-permissions/permission-sets/sandbox/heartbeat.jsonc Adds metadata-only heartbeat grants and limits Azure access to the bound sandbox group.
crates/alien-permissions/permission-sets/sandbox/management.jsonc Adds session lifecycle permissions without session-content credentials and removes Azure stack-level scope.
crates/alien-permissions/permission-sets/sandbox/provision.jsonc Adds image and sandbox-group provisioning grants with AWS creation-tag conditions and documented Azure creation scope.
crates/alien-permissions/src/generators/azure_runtime.rs Maps the Container Apps SandboxGroup Data Owner role name to its Azure role identifier.
crates/alien-terraform/src/emitters/azure/helpers.rs Avoids requesting unsupported stack grants from permission sets that intentionally expose only resource bindings.
crates/alien-permissions/tests/azure_runtime.rs Verifies execute, management, and heartbeat cannot generate stack-scoped Azure grants while resource grants remain available.
crates/alien-permissions/tests/aws_sensitive_invariant.rs Classifies MicroVM session-content credentials as sensitive implicit actions.
crates/alien-permissions/tests/azure_sensitive_invariant.rs Classifies Azure sandbox command, file, and Data Owner capabilities as sensitive.
crates/alien-permissions/tests/aws_abac_validation.rs Requires request-tag constraints for wildcard-scoped MicroVM image creation.
crates/alien-permissions/tests/operation_coverage.rs Adds critical provider-operation coverage for sandbox provisioning, execution, and management.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Provision["sandbox/provision"] --> Parent["Sandbox image or group"]
  Management["sandbox/management"] --> Lifecycle["Create, list, stop sessions"]
  Execute["sandbox/execute"] --> Contents["Commands and file access"]
  Heartbeat["sandbox/heartbeat"] --> Metadata["Parent state and session counts"]
  Parent --> Lifecycle
  Lifecycle --> Contents
Loading

Reviews (19): Last reviewed commit: "feat(permissions): add the sandbox permi..." | Re-trigger Greptile

Comment thread crates/alien-permissions/permission-sets/sandbox/provision.jsonc
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from b03c4c7 to 454d8f0 Compare August 11, 2026 09:10
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 454d8f0 to e7e0597 Compare August 11, 2026 12:11
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from e7e0597 to 53618cb Compare August 11, 2026 13:19
Comment thread crates/alien-permissions/permission-sets/sandbox/execute.jsonc Outdated
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 53618cb to 20a0772 Compare August 11, 2026 13:51
Comment thread crates/alien-permissions/permission-sets/sandbox/management.jsonc Outdated
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 20a0772 to 1170ea7 Compare August 11, 2026 16:53
Comment thread crates/alien-permissions/permission-sets/sandbox/provision.jsonc
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 1170ea7 to b84c357 Compare August 11, 2026 17:11
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from b84c357 to c129036 Compare August 11, 2026 17:28
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from c129036 to 64d14df Compare August 11, 2026 18:40
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 64d14df to e7785d8 Compare August 11, 2026 18:49
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from e7785d8 to 49bfe79 Compare August 11, 2026 19:16
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 49bfe79 to 3561d35 Compare August 11, 2026 19:24
Comment thread crates/alien-permissions/permission-sets/sandbox/heartbeat.jsonc Outdated
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 3561d35 to cf18963 Compare August 11, 2026 19:49
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from cf18963 to 243a3b7 Compare August 11, 2026 20:08
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 243a3b7 to 09b80af Compare August 11, 2026 21:22
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 09b80af to 3f47f93 Compare August 11, 2026 21:26
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 3f47f93 to 7801481 Compare August 11, 2026 22:16
@ItamarZand88
ItamarZand88 force-pushed the itamar/alien-75-sandbox-3-permissions branch from 7801481 to 47b76f5 Compare August 11, 2026 22:24
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.

1 participant