Skip to content

fix(manager): only the Operator may hold a deployment's tunnel - #832

Merged
alongubkin merged 3 commits into
mainfrom
alon/alien-1200-tunnel-operator-role
Oct 3, 2026
Merged

alongubkin merged 3 commits into
mainfrom
alon/alien-1200-tunnel-operator-role

Conversation

@alongubkin

@alongubkin alongubkin commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Fixes ALIEN-1200: two authorization gaps in routes added for self-hosted Kubernetes installs. Neither has shipped in a release yet.

Tunnel connect checked the scope, not the role. GET /v1/tunnel/connect accepted any deployment-scoped token. Whoever holds that connection receives every request sent through the deployment's tunnels, including the caller's own Authorization header. So a deployment viewer, telemetry writer or remote-binding resolver could take over a deployment's tunnel traffic. It now also requires can_sync_deployment, the rule the Operator's sync already uses.

Chart and Operator image pulls skipped the capability refusal. proxy_pull routed charts/ and alien-operator before refuse_capability_pull, so image-repository-provisioning and sandbox-push credentials could pull them. They are now refused before any pull is routed.

The standalone manager's own token store only issues deployment-scoped tokens to Operators and issues neither capability role. So this matters wherever a custom AuthValidator issues those roles.

Testing. crates/alien-manager/tests/access_roles.rs runs the real tunnel and registry routes with a validator that issues each role:

  • The Operator's own tunnel client dials the manager's tunnel route over TCP and gets a live connection for its deployment. Viewer, telemetry writer and binding resolver tokens get 403.
  • Both capability roles get 403 DENIED on chart and Operator-image pulls. A project developer gets past the role check (404, since this manager serves neither).

The test was pushed first on its own. The review of that commit confirmed both access-denial checks fail without the fix.

🤖 Generated with Claude Code

Route-level test with a validator that issues each role, the way an
embedder does. It fails on main: a deployment viewer, telemetry writer
or binding resolver can open the deployment's tunnel, and image
provisioning and sandbox push credentials can pull charts and the
Operator image.

Refs ALIEN-1200

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Critical risk] Restricts tunnel access to deployment Operators only.

The PR appears safe to merge; no outstanding findings or new actionable issues remain.

Summary

The PR restricts deployment tunnels to callers authorized to sync the deployment and refuses capability-role pulls before chart and Operator-image routing. It adds route tests covering both restrictions and a live Operator tunnel connection.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  T[Tunnel connect] --> A[Authenticate and load deployment]
  A --> S{May sync deployment?}
  S -->|No| F[403 Forbidden]
  S -->|Yes| W[WebSocket upgrade]
  P[Registry pull] --> V[Validate OCI path]
  V --> C{Capability role?}
  C -->|Yes| D[403 DENIED]
  C -->|No| R[Route chart, Operator image, or upstream pull]
Loading

Reviews (3) · Last reviewed commit: "fix(manager): validate the pull path bef..."

Comment thread crates/alien-manager/tests/access_roles.rs
Comment thread crates/alien-manager/tests/access_roles.rs Outdated
Comment thread crates/alien-manager/tests/access_roles.rs
Tunnel connect accepted any deployment-scoped token, so a viewer,
telemetry writer or binding resolver could take the connection and
receive the deployment's tunnel traffic. It now also requires
can_sync_deployment, the rule the Operator's sync uses.

Chart and Operator image pulls were routed before the capability
refusal. Capability credentials are now refused before any pull is
routed.

The test's Operator case now opens a real tunnel with the Operator's
own client over TCP, instead of only checking the 101 response.

Fixes ALIEN-1200

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai review

A path that names no repository, such as /v2/_catalog, is refused with
400 for every caller. Refusing capability roles first turned that into
403 for them. The role check now runs after path validation and still
before charts and the Operator image are routed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai review

@alongubkin
alongubkin merged commit 0ced619 into main Oct 3, 2026
22 checks passed
@alongubkin
alongubkin deleted the alon/alien-1200-tunnel-operator-role branch October 3, 2026 05:36
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