feat: environments and production-to-staging relations (auth M6b)

- environment (production/staging/development) on source orbits and on restore targets;
  an unlabelled target fails closed and a production target is refused
- directed, versioned relations from a managed source orbit to a restore target: one
  active relation per pair, retargeting makes a new id and ends the old one
- refusals name the rule: unknown or unlabelled source/target, not a managed capture
  profile, not restore-ready, application or engine mismatch, inactive Outpost, and a
  target whose identity matches a database captured as production in any snapshot
- relations end in the same transaction when their target is relabelled production or an
  Outpost is revoked; usability is re-read live
- refresh.run is granted per relation id in its own table (user or group, expiry), never
  global, never carried to a new version, and never accepted by the orbit gate
- admin API under /api/v1/relations plus environment endpoints; people holding only a
  relation grant see names and environments, never identity, host, Outpost or application
- Relations console; sign-in form without SSO no longer shows a stray "Details" label

Tests extend the access matrix with relation fixtures and a caller that holds only a
relation grant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 17:46:08 +07:00
parent e72b72111d
commit 5c4e0bf4a9
17 changed files with 1776 additions and 24 deletions

View File

@@ -124,22 +124,34 @@ export function OperatorGate({
</a>
)}
{session.data.login_enabled && (
<details open={!session.data.oidc_enabled} className="group">
{session.data.oidc_enabled && (
session.data.oidc_enabled ? (
<details className="group">
<summary className="cursor-pointer text-sm text-star-300">Emergency operator sign-in</summary>
)}
<form onSubmit={submit} className="mt-3 space-y-4">
<form onSubmit={submit} className="mt-3 space-y-4">
<label className="block text-sm text-star-300">
Operator password
<input type="password" name="password" autoComplete="current-password" required
maxLength={1024} className="mt-1 block w-full rounded-xl border border-space-700 bg-space-950 px-3 py-2 text-star-100" />
maxLength={1024} className="field" />
</label>
{error && <p role="alert" className="text-sm text-orbit-red">{error}</p>}
<Button type="submit" variant="primary" className="w-full" disabled={pending}>
{pending ? "Signing in…" : "Sign in"}
</Button>
</form>
</details>
</details>
) : (
<form onSubmit={submit} className="mt-3 space-y-4">
<label className="block text-sm text-star-300">
Operator password
<input type="password" name="password" autoComplete="current-password" required
maxLength={1024} className="field" />
</label>
{error && <p role="alert" className="text-sm text-orbit-red">{error}</p>}
<Button type="submit" variant="primary" className="w-full" disabled={pending}>
{pending ? "Signing in…" : "Sign in"}
</Button>
</form>
)
)}
</div>
) : <p className="mt-4 text-star-300">Browser sign-in is disabled on this hub.</p>}