Simple secret-based auth for VM ownership #2

Closed
opened 2026-03-05 08:11:38 +00:00 by mahmoud · 1 comment
Owner

Description

Add a secret field to VM deployment so users can only see and manage their own VMs. No user accounts, no JWT; just a secret string stored on the VM record.

How It Works

When deploying a VM, the user provides a secret:

  • deploy_vm(name, slice_sid, image, cpu_count, secret)

The secret is stored on the Vm record. All subsequent operations require the same secret to be passed:

  • list_vms(secret) — returns only VMs matching the secret
  • get_vm(sid, secret) — returns error if secret doesn't match
  • delete_vm(sid, secret) — returns error if secret doesn't match
  • start_vm, stop_vm, restart_vm — require secret too

VMs without a matching secret are invisible — not returned in lists, not accessible by sid. No indication they exist.

Changes Required

  • schemas/cloud/cloud.oschema — add secret: str to Vm type and update all affected service methods
  • rpc.rs — validate secret on every VM operation
  • hero_cloud_sdk — update all input types with secret field
  • openrpc.json — regenerate from schema
  • docs/api.md — document secret field and behavior

Notes

  • Secret is stored as plaintext for now (keep it simple)
  • Empty string secret = no protection (backward compatible)
  • This is the foundation for multi-tenant usage on the Explorer
### Description Add a `secret` field to VM deployment so users can only see and manage their own VMs. No user accounts, no JWT; just a secret string stored on the VM record. ### How It Works When deploying a VM, the user provides a secret: - `deploy_vm(name, slice_sid, image, cpu_count, secret)` The secret is stored on the Vm record. All subsequent operations require the same secret to be passed: - `list_vms(secret)` — returns only VMs matching the secret - `get_vm(sid, secret)` — returns error if secret doesn't match - `delete_vm(sid, secret)` — returns error if secret doesn't match - `start_vm`, `stop_vm`, `restart_vm` — require secret too VMs without a matching secret are invisible — not returned in lists, not accessible by sid. No indication they exist. ### Changes Required - `schemas/cloud/cloud.oschema` — add `secret: str` to Vm type and update all affected service methods - `rpc.rs` — validate secret on every VM operation - `hero_cloud_sdk` — update all input types with secret field - `openrpc.json` — regenerate from schema - `docs/api.md` — document secret field and behavior ### Notes - Secret is stored as plaintext for now (keep it simple) - Empty string secret = no protection (backward compatible) - This is the foundation for multi-tenant usage on the Explorer
despiegk added this to the now milestone 2026-03-09 10:11:11 +00:00
Author
Owner

Fixed

Fixed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_compute#2
No description provided.