Commit Graph

14218 Commits

Author SHA1 Message Date
Gabriel MABILLE
b90e09e966
Fix: Deduplicate OrgID in SA logins (#94378)
* Fix: Deduplicate OrgID in SA logins
2024-10-08 13:35:08 +02:00
Misi
bd7850853e
Auth: Attach external session info to Grafana session (#93849)
* initial from poc changes

* wip

* Remove public external session service

* Update swagger

* Fix merge

* Cleanup

* Add backgroud service for cleanup

* Add auth_module to user_external_session

* Add tests for token revocation functions

* Add secret migration capabilities for user_external_session fields

* Cleanup, refactor to address feedback

* Fix test
2024-10-08 11:03:29 +02:00
Jo
9eea0e99fc
Chore: Use UIDs as identifiers for teams frontend (#94345)
* Team frontend now uses UIDs as identifiers. Safe to revert
2024-10-08 09:48:35 +02:00
Jo
945dd052b1
Fix: Ensure SA migrations doesn't hit migrated SAs if rerun (#94347)
* ensure mig doesn't hit migrated SAs if rerun

* Fix small issue with the test

---------

Co-authored-by: gamab <gabriel.mabille@grafana.com>
2024-10-08 09:45:14 +02:00
Yuri Tseretyan
b8df574aba
Alerting: Support optimistic concurrency in notification policies service (#93932)
* update notification policy provisioning service to support optimistic concurrency
* rewrite tests and include concurrency tests
2024-10-08 00:09:02 +03:00
Yuri Tseretyan
4c1cb79069
Alerting: Add access control to receiver status API (#94287) 2024-10-07 15:21:29 -04:00
Arati R.
ea5cf7c51f
Unified Storage /Folders: Allow Unified Storage subfolders creation (#94327)
* Add parents field to folder DTO
* Allow subfolder creation when folder flag is enabled
* Update UnstructuredToLegacyFolder
* Include parents field when creating folder
2024-10-07 16:48:56 +02:00
Ieva
d7aca7d0fe
Role mapping: Add group_mapping_uid column to user_role table (#93810)
* add group_mapping_uid column to user_role table

* add group mapping UID to user role struct
2024-10-07 15:47:16 +01:00
Misi
0539ccf10d
Auth: Fix redirection when auto_login is enabled (#94311)
* Fix for SAML auto login

* Fix for OAuth auto login
2024-10-07 14:59:00 +02:00
Matheus Macabu
6bd2f9f3ea
CloudMigrations: remove duplicated import on test (#94322) 2024-10-07 15:32:52 +03:00
Matheus Macabu
712314e832
CloudMigrations: create onPremToCloudMigrationsAlerts feature toggle in experimental stage (#94257)
CloudMigrations: create onPremToCloudMigrationsAlerts feature toggle in experimental stage

This feature toggle requires the `onPremToCloudMigrations` toggle to be enabled in order to work.

Given migration of Alerts (and child resources) is more critical, this flag was separated from
the main one.
2024-10-07 12:53:24 +02:00
Matheus Macabu
e89aef57cb
CloudMigrations: wire ngalert to cloud migration service and add slicesext.Map helper (#94254)
* CloudMigrations: add slicesext.Map function to simplify dto creation

* CloudMigrations: wire ngalert to cloud migration service
2024-10-07 12:53:14 +02:00
Matheus Macabu
9af095d730
CloudMigrations: Add data types for alerts resources (#94251) 2024-10-07 12:52:31 +02:00
Dana Axinte
d88be2819d
CloudMigrations: Store parent folder name in cloud_migration_resource table (#94009)
* use name in fe

* store parent folder name in local db

* clean up

* tiny test

* trial react

* rename to parent name

* go lint

* generate api and ts

* go tests

* rearrange

* clean

* update with suggestions from josh

* make library elements work

* updates from comments

* global migration types

* parent name for alter table
2024-10-07 11:35:08 +01:00
Arati R.
5a9bd1d1cf
K8s/Folders: Fix folder create payload (#94273)
* Fix createdBy and updatedBy
* Fix refreshing permission cache
* Update created time
* Fix user identifier parsing
2024-10-07 13:32:25 +03:00
maicon
261be0facd
UniStore: Evaluate Folder DTO attributes (#93968)
* UniStore: Evaluate Folder DTO attributes

* Handle AccessControl

* Reduce the number of parameters to newToFolderDto

* Detach Metadata helpers from HTTPServer

* Add tests

---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
2024-10-07 12:08:16 +02:00
Roberto Jiménez Sánchez
19c77eaae1
CloudMigrations: Fix traceability & HTTP Client initialisation (#94141)
* Add traceability to Migration Assistant feature

* Fix some compilation errors

* Fix lint issues

* Use async context

* Add trace for LibraryElements
2024-10-07 11:31:45 +02:00
Matheus Macabu
4bc7a35f56
UnifiedStorage: fix watcher test (#94301) 2024-10-07 12:07:48 +03:00
Jo
acd13e05ef
Teams: Support team UIDs in APIs (#94011)
* support team UIDs in APIs

* unify middleware logic and add team tests

* add UID test to resource permissions

* remove unused middleware
2024-10-07 10:18:24 +02:00
Georges Chaudy
03f55e5288
Unistore : Ensure Watch works in HA mode (#94120)
* Revert "Revert "Unistore : Ensure Watch works in HA mode." (#94097)"

This reverts commit 7c3fc2f261.

* make previous_resource_version nullable

* handle nil case
2024-10-07 10:01:53 +02:00
Brandon
fbad76007d
Alerting: Limit and clean up old alert rules versions (#89754) 2024-10-05 00:31:21 +03:00
Matthew Jacobson
099055e8a5
Alerting: Verify receiver permission read on rule create/update (#94286)
* Alerting: Verify receiver permission read on rule create/update
2024-10-04 23:52:38 +03:00
Yuri Tseretyan
27c7e33217
Alerting: Update permissions to reciever and template test API (#94282)
* add action "alert.notifications.receivers:test" to receiver creator

* update API permissions to accept new granular actions
2024-10-04 15:52:44 -04:00
Gabriel MABILLE
fe3ada4a6c
Revert "AuthN: Managed plugin Service Accounts general availability" (#94270)
Revert "AuthN: Managed plugin Service Accounts general availability (#93384)"

This reverts commit 943525391e.
2024-10-04 17:28:24 +02:00
Mihai Doarna
82a5913dfa
SSO: Fix secrets migration for LDAP in SSO settings (#94252)
fix secrets migration for LDAP in SSO settings
2024-10-04 18:18:53 +03:00
Ieva
6eeef432de
RBAC: Add dash and folder action sets where they are missing (#92832)
* add dash and folder action sets where they are missing

* remove an empty line, try to make linting pass
2024-10-04 16:03:04 +01:00
Jo
544b5f905c
Anonymous: Fix anonymous cache ignoring device limit evaluation (#94218)
* ensure cache contains the evaluation result for device limit

* add device limit errors and warnings

* fix lint
2024-10-04 15:20:55 +02:00
Giuseppe Guerra
0db65d229e
Plugins: Add Subresource Integrity checks (#93024)
* Plugins: Pass hashes for SRI to frontend

* Add SRI hashes to frontendsettings DTOs

* Add docstring

* TestSriHashes

* Fix typo

* Changed SriHashes to ModuleHash

* update loader_test compareOpts

* update ModuleHash error message

* Add TestModuleHash/no_module.js

* Add omitEmpty to moduleHash

* Add ModuleHash to api/plugins/${pluginId}/settings

* moved ModuleHash field

* feat(plugins): add moduleHash to bootData and plugin types

* feat(plugins): if moduleHash is available apply it to systemjs importmap

* Calculate ModuleHash for CDN provisioned plugins

* Add ModuleHash tests for TestCalculate

* adjust test case name

* removed .envrc

* Fix signature verification failing for internal plugins

* fix tests

* Add pluginsFilesystemSriChecks feature togglemk

* renamed FilesystemSriChecksEnabled

* refactor(plugin_loader): prefer extending type declaration over ts-error

* added a couple more tests

* Removed unused features

* Removed unused argument from signature.DefaultCalculator call

* Removed unused argument from bootstrap.DefaultConstructFunc

* Moved ModuleHash to pluginassets service

* update docstring

* lint

* Removed cdn dependency from manifest.Signature

* add tests

* fix extra parameters in tests

* "fix" tests

* removed outdated test

* removed unused cdn dependency in signature.DefaultCalculator

* reduce diff

* Cache returned values

* Add support for deeply nested plugins (more than 1 hierarchy level)

* simplify cache usage

* refactor TestService_ModuleHash_Cache

* removed unused testdata

* re-generate feature toggles

* use version for module hash cache

* Renamed feature toggle to pluginsSriChecks and use it for both cdn and filesystem

* Removed app/types/system-integrity.d.ts

* re-generate feature toggles

* re-generate feature toggles

* feat(plugins): put systemjs integrity hash behind feature flag

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2024-10-04 14:55:09 +02:00
Diego Augusto Molina
7d32d5eff4
Unistore: Reuse MySQL and Postgres Grafana core config instead of the object (#94223)
* Reuse MySQL and Postgres Grafana config instead of the object

- Only reuse the Grafana DB object for SQLite. Support for SQLite will be added in a different PR
- Fail when reusing the Grafana DB object if it is using DB instrumentation
- In the case that we have to reuse a Grafana DB with its instrumentation, fail with an error that describes a workaround
- Add regression tests to reproduce incident 2144

* remove temp file

* fix linter

* fix linter x2

* fix linter x3
2024-10-04 12:07:20 +00:00
Mihai Doarna
a82f102878
Auth: Promote ssoSettingsLDAP flag to public preview (#94242)
* promote ssoSettingsLDAP flag to public preview

* add generated file
2024-10-04 14:59:42 +03:00
Aaron Godin
458fc69616
IAM: Add test for AddDataSource managed permissions (#94113)
Add test for AddDataSource managed permissions and fix control flow issues
2024-10-04 06:35:25 -05:00
Alexander Zobnin
5d724c2482
Zanzana: Initial dashboard search (#93093)
* Zanzana: Search in a background and compare results

* refactor

* Search with check

* instrument zanzana client

* add single_read option

* refactor

* refactor move check into separate function

* Fix tests

* refactor

* refactor getFindDashboardsFn

* add resource type to span attributes

* run ListObjects concurrently

* Use list and search in less cases

* adjust metrics buckets

* refactor: move Check and ListObjects to AccessControl implementation

* Revert "Fix tests"

This reverts commit b0c2f072a2.

* refactor: use own types for Check and ListObjects inside accesscontrol package

* Fix search scenario with low limit and empty query string

* more accurate search with checks

* revert

* fix linter

* Revert "revert"

This reverts commit ee5f14eea8.

* add search errors metric

* fix query performance under some conditions

* simplify check strategy

* fix pagination

* refactor findDashboardsZanzanaList

* Iterate over multiple pages while making check request

* refactor listUserResources

* avoid unnecessary db call

* remove unused zclient

* Add notes for SkipAccessControlFilter

* use more accurate check loop

* always use check for search with provided UIDs

* rename single_read to zanzana_only_evaluation

* refactor

* update go workspace

* fix linter

* don't use deprecated fields

* refactor

* fail if no org specified

* refactor

* initial integration tests

* Fix tests

* fix linter errors

* fix linter

* Fix tests

* review suggestions

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* fix limit

* refactor

* refactor tests

* fix db config in tests

* fix migrator (postgres)

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-10-04 12:27:10 +02:00
Arati R.
f403bc57d5
K8s/Folders: Clear permissions cache on create (#94214)
* Clear user permissions cache after folder creation
* Use k8s client only for create
2024-10-04 11:26:36 +02:00
Karl Persson
c7ca2bfcf5
ServiceAccounts: Remove permissions to service account when it is deleted (#93877)
* Service account: clean up permissions related to service accounts when deleted

* Add migration for deleting orphaned service account permissions

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-10-04 09:01:09 +02:00
Gabriel MABILLE
943525391e
AuthN: Managed plugin Service Accounts general availability (#93384)
External Service Accounts: General availability
2024-10-04 08:48:38 +02:00
Levente Balogh
6096f46774
Plugin Extensions: Require meta-data to be defined in plugin.json during development mode (#93429)
* feat: add extensions to the backend plugin model

* feat: update the frontend plugin types

* feat(pluginContext): return a `null` if there is no context found

This will be necessary to understand if a certain hook is running inside a plugin context or not.

* feat: add utility functions for checking extension configs

* tests: fix failing tests due to the type updates

* feat(AddedComponentsRegistry): validate plugin meta-info

* feat(AddedLinksRegistry): validate  meta-info

* feat(ExposedComponentsRegistry): validate meta-info

* feat(usePluginComponent): add meta-info validation

* feat(usePluginComponents): add meta-info validation

* feat(usePluginLinks): add meta-info validation

* fix: only validate meta-info in registries if dev mode is enabled

* tests: add unit tests for the restrictions functionality

* tests: fix Go tests

* fix(tests): revert accidental changes

* fix: run goimports

* fix: api tests

* add nested app so that meta data can bested e2e tested

* refactor(types): extract the ExtensionInfo into a separate type

* refactor(extensions/utils): use Array.prototype.some() instead of .find()

* refactor(usePluginLinks): update warning message

* feat(usePluginExtensions()): validate plugin meta-info

* Wip

* fix(e2e): E2E tests for extensions

* fix(extensions): allow multiple "/" slashes in the extension point id

* fix(extensions/validators): stop validating the plugin id pattern

---------

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
2024-10-04 08:41:26 +02:00
Nathan Marrs
7188c13d22
ElasticSearch: Add keywords to plugin.json (#94174)
* add keywords

* add additional keywords
2024-10-04 01:52:19 +03:00
Todd Treece
a4d919c157
Chore: Update k8s.io dependencies to v0.31.1 (#93696) 2024-10-03 15:50:15 -04:00
Stephanie Hingtgen
4623a6471b
SQLStore: Fix parseTime check (#94175) 2024-10-03 08:58:33 -05:00
Misi
ee8bb63d2d
Auth: Replace jmespath/go-jmespath with jmespath-community/go-jmespath (#94203)
Replace jmespath/go-jmespath with jmespath-community/go-jmespath
2024-10-03 15:43:15 +02:00
Laura Benz
f92ef0e126
RestoreDashboards: Add link to dashboards browse view (#94000)
* feat: add button

* refactor: clean up

* feat: add tracking

* refactor: change button copy

* refactor: add payload to tracking

* refactor: add subURL

* refactor: user permissions

* refactor: group conditions

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

---------

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2024-10-03 15:13:29 +02:00
Joao Silva
c04027919b
Bookmarks: Turn feature toggle on by default (#94194) 2024-10-03 13:45:31 +03:00
Arati R.
a42caa7a61
K8s/Folders: Fix tests for creating folders (#94192)
* Add feature toggle grafanaAPIServerTestingWithExperimentalAPIs
* Customise registration of FolderAPIBuilder for tests and fix tests
2024-10-03 12:11:40 +02:00
Matheus Macabu
1635a3cd67
CloudMigrations: Add support for migration of Library Elements (Panels) resources (#93898)
* CloudMigrations: create snapshots of Library Elements

* CloudMigrations: render library element resource in resources table

* CloudMigrations: create newtype with necessary fields for library element creation
2024-10-03 11:54:54 +02:00
Alexander Zobnin
bd1741653d
Annotations: Fix composite store read (#94158)
* Annotations: Fix composite store read

* Add test

* check error
2024-10-03 09:14:06 +02:00
Andres Martinez Gotor
4c4f7a3331
Chore: Restore permissions used to create plugins dir (#94139) 2024-10-03 09:09:54 +02:00
Marcus Efraimsson
e22b510cd8
API Server: Fix extracting jaeger remote trace from incoming request (#93998) 2024-10-02 17:07:31 +02:00
Karl Persson
d75a9b6aeb
User: Pass name to list users to filter out the correct one (#94153)
Pass name to list users to filter out the correct one
2024-10-02 17:02:32 +02:00
Kyle Brandt
a1556fded2
Prometheus: Suggestions - log parse errors and continue (#94143)
* Prometheus: Suggestions - log parse errors and continue
2024-10-02 13:29:45 +01:00
Diego Augusto Molina
658c79e1d5
Chore: fix initialization data race in infra usagestats (#94070)
fix initialization data race in usagestats
2024-10-02 07:30:44 -03:00