Chore: Add WARN log if grafana server process is running with elevated privileges (#35205)

* warn on linux

* add warning for grpc plugins

* add windows support

* update go.mod

* reorganize imports

* update naming

* remove Windows logic

* simplify and add check for when UID and EUID don't match

* fix build

* tidy go.mod

* feedback

* cleanup + migrate
This commit is contained in:
Will Browne
2021-09-13 17:46:47 +02:00
committed by GitHub
parent 40267f5ea0
commit 1a71f0fe13
6 changed files with 51 additions and 18 deletions

View File

@ -7,6 +7,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/process"
"github.com/grafana/grafana/pkg/plugins/backendplugin"
"github.com/hashicorp/go-plugin"
)
@ -72,6 +73,14 @@ func (p *grpcPlugin) Start(ctx context.Context) error {
return errors.New("no compatible plugin implementation found")
}
elevated, err := process.IsRunningWithElevatedPrivileges()
if err != nil {
p.logger.Debug("Error checking plugin process execution privilege", "err", err)
}
if elevated {
p.logger.Warn("Plugin process is running with elevated privileges. This is not recommended")
}
return nil
}