fix: ShowDiagnostics now behind policy checks

This commit is contained in:
jamesread 2026-02-26 20:43:14 +00:00
parent 24cced0c8c
commit 4af4d516be
1 changed files with 7 additions and 1 deletions

View File

@ -893,11 +893,17 @@ func (api *oliveTinAPI) OnExecutionFinished(ile *executor.InternalLogEntry) {
} }
func (api *oliveTinAPI) GetDiagnostics(ctx ctx.Context, req *connect.Request[apiv1.GetDiagnosticsRequest]) (*connect.Response[apiv1.GetDiagnosticsResponse], error) { func (api *oliveTinAPI) GetDiagnostics(ctx ctx.Context, req *connect.Request[apiv1.GetDiagnosticsRequest]) (*connect.Response[apiv1.GetDiagnosticsResponse], error) {
user := auth.UserFromApiCall(ctx, req, api.cfg)
if err := api.checkDashboardAccess(user); err != nil {
return nil, err
}
if !user.EffectivePolicy.ShowDiagnostics {
return nil, connect.NewError(connect.CodePermissionDenied, fmt.Errorf("diagnostics are not available for your account"))
}
res := &apiv1.GetDiagnosticsResponse{ res := &apiv1.GetDiagnosticsResponse{
SshFoundKey: installationinfo.Runtime.SshFoundKey, SshFoundKey: installationinfo.Runtime.SshFoundKey,
SshFoundConfig: installationinfo.Runtime.SshFoundConfig, SshFoundConfig: installationinfo.Runtime.SshFoundConfig,
} }
return connect.NewResponse(res), nil return connect.NewResponse(res), nil
} }