fix: rename deploy capability to guarded route
This commit is contained in:
parent
07ba5de227
commit
fecd8e10d2
|
|
@ -1,5 +1,5 @@
|
||||||
services:
|
services:
|
||||||
deploy-webhook:
|
git-proxy-deploy:
|
||||||
url: http://77.42.112.29:8099/deploy
|
url: http://77.42.112.29:8099/deploy
|
||||||
provides: [deploy]
|
provides: [deploy]
|
||||||
required: true
|
required: true
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export interface CyberPreflightOptions {
|
||||||
const REQUIRED_ENDPOINTS = [
|
const REQUIRED_ENDPOINTS = [
|
||||||
["git_proxy_health", "http://127.0.0.1:8099/health"],
|
["git_proxy_health", "http://127.0.0.1:8099/health"],
|
||||||
["git_proxy_factory_status", "http://127.0.0.1:8099/factory-status"],
|
["git_proxy_factory_status", "http://127.0.0.1:8099/factory-status"],
|
||||||
["deploy_webhook_health", "http://127.0.0.1:8099/deploy"],
|
["deploy_route_health", "http://127.0.0.1:8099/deploy"],
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export function runCyberPreflight(opts: CyberPreflightOptions): CyberPreflightReceipt {
|
export function runCyberPreflight(opts: CyberPreflightOptions): CyberPreflightReceipt {
|
||||||
|
|
@ -45,7 +45,7 @@ export function runCyberPreflight(opts: CyberPreflightOptions): CyberPreflightRe
|
||||||
checks.push(runCheck("docker_inventory", "ssh", ["-p", String(port), `root@${opts.host}`, "docker ps --format '{{.Names}} {{.Status}} {{.Ports}}'"], runner));
|
checks.push(runCheck("docker_inventory", "ssh", ["-p", String(port), `root@${opts.host}`, "docker ps --format '{{.Names}} {{.Status}} {{.Ports}}'"], runner));
|
||||||
|
|
||||||
for (const [name, url] of REQUIRED_ENDPOINTS) {
|
for (const [name, url] of REQUIRED_ENDPOINTS) {
|
||||||
const probe = name === "deploy_webhook_health"
|
const probe = name === "deploy_route_health"
|
||||||
? `test "$(curl -sS -m 5 -o /dev/null -w '%{http_code}' -X POST ${url})" = "401"`
|
? `test "$(curl -sS -m 5 -o /dev/null -w '%{http_code}' -X POST ${url})" = "401"`
|
||||||
: `curl -fsS -m 5 ${url}`;
|
: `curl -fsS -m 5 ${url}`;
|
||||||
checks.push(runCheck(name, "ssh", ["-p", String(port), `root@${opts.host}`, probe], runner));
|
checks.push(runCheck(name, "ssh", ["-p", String(port), `root@${opts.host}`, probe], runner));
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ function writeInputs(root: string, checks: Array<{ name: string; ok: boolean; st
|
||||||
reason: "test",
|
reason: "test",
|
||||||
}, null, 2));
|
}, null, 2));
|
||||||
fs.writeFileSync(capabilities, `services:
|
fs.writeFileSync(capabilities, `services:
|
||||||
deploy-webhook:
|
git-proxy-deploy:
|
||||||
url: http://127.0.0.1:8099/deploy
|
url: http://127.0.0.1:8099/deploy
|
||||||
provides: [deploy]
|
provides: [deploy]
|
||||||
required: true
|
required: true
|
||||||
|
|
@ -46,7 +46,7 @@ describe("cyber reconcile", () => {
|
||||||
it("fails closed when live evidence contradicts required capabilities", () => {
|
it("fails closed when live evidence contradicts required capabilities", () => {
|
||||||
const root = tmpRoot();
|
const root = tmpRoot();
|
||||||
const { preflight, capabilities } = writeInputs(root, [
|
const { preflight, capabilities } = writeInputs(root, [
|
||||||
{ name: "deploy_webhook_health", ok: false, status: 7, stderr: "connection failed" },
|
{ name: "deploy_route_health", ok: false, status: 7, stderr: "connection failed" },
|
||||||
{ name: "git_proxy_factory_status", ok: false, status: 22, stderr: "404" },
|
{ name: "git_proxy_factory_status", ok: false, status: 22, stderr: "404" },
|
||||||
{ name: "git_proxy_health", ok: false, status: 22, stderr: "404" },
|
{ name: "git_proxy_health", ok: false, status: 22, stderr: "404" },
|
||||||
]);
|
]);
|
||||||
|
|
@ -61,7 +61,7 @@ describe("cyber reconcile", () => {
|
||||||
it("allows read-only only when all mapped capabilities have evidence", () => {
|
it("allows read-only only when all mapped capabilities have evidence", () => {
|
||||||
const root = tmpRoot();
|
const root = tmpRoot();
|
||||||
const { preflight, capabilities } = writeInputs(root, [
|
const { preflight, capabilities } = writeInputs(root, [
|
||||||
{ name: "deploy_webhook_health", ok: true, status: 0 },
|
{ name: "deploy_route_health", ok: true, status: 0 },
|
||||||
{ name: "git_proxy_factory_status", ok: true, status: 0 },
|
{ name: "git_proxy_factory_status", ok: true, status: 0 },
|
||||||
{ name: "git_proxy_health", ok: true, status: 0 },
|
{ name: "git_proxy_health", ok: true, status: 0 },
|
||||||
]);
|
]);
|
||||||
|
|
@ -75,7 +75,7 @@ describe("cyber reconcile", () => {
|
||||||
it("writes a reconcile receipt", () => {
|
it("writes a reconcile receipt", () => {
|
||||||
const root = tmpRoot();
|
const root = tmpRoot();
|
||||||
const { preflight, capabilities } = writeInputs(root, [
|
const { preflight, capabilities } = writeInputs(root, [
|
||||||
{ name: "deploy_webhook_health", ok: false, status: 7 },
|
{ name: "deploy_route_health", ok: false, status: 7 },
|
||||||
{ name: "git_proxy_factory_status", ok: false, status: 22 },
|
{ name: "git_proxy_factory_status", ok: false, status: 22 },
|
||||||
{ name: "git_proxy_health", ok: false, status: 22 },
|
{ name: "git_proxy_health", ok: false, status: 22 },
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ function findingsForService(service: FactoryCapabilityService, preflight: CyberP
|
||||||
}
|
}
|
||||||
|
|
||||||
function matchingCheck(capability: string, preflight: CyberPreflightReceipt) {
|
function matchingCheck(capability: string, preflight: CyberPreflightReceipt) {
|
||||||
if (capability === "deploy") return preflight.checks.find((check) => check.name === "deploy_webhook_health");
|
if (capability === "deploy") return preflight.checks.find((check) => check.name === "deploy_route_health");
|
||||||
if (capability === "factory-status") return preflight.checks.find((check) => check.name === "git_proxy_factory_status");
|
if (capability === "factory-status") return preflight.checks.find((check) => check.name === "git_proxy_factory_status");
|
||||||
if (capability === "discovery") return preflight.checks.find((check) => check.name === "git_proxy_health");
|
if (capability === "discovery") return preflight.checks.find((check) => check.name === "git_proxy_health");
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||||
import { formatCapabilityReport, parseFactoryCapabilities, probeFactoryCapabilities } from "./factory-capabilities.js";
|
import { formatCapabilityReport, parseFactoryCapabilities, probeFactoryCapabilities } from "./factory-capabilities.js";
|
||||||
|
|
||||||
const yaml = `services:
|
const yaml = `services:
|
||||||
deploy-webhook:
|
git-proxy-deploy:
|
||||||
url: http://77.42.112.29:8099/deploy
|
url: http://77.42.112.29:8099/deploy
|
||||||
provides: [deploy]
|
provides: [deploy]
|
||||||
required: true
|
required: true
|
||||||
|
|
@ -16,7 +16,7 @@ describe("factory capabilities", () => {
|
||||||
it("parses the capability registry", () => {
|
it("parses the capability registry", () => {
|
||||||
const services = parseFactoryCapabilities(yaml);
|
const services = parseFactoryCapabilities(yaml);
|
||||||
expect(services).toHaveLength(2);
|
expect(services).toHaveLength(2);
|
||||||
expect(services[0]).toMatchObject({ name: "deploy-webhook", required: true, provides: ["deploy"] });
|
expect(services[0]).toMatchObject({ name: "git-proxy-deploy", required: true, provides: ["deploy"] });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fails required capabilities that return 404", async () => {
|
it("fails required capabilities that return 404", async () => {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { verifyCycle } from "./verify-cycle.js";
|
||||||
|
|
||||||
const factoryOk = {
|
const factoryOk = {
|
||||||
factory: { status: "ok", phase: 4, containers: 25, agents: 6, infra: 14, monitoring: 5, skills: 65 },
|
factory: { status: "ok", phase: 4, containers: 25, agents: 6, infra: 14, monitoring: 5, skills: 65 },
|
||||||
deploy: { status: "ok", service: "deploy-webhook" },
|
deploy: { status: "ok", service: "git-proxy-deploy" },
|
||||||
factoryAvailable: true,
|
factoryAvailable: true,
|
||||||
deployAvailable: true,
|
deployAvailable: true,
|
||||||
errors: [],
|
errors: [],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue