Platform scripts, MCP servers, deployment and docs for the KAB runs
- Scripts to run workflows from a YAML context or run inputs (kab_run_workflow.py, with --input name=@file), store per-project discovery connections, bootstrap agent MCP keys, refresh the KAB token, publish reports and build estate snapshots. - Hyperscaler discovery servers extended in place; cloud-knowledge folded into them. - deploy/crucible-kab-dev.yaml: the Discovery package agent and the Assessment agents. - Platform issue write-ups and current-wiring notes under docs/platform-issues/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,3 +221,55 @@ def test_a_forged_lock_page_token_cannot_send_the_token_elsewhere():
|
||||
args = {"kind": "resource_locks", "page_token": forged}
|
||||
assert call("azure_list_resource_policies", args, arm([], urls), LOCK_SUB)["error"]["code"] == "invalid_page_token"
|
||||
assert not urls
|
||||
|
||||
|
||||
RG = {**CONNECTION, "scope_root": "subscriptions/sub-1/resourceGroups/crucible-kab-dev"}
|
||||
|
||||
|
||||
def test_a_resource_group_scope_filters_every_query():
|
||||
azure = Azure([])
|
||||
for tool, args in (("azure_list_servers", {}), ("azure_get_network_topology", {"kind": "network_security_groups"}),
|
||||
("azure_list_recommendations", {}), ("azure_query_resources", {"query": "Resources | limit 5"})):
|
||||
call(tool, args, azure, RG)
|
||||
assert len(azure.queries) == 4
|
||||
for sent in azure.queries:
|
||||
assert sent["subscriptions"] == ["sub-1"]
|
||||
assert "| where isempty(resourceGroup) or resourceGroup =~ 'crucible-kab-dev' |" in sent["query"]
|
||||
assert azure.queries[3]["query"].startswith("Resources | where isempty(resourceGroup)")
|
||||
|
||||
|
||||
def test_a_resource_group_scope_refuses_a_join():
|
||||
azure = Azure([])
|
||||
result = call("azure_query_resources", {"query": "Resources | join kind=inner (Resources) on id"}, azure, RG)
|
||||
assert result["error"]["code"] == "outside_scope" and not azure.queries
|
||||
|
||||
|
||||
@pytest.mark.parametrize("scope", ["subscriptions/s/resourceGroups/a'b", "subscriptions/s/resourceGroups/",
|
||||
"subscriptions/s/resourceGroups/a/b", "managementGroups/m/resourceGroups/a",
|
||||
"subscriptions/s/resourceGroups/ends."])
|
||||
def test_a_bad_resource_group_fails_closed(scope):
|
||||
azure = Azure([])
|
||||
assert call("azure_list_servers", {}, azure, {**CONNECTION, "scope_root": scope})["success"] is False
|
||||
assert not azure.queries
|
||||
|
||||
|
||||
def test_resource_group_locks_are_read_from_the_group():
|
||||
urls = []
|
||||
call("azure_list_resource_policies", {"kind": "resource_locks"}, arm([], urls), RG)
|
||||
assert "/subscriptions/sub-1/resourceGroups/crucible-kab-dev/providers/Microsoft.Authorization/locks" in urls[0]
|
||||
|
||||
|
||||
def test_check_connection_needs_the_resource_group_to_exist():
|
||||
assert call("azure_check_connection", {}, Azure([{"count_": 0}]), RG)["ok"] is False
|
||||
assert call("azure_check_connection", {}, Azure([{"count_": 1}]), RG)["ok"] is True
|
||||
|
||||
|
||||
def test_an_env_tag_keeps_its_value():
|
||||
tags = {"Environment": "dev", "env": "dev", "criticality": "Low"}
|
||||
assert server._scrub({"tags": tags}) == {"tags": tags}
|
||||
assert server._scrub([{"Key": "env", "Value": "prod"}]) == [{"Key": "env", "Value": "prod"}]
|
||||
|
||||
|
||||
def test_environment_variables_are_still_redacted():
|
||||
container = {"env": [{"name": "DB_PASSWORD", "value": "s3cret"}], "envVars": {"TOKEN": "x"}, "password": "x"}
|
||||
assert server._scrub(container) == {"env": "[redacted]", "envVars": "[redacted]", "password": "[redacted]"}
|
||||
|
||||
Reference in New Issue
Block a user