feat: migrate_secret RPC — allow users to change their secret without losing VM access #17
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_compute#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
VMs are protected by a secret stored in plain text in OSIS. If a user changes their secret (via the UI cog
menu), all previously deployed VMs become permanently
inaccessible — start, stop, delete all return NotFound.
There is currently no recovery path.
Solution
Add a migrate_secret(old_secret, new_secret) RPC method
to ComputeService that atomically updates the secret on
all VMs the user owns.
RPC Method
Behavior
(proves the old secret is wrong, leaks nothing)
matched VMs
Security Rules
wrong old_secret → NotFound (not "wrong secret")
if empty
(no-op migration is a user error)
if old_secret is empty, match all VMs with
empty secret only (existing bypass behavior)
UI Integration
The "Change Secret" flow in the UI becomes:
a. Call migrate_secret(old, new)
b. On success: update localStorage with new secret,
show toast "✓ Secret updated — X VMs migrated"
c. On NotFound: show "Current secret is incorrect"
d. On error: show error message
unchanged — only shown when no secret exists
Schema Changes
Implementation Notes
atomically if possible — avoid partial migration
one by one and report partial success in the result:
MigrateSecretResult = {
migrated_count: u32
failed_count: u32
}
happens directly on the node server
Definition of Done
Should be done now