Plugins: Expose core APIs only for certain plugins (#107967)

* feat(plugins): add a way to expose core apis only to certain plugins

* review: update naming

* review: update the owners of the feature toggle

* feat: share the restricted apis with extensions

* fix: linters

* feat: remove the `addPanel` api

* chore: fix linting and betterer issue

* tests: use `@ts-expect-error` for more clarity
This commit is contained in:
Levente Balogh
2025-09-01 11:57:00 +02:00
committed by GitHub
parent da43e2ae07
commit d31e682345
20 changed files with 504 additions and 43 deletions
+8
View File
@@ -214,6 +214,10 @@ type Cfg struct {
PluginUpdateStrategy string
// Plugin API restrictions - maps API name to list of plugin IDs/patterns
PluginRestrictedAPIsAllowList map[string][]string
PluginRestrictedAPIsBlockList map[string][]string
// Panels
DisableSanitizeHtml bool
@@ -1057,6 +1061,10 @@ func NewCfg() *Cfg {
Raw: ini.Empty(),
Azure: &azsettings.AzureSettings{},
// Initialize plugin API restriction maps
PluginRestrictedAPIsAllowList: make(map[string][]string),
PluginRestrictedAPIsBlockList: make(map[string][]string),
// Avoid nil pointer
IsFeatureToggleEnabled: func(_ string) bool {
return false