Compact contour actions and delete VPS applications with all access
Device Core qualification / qualify (push) Successful in 7m19s

This commit is contained in:
DCCONSTRUCTIONS
2026-10-01 01:10:56 +03:00
parent 539c0a60b8
commit 010fab999e
7 changed files with 71 additions and 28 deletions
@@ -303,3 +303,18 @@ test('VPS onboarding reuses the project host and audits no credential material',
assert.ok(audit.length > 0);
assert.ok(!JSON.stringify(audit).includes(pkg.client_secret));
});
test('application deletion requires company and credential authority and forwards only the application ID', async () => {
const repo = repository(); const calls = [];
const service = new B2Infrastructure({ pool: repo.pool, secrets: { read: async () => pkg },
clientFactory: () => ({ async call(path, body) { calls.push({ path, body }); return { deleted: true, id: body.integration_id }; } }) });
const input = { projectRef: `project:${projectId}`, hostRef: `host:${hostId}`, action: 'application-delete', integrationId: 'c'.repeat(32) };
await assert.rejects(service.execute({ ...actor, hubRole: 'member', ownerScopes: [] }, input, '1'.repeat(32)), /device_owner_scope_access_denied/);
await assert.rejects(service.execute(actor, { ...input, integrationId: '../foreign' }, '1'.repeat(32)), /b2_identifier_invalid/);
await assert.rejects(service.execute(actor, { ...input, force: true }, '1'.repeat(32)), /b2_unexpected_field/);
assert.equal(calls.length, 0);
assert.deepEqual(await service.execute(actor, input, '1'.repeat(32)), { deleted: true, id: input.integrationId });
assert.deepEqual(calls, [{ path: '/v2/management/applications/delete', body: { integration_id: input.integrationId } }]);
assert.equal(repo.writes.at(-1).values[1], 'b2.application-delete');
});