You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
3.2 KiB
PHP
72 lines
3.2 KiB
PHP
<?php
|
|
|
|
$root = dirname(__DIR__);
|
|
$read = static fn (string $path): string => file_get_contents($root . '/' . $path);
|
|
$assert = static function (bool $condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$schema = $read('sql/cloud.sql');
|
|
$setup = $read('app/Command/CloudSetup.php');
|
|
$routes = $read('config/routes_cloud.php');
|
|
$middleware = $read('app/Middleware/CloudApi.php');
|
|
$controller = $read(
|
|
'app/Controllers/CloudAdminHostNetworkAttachmentController.php'
|
|
);
|
|
$service = $read(
|
|
'app/Services/Cloud/CloudHostNetworkAttachmentService.php'
|
|
);
|
|
$agent = $read('app/Services/Cloud/CloudAgentSettingsService.php');
|
|
|
|
$assert(str_contains($schema, 'network_selectors_json LONGTEXT NOT NULL')
|
|
&& str_contains($schema,
|
|
'config_revision BIGINT UNSIGNED NOT NULL DEFAULT 1')
|
|
&& str_contains($schema,
|
|
'verified_agent_revision BIGINT UNSIGNED NOT NULL DEFAULT 0')
|
|
&& str_contains($schema,
|
|
"verification_state VARCHAR(16) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT 'never'")
|
|
&& str_contains($schema,
|
|
'UNIQUE KEY cloud_host_network_selector (host_id, network_selector)')
|
|
&& str_contains($schema, 'cloud_network_attachment_verification')
|
|
&& str_contains($setup, "'network_selectors_json'")
|
|
&& str_contains($setup, "'verification_error_code'"),
|
|
'Fresh schema/setup lost independent Agent selector evidence.');
|
|
|
|
$assert(str_contains($routes, '/network-attachments\'')
|
|
&& str_contains($routes, '/network-attachments/discover')
|
|
&& str_contains($routes,
|
|
'/network-attachments/{attachment_key:[0-9a-f]{32}}/test')
|
|
&& str_contains($middleware, 'network-attachments')
|
|
&& str_contains($controller, 'CloudAccess::manage($actor)')
|
|
&& str_contains($controller, "'Cache-Control', 'private, no-store'")
|
|
&& str_contains($controller, "'expected_revision'"),
|
|
'Attachment HTTP routes lost authorization, no-store or CAS boundaries.');
|
|
|
|
$assert(str_contains($agent,
|
|
"->request('GET', '/v1/capabilities', \$actor)")
|
|
&& str_contains($agent, 'network_selectors_json')
|
|
&& str_contains($agent, 'testedNetworkSelectors(')
|
|
&& str_contains($service,
|
|
'CloudAgentSettingsService::probeNetworkSelectors')
|
|
&& str_contains($service,
|
|
'CloudAgentSettingsService::testedNetworkSelectors')
|
|
&& str_contains($service, "verification_state = 'verified'")
|
|
&& str_contains($service, 'verified_agent_revision')
|
|
&& str_contains($service, 'agent_network_selector_missing')
|
|
&& !str_contains($service, 'sync_state = \'verified\''),
|
|
'Attachment verification no longer uses exact current Agent evidence.');
|
|
|
|
$assert(str_contains($service, 'CloudHostPoolMembershipService::lockedRows')
|
|
&& str_contains($service, 'assertMembershipLine(')
|
|
&& str_contains($service, 'sameConfiguration(')
|
|
&& str_contains($service, 'expected_revision')
|
|
&& str_contains($service, 'request_key')
|
|
&& str_contains($service, "scheduler_state === 'active'")
|
|
&& str_contains($service, "->where('status', 'active')")
|
|
&& str_contains($service, 'CloudPublicIpPool::where('),
|
|
'Attachment writes lost membership, idempotency, CAS or bound-pool guards.');
|
|
|
|
echo "Administrator host network attachment contracts passed.\n";
|