mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-10 10:49:35 +00:00
35bb74425b
* feat: guide missing external network creation during deploy Detect missing external networks before Compose runs, prompt or auto-create safe bridge networks, and keep unsupported declarations blocked with trusted deploy provenance. * test: align deploy context and settings fixtures with missing-network gate Update caller spies, EffResource expectations, StacksSection save keys, and git-source spy cleanup so CI matches the new deployStack context and auto-create setting. * fix: drop unused renderError binding in missing-network resolver Satisfies no-unused-vars so backend ESLint CI passes; callers already key only on model presence. * fix: use HTTP-safe clipboard helper in missing-network dialog navigator.clipboard fails on plain HTTP LAN hosts; route copy actions through copyToClipboard so Docker and Compose copy buttons work on self-hosted instances. * fix: simplify missing-network dialog actions and copy label Drop the Compose snippet escape hatch, move secondary actions under More, and rename the terminal copy action to Copy create command so the footer is a clear Cancel / Create decision.
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
/**
|
|
* HTTP header names used for Distributed License Enforcement between
|
|
* Sencho instances. A primary instance proxies tier-gated requests to
|
|
* its remote fleet nodes and asserts the license state via these
|
|
* headers; the remote node trusts the headers when the request is
|
|
* authenticated as a node_proxy bearer.
|
|
*/
|
|
export const PROXY_TIER_HEADER = 'x-sencho-tier';
|
|
|
|
/**
|
|
* Carries the signed-in user's role from the forwarding primary to the remote
|
|
* node, so the remote enforces that user's RBAC instead of treating every
|
|
* proxied request as admin. Trusted under the same rule as PROXY_TIER_HEADER:
|
|
* only a request authenticated as a node_proxy/pilot_tunnel bearer may set it,
|
|
* and the gateway overwrites it on every proxied request so a browser or API
|
|
* client cannot smuggle a role through.
|
|
*/
|
|
export const PROXY_ROLE_HEADER = 'x-sencho-actor-role';
|
|
|
|
/**
|
|
* Trusted deploy provenance for machine-to-machine / proxied deploys.
|
|
* The gateway always strips client-supplied values and, for interactive
|
|
* proxied requests, overwrites with source=manual and the signed-in username.
|
|
* Background callers (scheduler, fleet, blueprint, mesh) set these only on
|
|
* direct machine-originated HTTP after the strip boundary.
|
|
*/
|
|
export const PROXY_DEPLOY_SOURCE_HEADER = 'x-sencho-deploy-source';
|
|
export const PROXY_DEPLOY_ACTOR_HEADER = 'x-sencho-deploy-actor';
|
|
|
|
export const DEPLOY_SOURCES = [
|
|
'manual',
|
|
'rollback',
|
|
'template',
|
|
'from_git',
|
|
'git_apply',
|
|
'fleet_snapshot',
|
|
'labels',
|
|
'scheduler',
|
|
'webhook',
|
|
'blueprint',
|
|
'mesh_redeploy',
|
|
] as const;
|
|
|
|
export type DeploySourceHeader = (typeof DEPLOY_SOURCES)[number];
|
|
|
|
export function isDeploySourceHeader(value: unknown): value is DeploySourceHeader {
|
|
return typeof value === 'string' && (DEPLOY_SOURCES as readonly string[]).includes(value);
|
|
}
|
|
|
|
/** Headers for direct machine-originated deploy HTTP (never for browser clients). */
|
|
export function deployProvenanceHeaders(
|
|
source: DeploySourceHeader,
|
|
actor: string,
|
|
): Record<string, string> {
|
|
return {
|
|
[PROXY_DEPLOY_SOURCE_HEADER]: source,
|
|
[PROXY_DEPLOY_ACTOR_HEADER]: actor,
|
|
};
|
|
}
|