mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Frontend Sandbox: Do not consider internal plugins as elegible (#96325)
This commit is contained in:
parent
f83f7332a1
commit
acf57aa556
@ -7,6 +7,7 @@ import {
|
|||||||
shouldLoadPluginInFrontendSandbox,
|
shouldLoadPluginInFrontendSandbox,
|
||||||
setSandboxEnabledCheck,
|
setSandboxEnabledCheck,
|
||||||
isPluginFrontendSandboxEnabled,
|
isPluginFrontendSandboxEnabled,
|
||||||
|
isPluginFrontendSandboxEligible,
|
||||||
} from './sandbox_plugin_loader_registry';
|
} from './sandbox_plugin_loader_registry';
|
||||||
|
|
||||||
jest.mock('@grafana/runtime', () => ({
|
jest.mock('@grafana/runtime', () => ({
|
||||||
@ -89,4 +90,11 @@ describe('Sandbox eligibility checks', () => {
|
|||||||
expect(customCheck).toHaveBeenCalledWith({ pluginId: 'test-plugin' });
|
expect(customCheck).toHaveBeenCalledWith({ pluginId: 'test-plugin' });
|
||||||
expect(result).toBe(false);
|
expect(result).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('isPluginFrontendSandboxEligible returns false for plugins with internal signature', async () => {
|
||||||
|
//@ts-expect-error We don't publicly export the internal signature
|
||||||
|
getPluginSettingsMock.mockResolvedValue({ ...fakePlugin, signature: 'internal' });
|
||||||
|
const result = await isPluginFrontendSandboxEligible({ pluginId: 'test-plugin' });
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -64,7 +64,7 @@ export async function isPluginFrontendSandboxEligible({
|
|||||||
try {
|
try {
|
||||||
// don't run grafana-signed plugins in sandbox
|
// don't run grafana-signed plugins in sandbox
|
||||||
const pluginMeta = await getPluginSettings(pluginId, { showErrorAlert: false });
|
const pluginMeta = await getPluginSettings(pluginId, { showErrorAlert: false });
|
||||||
if (pluginMeta.signatureType === PluginSignatureType.grafana) {
|
if (pluginMeta.signatureType === PluginSignatureType.grafana || pluginMeta.signature === 'internal') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user