fix(plugin): remediate ML-07 R2 findings

This commit is contained in:
2026-08-27 21:16:27 +08:00
parent 29cf322f1a
commit f0ac7d70d1
10 changed files with 381 additions and 29 deletions

View File

@@ -46,6 +46,28 @@ function operations(): DataServiceOperations {
}
describe('Data Service plugin adapter', () => {
it('validates the parsed tool supplied by the capability registry', async () => {
const dataService = operations();
const adapter = createDataServicePluginAdapter(dataService);
const inspect = DATA_SERVICE_TOOL_DEFINITIONS.find(({ name }) => name === 'data_service_inspect');
if (!inspect) throw new Error('inspect definition missing');
const result = await adapter.invoke(context, {
...inspect,
inputSchema: {
type: 'object',
additionalProperties: false,
required: ['registry_token'],
properties: { registry_token: { type: 'string', minLength: 1 } },
},
}, {});
expect(result).toMatchObject({
success: false, status: 422, code: 'plugin_input_invalid', data: null,
});
expect(dataService.inspect).not.toHaveBeenCalled();
});
it('maps all ten package operations through DataServiceOperations', async () => {
const dataService = operations();
const adapter = createDataServicePluginAdapter(dataService);