Commit Graph

3266 Commits

Author SHA1 Message Date
Karl Persson
144e4887ee
Auth: Use authn.Service for all tests (#72921)
* Dashboards: Fix tests when authn broker is enabled.
StarService was not configured for tests, the call was guarded by !c.IsSignedIn

* Change default to be anon user to match expectations from tests

* OAuth: rewrite tests to work with authn.Service

* Setup template renderer by default

* Extract cookie options from cfg instead of relying on global variables

* Fix test to work with authn service

* Middleware: rewrite auth tests

* Remvoe session cookie if we cannot refresh access token
2023-08-09 08:54:52 +02:00
Maksym Revutskyi
d9c232b331
Auth: prevent auto_login redirect if user is already authenticated (#72477)
* Auth: prevent auto_login redirect if user is already authenticated

Before attempting an auto-login for OAuth, verifies if current context has already been
authenticated.

Fixes: #72476

Co-authored-by: Karl Persson <kalle.persson92@gmail.com>
2023-08-07 09:14:31 +02:00
Will Browne
98f827537b
Plugins: Add remaining steps to inititialization stage (#72894)
add remainder of init steps
2023-08-04 12:35:57 +02:00
Will Browne
60b4a0b2a4
Plugins: Add termination stage to plugin loader pipeline (#72822)
* add termination stage

* uid -> pluginID (for now)

* also fix fakes

* add simple test

* Fix logger name

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

* inline stop func call

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

---------

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2023-08-04 11:57:49 +02:00
Josh Hunt
7bc6d32eb9
Search API: Search by folder UID (#65040)
* Search: Attempt to support folderUID filter

* Search: Use folder UID instead of ID for searching folders

* Update swagger

* Fix JSON property casing

* Add integration test

* Remove redundant query condition

* Fix frontend test

* Fix listing dashboards in General/root

* Add support for fetching top level folders

using `folderUIDs=` (empty string) query parameter

* Add deprecation notice

* Send uid of general in sql.ts

* Use 'general' for query folderUIDs query param for fetching folder

* Add tests

* Fix FolderUIDFilter

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-08-04 12:43:47 +03:00
Ibrahim
0d48ac2419
Feat: Feature toggle admin page frontend interface (#72164)
* feature toggles admin page proto

* feature toggle admin page proto

* keep phase 1 code only

* latest update with api

* fix

* fix

* add correct premissions in admin.go

* move behind toggle

* Use InteractiveTable

* guard behind feature toggle

* use RTK

* route in api.go

* fixes
2023-08-03 14:17:00 -04:00
Todd Treece
f3ffc850aa
Chore: Revert dskit service additions (#72608) 2023-08-03 09:19:01 -04:00
Will Browne
ad2705fa0b
Plugins: Add inititialization stage to plugin loader pipeline (#72667)
* first pass

* migrate tests

* simplify

* fix comments

* fix linter

* nil checks

* remove comment
2023-08-02 16:29:12 +00:00
Sofia Papagiannaki
2c26a02b82
Search v1: Remove unnecessary subqueries (#72388)
* Add feature flag

* Introduce interface and dummy implementation

* Add tests for the new filter

* accessControlDashboardPermissionFilterNoFolderSubquery implementation

* join only if it's necessary

* force ordering for tests

* Temporarily enable new query for benchmarks
2023-08-02 10:39:25 +03:00
Ieva
d3b481dac8
Auth: Lock down Grafana admin role updates if the role is externally synced (#72677)
* lock down server admin role updates on the frontend if the user is externally synced

* add tests

* lock Grafana Server admin role updates from the backend

* rename variables

* check that the user has auth info

* add LDAP to providers for which Grafana Server admin role can be synced

* linting
2023-08-01 16:39:08 +01:00
Ieva
1fa4f4bc57
Chore: remove DisableSyncLock setting, as it's not used anymore (#72680)
* rmeove DisableSyncLock setting, as it's not used anymore

* remove unused import
2023-08-01 17:38:07 +03:00
Jo
7d347cd428
Auth: remove org count from signedInUser (#72661)
* tweaks

* remove org count from signedinUser

* remove org count from signedinUser store

* fix broken tests

* restore frontend interface
2023-08-01 14:04:37 +02:00
Kristian Bremberg
9b4dde7430
Modify Content-Security-Policy for Swagger UI (#63568)
* Modify Content-Security-Policy for Swagger UI

* check if CSP is empty

Co-authored-by: João Calisto <joao.calisto@grafana.com>

* check if CSP is empty in swagger.go

---------

Co-authored-by: João Calisto <joao.calisto@grafana.com>
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-08-01 11:27:44 +03:00
Gabriel MABILLE
4c7b97cdb0
ClientTokenRotation: Don't rotate session cookie for authproxy (#72496)
* ClientTokenRotation: Don't rotate session cookie for authproxy

* Account for config option auth.proxy enable_login_token

* Limit amount of changes on devenv

* Fix tests by moving authenticatedBy up

* Uncomment nginx conf
2023-07-28 15:32:58 +02:00
Will Browne
ec6412bcca
Plugins: Use plugins config to source app URL (#72490)
* use plugins config for app URL

* merge with main

* add missing file

* add fg

* fix tests
2023-07-28 15:18:25 +02:00
Will Browne
758d9884bc
Plugins: Plugins loader pipeline (#71438)
* discovery

* flesh out

* add docs

* remove unused func

* bootstrap stage

* fix docs

* update docs

* undo unnecessary changes

* add end tag

* update doc

* fix linter

* fix

* tidy

* update docs

* add class to filter func

* apply PR feedback

* fix test
2023-07-27 15:29:13 +02:00
Sofia Papagiannaki
1f742fcf93
Guardian: Split dashboard and folder guardian implementation (#69722)
* Split dashboard and folder guardian implementations

* Replace guardian constructors

* Simplify tests

* Add tests

* Apply suggestion from code review

Differentiate errors for dashboard and folders

* Remove tests for general folder

* Add tests for general scope
2023-07-25 15:31:12 +03:00
Ieva
f7c6491f73
Auth: add a feature toggle for locking user roles for users synced through GCom (#72202)
* add a new feature toggle for locking down role sync for users managed by GCom

* protect the frontend and the backend using the new feature toggle

* fix merge
2023-07-25 13:27:02 +01:00
Arati R
20ffbbc41e
NestedFolders: Add library panels counting and deletion to folder registry (#69149)
* Expose library element service's folder service
* Register library panels, add count implementation
* Expand folder counts test
* Update registry deletion method interface
* Allow getting library elements from any folder
* Add test for library panel deletion
* Add test for library panel counting
2023-07-25 13:05:53 +02:00
Ieva
e9ba6922c0
Auth: Lock organization roles for users who are managed through an external auth provider (#72204)
remove onlyExternalOrgRoleSync feature flag
2023-07-25 10:51:47 +01:00
João Calisto
4ba83173ea
Feature toggles management: Define get feature toggles api (#72106)
* Feature Toggle Management: Define get feature toggles api

* lint
2023-07-24 16:12:59 -04:00
Ieva
cfa1a2c55f
RBAC: Split non-empty scopes into kind, attribute and identifier fields for better search performance (#71933)
* add a feature toggle

* add the fields for attribute, kind and identifier to permission

Co-authored-by: Kalle Persson <kalle.persson@grafana.com>

* set the new fields when new permissions are stored

* add migrations

Co-authored-by: Kalle Persson <kalle.persson@grafana.com>

* remove comments

* Update pkg/services/accesscontrol/migrator/migrator.go

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

* feedback: put column migrations behind the feature toggle, added an index, changed how wildcard scopes are split

* PR feedback: add a comment and revert an accidentally changed file

* PR feedback: handle the case with : in resource identifier

* switch from checking feature toggle through cfg to checking it through featuremgmt

* don't put the column migrations behind a feature toggle after all - this breaks permission queries from db

---------

Co-authored-by: Kalle Persson <kalle.persson@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2023-07-21 15:23:01 +01:00
Charandas
614f1af190
Tempo: remove deprecated model package usage (remove replace) (#71687)
* Tempo: remove deprecated model package usage (remove replace)

* fix root test
2023-07-18 19:30:29 +03:00
Kristin Laemmert
d183a241e9
chore: wrap HTTP server in a dskit module (#71601)
* chore: wrap HTTP server in a dskit module

Much of the logic from this comes from the POC branch, so:
- credit for this work goes to everyone else
- mistakes are my own
This is needed to support microservice deployment modes.
* added an arbitrarily-chosen 30second timeout
2023-07-18 10:37:53 -04:00
Jo
4b2ddaed44
AC: Remove legacy AC from folders permissions API (#71526)
* Remove legacy AC from folder permissions API

* Update pkg/api/folder_permission.go

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-07-17 19:21:01 +03:00
Jo
a7d905c03b
AC: Remove legacy AC from dashboard permissions API (#71524)
* remove IsDisabled from org API

* remove IsDisabled from dashboard_permissions API
2023-07-17 17:54:39 +02:00
Jo
914e0bf87e
Auth: Surface organization membership error (#71750)
surface organization membership error
2023-07-17 16:35:59 +02:00
Kousik Mitra
60496fbae3
Chore: Return correct error for name taken and validation error on add/update datasource (#70465) 2023-07-17 16:27:19 +02:00
Will Browne
b59ca7fb22
Plugins: Only configure plugin proxy transport once (#71735)
only configure plugin proxy transport once
2023-07-17 13:37:03 +02:00
Will Browne
a8577c21ba
Plugins: Migrate PluginStore mock to pre-existing fakes package (#71664)
* migrate to existing fakes package

* fix imports
2023-07-17 10:21:44 +00:00
Todd Treece
52121b7165
Chore: Add grafana-apiserver (#70721)
* add grafana-apiserver
* remove watchset & move provisioning and http server to background
services
* remove scheme
* otel fixes (#70874)
* remove module ProvideRegistry test
* use certgenerator from apiserver package
* Control collector/pdata from going to v1.0.0-rc8 (as Tempo 1.5.1 would have it)
2023-07-14 12:22:10 -07:00
Will Browne
162dde5bdd
Plugins: Use suffix for plugin directory (#71375)
* plugin dir suffix

* fix whitespace

* fix cli

* fix tests

* fixup

* simplify

* undo uninstall changes
2023-07-14 11:49:05 +02:00
Sofia Papagiannaki
32ff712e98
Swagger: Fix response for the search users endpoint (#71272)
* Regenerate OpenAPI specs for fetching the latest changes

* Fix swagger annotations for search users API
2023-07-13 11:35:03 +03:00
Andres Martinez Gotor
9990d5025d
Chore: Embed CSV files with the test data source (#71435) 2023-07-13 09:34:40 +02:00
Jo
9b22342b91
Auth: Move LDAP debug to Authentication menu (#71285)
* move LDAP page to Authentication

* tweak Auth menu showing permissions
2023-07-12 18:15:02 +02:00
Jo
e56b2cae00
MESA: Allow using synced permissions (#71377)
* wip

* cover authorize in org behavior

* revert export

* fix org tests

* change permissions nit
2023-07-12 13:28:04 +03:00
Will Browne
1274979f3f
Plugins: Remove unused config field from SignatureCalculator (#71297)
remove unused cfg field
2023-07-11 08:52:02 +02:00
Ieva
a65cb4d808
RBAC: remove simple RBAC disabled checks (#71137)
* remove simple RBAC disabled checks

* fixing tests

* remove old AC tests
2023-07-10 15:14:21 +03:00
Sofia Papagiannaki
e82d437e0e
Drone: Enable running go benchmarks on demand (#70359)
* Add benchmark

* Run pkg/api benchmarks in CI

* Conditionally run benchmarks for provided go packages

* Bypass fork check for promotes
2023-07-07 11:55:01 +03:00
Alex Khomenko
420b19e0e4
Dashboards: Add dashboard embed route (#69596)
* Dashboard embed: Set up route

* Dashboard embed: Cleanup

* Dashboard embed: Separate routes

* Dashboard embed: Render dashboard page

* Dashboard embed: Add toolbar

* Dashboard embed: Send JSON on save

* Dashboard embed: Add JSON param

* Dashboard embed: Make the dashboard editable

* Fix sending dashboard to remote server

* Add notifications

* Add "dashboardEmbed" feature toggle

* Use the toggle

* Update toggles

* Add toggle on backend

* Add get JSON endpoint

* Add drawer

* Close drawer on success

* Update toggles

* Cleanup

* Update toggle

* Allow embedding for the d-embed url

* Allow embedding via custom X-Allow-Embedding header

* Use callbackUrl

* Cleanup

* Update public/app/features/dashboard/containers/EmbeddedDashboardPage.tsx

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>

* Use theme for spacing

* Update toggles

* Update public/app/features/dashboard/components/EmbeddedDashboard/SaveDashboardForm.tsx

Co-authored-by: Polina Boneva <13227501+polibb@users.noreply.github.com>

* Add select data source modal

---------

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>
Co-authored-by: Polina Boneva <13227501+polibb@users.noreply.github.com>
2023-07-06 17:43:20 +03:00
Esteban Beltran
d618bc46d1
Plugins: Add config option to exclude specific plugins from frontend sandbox (#70899) 2023-07-05 11:16:56 +02:00
Andres Martinez Gotor
4ff0abd0d1
SaveExternalService (OAuth) on plugin load (#69764) 2023-06-26 16:38:43 +02:00
Giuseppe Guerra
cca9d89733
Plugins: Angular detector: Remote patterns fetching (#69843)
* Plugins: Angular detector: Remote patterns fetching

* Renamed PatternType to GCOMPatternType

* Renamed files

* Renamed more files

* Moved files again

* Add type checks, unexport GCOM structs

* Cache failures, update log messages, fix GCOM URL

* Fail silently for unknown pattern types, update docstrings

* Fix tests

* Rename gcomPattern.Value to gcomPattern.Pattern

* Refactoring

* Add FlagPluginsRemoteAngularDetectionPatterns feature flag

* Fix tests

* Re-generate feature flags

* Add TestProvideInspector, renamed TestDefaultStaticDetectorsInspector

* Add TestProvideInspector

* Add TestContainsBytesDetector and TestRegexDetector

* Renamed getter to provider

* More tests

* TestStaticDetectorsProvider, TestSequenceDetectorsProvider

* GCOM tests

* Lint

* Made detector.detect unexported, updated docstrings

* Allow changing grafana.com URL

* Fix API path, add more logs

* Update tryUpdateRemoteDetectors docstring

* Use angulardetector http client

* Return false, nil if module.js does not exist

* Chore: Split angualrdetector into angularinspector and angulardetector packages

Moved files around, changed references and fixed tests:
- Split the old angulardetector package into angular/angulardetector and angular/angularinspector
- angulardetector provides the detection structs/interfaces (Detector, DetectorsProvider...)
- angularinspector provides the actual angular detection service used directly in pluginsintegration
- Exported most of the stuff that was private and now put into angulardetector, as it is not required by angularinspector

* Renamed detector.go -> angulardetector.go and inspector.go -> angularinspector.go

Forgot to rename those two files to match the package's names

* Renamed angularinspector.ProvideInspector to angularinspector.ProvideService

* Renamed "harcoded" to "static" and "remote" to "dynamic"

from PR review, matches the same naming schema used for signing keys fetching

* Fix merge conflict on updated angular patterns

* Removed GCOM cache

* Renamed Detect to DetectAngular and Detector to AngularDetector

* Fix call to NewGCOMDetectorsProvider in newDynamicInspector

* Removed unused test function newError500GCOMScenario

* Added angularinspector service definition in pluginsintegration

* Moved dynamic inspector into pluginsintegration

* Move gcom angulardetectorsprovider into pluginsintegration

* Log errUnknownPatternType at debug level

* re-generate feature flags

* fix error log
2023-06-26 15:33:21 +02:00
Jo
4821175d40
Auth: Add auth.azure_ad security improvements (#912)
* security improvements id_token

* add audience validation

* add allowOrganizations

* add allowOrganizations tests and documentation

* add log warn on no configuration

* anonymize tenant id

* Apply suggestions from code review

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-security/configure-authentication/azuread/index.md

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Update pkg/login/social/azuread_oauth_test.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Update pkg/login/social/azuread_oauth_test.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* optimize key validation and add mising fields

* fix missing key_id

* lint

* Update docs/sources/setup-grafana/configure-security/configure-authentication/azuread/index.md

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>

* lint docs

---------

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-06-23 09:13:38 +02:00
Jo
b8a336c9d7
Auth: Remove Email Lookup from oauth integrations (#894)
Remove email lookup from oauth integrations

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
2023-06-23 09:08:02 +02:00
Andreas Deininger
95b1f3c875
Fixing typos (#70487) 2023-06-22 09:43:38 +01:00
Michael Mandrus
66d2214c3b
Config: Add configuration option to define custom user-facing general error message for certain error types (#70023)
---------

Co-authored-by: Summer Wollin <summer.wollin@grafana.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
2023-06-16 10:46:47 -05:00
Alexander Zobnin
6c7d5bf95f
Authn UI: Remove feature toggle (#70073)
* Authn UI: Remove feature toggle

* remove feature flag usage
2023-06-14 19:58:15 +03:00
Jo
914daef0fd
Auth: Add request context to UserInfo calls (#70007)
* use context for UserInfo requests

* set timeouts for oauth http client

* Update pkg/login/social/common.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-06-14 14:30:40 +02:00
Will Browne
91b0cdc871
Plugins: Account for nil user when constructing plugin context (#69811)
cater for nil user
2023-06-08 19:36:41 +03:00