Grant a private resource to an environment - #11
Merged
Conversation
A sandbox workload matches no existing principal type. It carries no agent-<id> attribute -- there is no agent class behind it -- and it cannot be a group member, because groups collect users, agents, and apps. Nothing in the access model could name the engineer at a sandbox shell. An environment principal resolves to every workload running that environment, agent workloads and sandboxes alike. Its dial policy names environment-<id>, which the Orchestrator already stamps on every workload identity it creates and which egress rule attachments already target -- so no new OpenZiti mechanism is involved and nothing about the topology changes. The two per-principal steps that assume an identity now branch. An environment is a configuration resource and is not in the Identity registry, so existence and organization resolve through Agents.GetEnvironment; the call forwards the caller for the same reason the group lookup does. AGENTS_GRPC_TARGET joins the dependency set, and WithAgentsClient keeps the existing constructors' shapes since every other principal resolves without it. Authorization is can_edit_config on the environment, matching what an egress rule attachment to an environment already requires and what the agent principal uses on its agent. Not organization owner: a grant here reaches anyone holding can_use, because they can start a sandbox and a sandbox is a shell -- it adds a destination to what a shell there already reaches rather than widening who stands in front of it. The enum gains its value by ALTER TYPE. The runner applies pending migrations in one transaction and PostgreSQL forbids using an enum value in the transaction that added it, so the file says as much for whoever adds the next one.
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.
Depends on agynio/api#184. Spec: agynio/architecture#178.
A sandbox workload matches no existing principal type. It carries no
agent-<id>attribute — there is no agent class behind it — and it cannot be a group member, because groups collect users, agents, and apps. Nothing in the access model could name the engineer at a sandbox shell.An
environmentprincipal resolves to every workload running that environment, agent workloads and sandboxes alike.No new OpenZiti mechanism
The dial policy names
environment-<id>, which the Orchestrator already stamps on every workload identity it creates and which egress rule attachments already target. Same per-resource service, same per-grant policy, same reconciliation, same ≤15s propagation. A workload already running picks the grant up on its next service-list poll without restarting, because the attribute predates the policy.What had to branch
An environment is a configuration resource, not an identity, so it is not in the Identity registry:
Agents.GetEnvironmentinstead ofIdentity.GetIdentityType. The call forwards the caller for the same reason the group lookup does — Agents authorizes environment reads against them.AGENTS_GRPC_TARGETjoins the dependency set.WithAgentsClientkeeps the existing constructors' signatures, since every other principal resolves without it.can_edit_configon the environment — what an egress rule attachment to an environment already requires, and what theagentprincipal uses on its agent. Not organization owner: a grant here reaches anyone holdingcan_use, because they can start a sandbox and a sandbox is a shell. It adds a destination to what a shell there already reaches rather than widening who is standing in front of it. There is a test asserting org-owner alone is not enough.Migration
ALTER TYPE ... ADD VALUE IF NOT EXISTS. The runner applies pending migrations in one transaction and PostgreSQL forbids using an enum value in the transaction that added it — the file says so for whoever adds the next one.Note for the author
This branch was cut while
internal/server/{provisioning,reconciliation,materialization_test}.gohad uncommitted work in the tree (theReturnExisting/ keep-Ziti-IDs-on-failed-reprovision change). Only my hunk ofprovisioning.gois staged here — the environment case inprincipalRoleAttribute. That work is untouched and still sits unstaged locally.