Commit graph

135 commits

Author SHA1 Message Date
Mikhail Shustov
8d654bfbb0
Make SameSite cookie's attribute configurable (#68108) (#68989)
* support 'SameSite: None' in http service

* add tests

* allow to configure SameSite attribute for security cookie

* update docs

* fix test suite name

* remove false from samesite options

* document xpack.security.sameSiteCookies

* address comments

* address comments

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
# Conflicts:
#	x-pack/plugins/security/server/config.ts
2020-06-12 12:18:22 +02:00
Josh Dover
4a2a616dd7
Fix running Kibana Platform migrations in development (#61325) (#61360) 2020-03-25 17:37:33 -06:00
Pierre Gayvallet
6bc866a9b1
introduce StartServicesAccessor type for CoreSetup.getStartServices (#60748) (#61070)
* create StartServicesAccessor type

* update generated doc

* update usages to use new type

* add missing public annotation
2020-03-24 16:30:16 +01:00
Rudolf Meijering
aca82ec668
Re-backport and re-generate typescript docs (#60507) 2020-03-18 23:14:23 +01:00
Mikhail Shustov
80b58a589d
Add UiSettings validation & Kibana default route redirection (#59694) (#60257)
* add schema to ui settings params

* add validation for defaults and overrides

* validate in ui settings client

* ui settings routes validation

* clean up tests

* use schema for defaultRoutes

* move URL redirection to NP

* fix spaces test

* update docs

* update kbn pm

* fix karma test

* fix tests

* address comments

* get rid of getDEfaultRoute

* regen docs

* fix tests

* fix enter-spaces test

* validate on relative url format

* update i18n

* fix enter-spoace test

* move relative url validation to utils

* add CoreApp containing application logic

* extract public uiSettings params in a separate type

* make schema required

* update docs
2020-03-16 18:09:51 +01:00
Rudolf Meijering
66d5b223b5
Expose Elasticsearch from start and deprecate from setup (#59886) (#60163)
* Expose Elasticsearch from start and deprecate from setup

* Expose client under legacy namespace, add deprecated note

* Update migration guide

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-16 12:33:37 +01:00
Rudolf Meijering
d0ab21145c
Make context.core required argument to context providers (#59996) (#60061)
* Make context.core required argument to context providers

* Refactor plugins: context.core isn't optional anymore

* Update docs
2020-03-12 22:44:00 +01:00
Pierre Gayvallet
4a08acbb4a
Add SavedObject management section registration in core (#59291) (#59731)
* add management section to SavedObjectsType

* adapt import/export routes to get types accessor

* add documentation

* update generated doc

* update migration guide

* use request context to access exportable types

* update generated doc

* adapt SavedObjectsManagement to use the registry

* stop magical tricks about the config type, register it as any other so type.

* fix FTR assertions

* fix so_mixin tests

* register the `config` type from the uiSettings service

* nits and comments

* update generated doc

* remove true from dynamic property definition, use force-cast back for config type

* remove obsolete test comment
2020-03-10 12:57:34 +01:00
Mikhail Shustov
1582299967
Add an optional authentication mode for HTTP resources (#58589) (#59614)
* add authRequred: 'optional'

* expose auth status via request context

* update security plugin to use notHandled auth outcome

* capabilities service uses optional auth

* update tests

* attach security headers only to unauthorised response

* add isAuthenticated tests for 'optional' auth mode

* security plugin relies on http.auth.isAuthenticated to calc capabilities

* generate docs

* reword test suit names

* update tests

* update test checking isAuth on optional auth path

* address Oleg comments

* add test for auth: try

* fix

* pass isAuthenticted as boolean via context

* remove response header from notHandled

* update docs

* add redirected for auth interceptor

* security plugin uses t.redirected to be compat with auth: optional

* update docs

* require location header in the interface

* address comments #1

* declare isAuthenticated on KibanaRequest

* remove auth.isAuthenticated from scope

* update docs

* remove unnecessary comment

* do not fail on FakrRequest

* small improvements
2020-03-07 20:15:48 +01:00
Pierre Gayvallet
f6beb1e838
Expose metrics service to public API (#59294) (#59355)
* expose metrics service to public API

* update generated doc
2020-03-04 23:17:45 +01:00
Pierre Gayvallet
e1b8938f1f
Expose savedObject import / export utility methods (#58882) (#59295)
* add getImportExportObjectLimit to so setup

* expose static method for so import / export

* improve functions naming

* fix mocked reference
2020-03-04 14:50:25 +01:00
Mikhail Shustov
0fdb6e520a
Allow disabling xsrf protection per an endpoint (#58717) (#59151)
* add xsrfRequired flag to a route definition interface

* update tests

* deprecate server.xsrf.whitelist

It meant to be used for IdP endpoints only, which we are going to refactor to disable xsrf requirement per a specific endpoint.

* update docs

* do not fail on manual KibanaRequest creation

* address comments

* update tests

* address comments

* make xsrfRequired available only for destructive methods

* update docs

* another isSafeMethod usage
2020-03-03 17:47:12 +01:00
Pierre Gayvallet
321952f998
Add core metrics service (#58623) (#59122)
* create base service and collectors

* wire the service into server, add mock

* add collector tests

* add main collector test

* export metric types from server

* add service and server tests

* updates generated doc

* improve doc

* nits and comments

* add disconnected requests test
2020-03-03 14:52:16 +01:00
Pierre Gayvallet
30fca567f6
add dynamic property to type definition (#58852) (#58886) 2020-02-28 18:36:25 +01:00
Pierre Gayvallet
85fd92aa5c
block SO setup API calls after startup (#58718) (#58844) 2020-02-28 16:22:09 +01:00
Pierre Gayvallet
b4009fcfd2
Allow savedObjects types registration from NP (#57430) (#58602)
* expose `registerType` API

* expose `getTypeRegistry` API

* change SavedObjectMigrationFn signature to add context

* fix exported types

* update generated doc

* update migration documentation

* fix legacy service test

* fix typings

* update service setup description

* add saved_objects server folder convention

* fix unit test

* documentation NITs

* add typeRegistry to SavedObjectClientWrapperOptions
2020-02-26 18:17:51 +01:00
Mikhail Shustov
fc6674ad1e
force savedObject API consumers to define SO type explicitly (#58022) (#58281)
* force savedObject consumers to define type explicitly

* address comments

* regen docs
2020-02-22 07:36:20 +01:00
Mikhail Shustov
9b6b1402c2
Expose elasticsearch config schema (#57655) (#58199)
* expose elasticsearch config schema

* update docs

* mark export as alpha since it can be deleted

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-21 11:30:20 +01:00
Pierre Gayvallet
181862c191
Restructure SavedObject types internal representation (#56378) (#56953)
* adapt types and tests to prepare for new NP api

* rename and export public types

* update generated doc

* first implementation of registerMappings

* adapt es archiver to convert legacy mappings

* update generated doc

* fix more tests

* add unit tests

* add legacy-compat unit test

* add documentation and examples

* Introduce SavedObjectTypeRegistry and SavedObjectType types

* add and fix tests

* expose createSerializer API and fix usages

* remove registerMappings API, add internal registerType

* revert changes to migration guide

* adapt ES-archiver migrator creation

* export serializer-related types

* update generated doc

* add and use convertTypesToLegacySchema

* remove / move to internal some mapping types

* fix forEach closure context

* add missing docs

* fix core path

* some nits

* fix so_mixin tests

* fix integration tests

* fix integration tests for real

* add documentation on serializer + restructure files and types

* nit

* add and use the ISavedObjectTypeRegistry interface

* Add documentation, deprecates migrationLogger#warning

* better typing for SavedObjectsRawDoc._source

* nits

* update generated doc

* remove exposition of SavedObjectsTypeMappingDefinitions, update doc

* creates so internal contracts mocks

* improve documentation
2020-02-06 12:10:31 +01:00
Nick Partridge
af577cc79c
Kibana property config migrations (#55937) (#56720)
* Move defaultAppId config param into kibanaLegacy
* Move disableWelcomeScreen config param into Home plugin
* Update api and docs with silent option for renameFromRoot
2020-02-04 08:04:04 -06:00
Pierre Gayvallet
e5a0477542
Add getServerInfo API to http setup contract (#56636) (#56721)
* add getServerInfo http setup api

* update generated doc
2020-02-04 09:27:14 +01:00
Josh Dover
5bbf2cfc59
Add isSystemRequest support to Kibana Platform (#53734) (#55927) 2020-01-28 07:33:11 -07:00
Mikhail Shustov
7a53f8bd29
Normalize EOL symbol in platform docs (#56021) (#56041)
* use api-extractor generate command with api-documenter config

* update docs

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-27 21:04:26 +01:00
Mikhail Shustov
e1bf90916a
[NP] Platform exposes API to get authenticated user data (#55327) (#55998)
* expose auth.get/isAuthenticated. move getAuthHeaders to internal type

* update mocks

* update docs

* update docs

* add integration test for auth
2020-01-27 15:19:31 +01:00
spalger
2ffbbcb1e8 Revert "[7.x] [csp] allow blob styles when running from source (#54991) (#55597)"
This reverts commit d198bb521b.
2020-01-23 23:33:02 -07:00
Matthew Kime
ced9f76723
Advanced Settings management => typescript (#54477) (#55716)
* advanced settings => typescript
2020-01-23 12:05:17 -06:00
Pierre Gayvallet
76ae43f407
Run SO migration after plugins setup phase. (#55012) (#55664)
* change setClientFactory api to setClientFactoryProvider

* cleanup and add test for service

* change the signatures of SO start/setup

* fix registerCoreContext by accessing stored start contract reference

* move migration inside `start`

* adapt and add service tests

* add doc and export new types

* adapt plugins code

* update generated doc

* better core access

* address some review comments

* remove parametrized type from SavedObjectsClientFactory, use KibanaRequest instead

* add logs when starting and ending so migration

* fix KibanaRequest imports

* NITs and review comments

* fix alerting FTR test

* review comments
2020-01-23 12:36:51 +01:00
Spencer
d198bb521b
[7.x] [csp] allow blob styles when running from source (#54991) (#55597)
* [csp] allow blob styles when running from source

* update kbn/pm dist

* add kibanaServer service to saml_api_integration suite

* use common naming

* attempt to use env.packageInfo instead of IS_KIBANA_DISTRIBUTABLE const

* remove mock, clone rules before modifying

* pass env where necessary

* update core api docs

* make env optional in HttpConfig

* add tests for CspConfig changes, base header on this.rules

* fix test snapshot

* make env optional in HttpConfig too

* remove CspConfig.DEFAULT and make env a required constructor arg

* update csp_usage_collector tests

* update core api docs

* fix test name

* rename headerChangedFromDefault back to rulesChangedFromDefault

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-22 17:20:52 -07:00
Mikhail Shustov
bd8e4a5c70
[NP] KibanaRequest provides request abortion event (#55061) (#55538)
* add aborted$ observable to KibanaRequest

* complete observable on request end

* update docs

* update test suit names

* always finish subscription

* address comments
2020-01-22 14:55:50 +01:00
Pierre Gayvallet
8fba124795
Implements getStartServices on server-side (#55156) (#55290)
* implements server-side getStartServices

* add unit test

* add integration test

* update generated doc

* improve test
2020-01-20 13:13:56 +01:00
Mikhail Shustov
666eda060b
Enforce camelCase format for a plugin id (#53759) (#55270)
* add isCamelCase  function

* add a warning if id is not in camelCase

* document pluginId expected in camelCase

* regen docs

* add a test for logging

* update tests. warn can be called several times for different reasons

* pluginPath falls back to plugin id in snake_case

* update tests

* update docs

* add example with id & configPath different formats

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-18 15:44:32 +01:00
Liza Katz
87822871c6
export new ui settings types and regen docs (#55020) (#55072)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-16 23:22:17 +02:00
Eli Perelman
dc1b1f504e
Generate legacy vars when rendering all applications (#54768) (#55079)
* Generate legacy vars when rendering all applications

* Move rendering functional tests and add user settings tests

* Make rendering integration tests more robust, get data from page

* Address review nits, fix CI failures

* Remove extraneous file

* Fix type error
2020-01-16 13:00:20 -06:00
Liza Katz
1ccd5705b1
Support "Deprecated" label in advanced settings (#54539) (#54660)
* Support deprecating label in advanced settings
mark courier:batchSearches as deprecated

* jest update

* Add deprecation to UiSettingsParams type
Translate click aria label
Use docLinks service

* Rename doc link

* Remove url option from DeprecationSettings

* Simplify code

* Updated docs

* Revert "Updated docs"

This reverts commit c9512ced1f.

* snapshots

* docs
2020-01-14 01:14:03 +02:00
Matthew Kime
6ca9018cf6
uiSettings - use validation field for image field maxSize (#54522) (#54641)
* uiSettings - use validation field for image field maxSize
2020-01-13 15:48:38 -06:00
Mikhail Shustov
de4c38c0dc
tighten SO repository type (#54328) (#54425)
* tighten SO repository type

* update docs

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-10 12:49:34 +03:00
Joe Portner
74ebdf9b11
Add support for certificates in PKCS#12 (P12) key stores (#53810) (#54383)
Kibana now supports the usage of PKCS#12 (P12) key stores and trust stores for certificates and keys.
2020-01-09 14:47:16 -05:00
Mikhail Shustov
5aad2f6a8f
Don't expose Elasticsearch client as Observable (#53824) (#54228)
* expose ES clients without observables

* expose observable-less api to plugins

* update core api and mocks

* update plugins

* NP SO & legacy use updated API

* update SO tests

* update TSDocs

* update types

* update docs

* document createCluster analog in np

* typo
2020-01-08 13:26:02 +03:00
Mikhail Shustov
d7789f20d9
[7.x] Set consistent EOL symbol in core API docs (#53815) (#53977)
* Set consistent EOL symbol in core API docs

* update yarn lock

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-01-06 14:53:47 +03:00
Eli Perelman
d7e6c84df3
Add server rendering service to enable standalone route rendering (#52161) (#53832)
* Add server rendering service to enable standalone route rendering

* Update renovate config

* Move legacy rendering functionality to legacy service

* Use config for exposed variable in new platform

* Lint changes from rebase

* Rebase artifact

* Remove RenderingProvider, add tests for legacy vars implementation, review notes

* Add UI app functionality to legacy service

* Update rendering snapshots

* Update docs

* Fix up functional tests

* Clean up legacy types

* Revise types from reverting injected metadata changes

* Update translations and broken tests

* Mock legacy internals in legacy tests

* Add missing doc types

* Rename InternalRenderOptions to LegacyRenderOptions

* Remove extraneous legacy exports, review nits

* Functional tests fixes

* Rebase, attempt CI test fixes

* Only allow specified appIds in testbed rendering integration test

* Update snapshot names

* Review nits
2019-12-29 15:09:08 -06:00
Matthias Wilhelm
4b2a4196f3
Remove SavedObjectRegistryProvider from codebase (#53455) (#53745) 2019-12-21 13:29:02 +01:00
Alejandro Fernández Haro
f3f1bd2ec6
[NP] Allow custom validations in HTTP Routes apart from @kbn/config-schema (#51919) (#53714)
* [NP] Allow custom validations in HTTP Routes apart from @kbn/config-schema

* API docs

* Allow validate function in the route handler (run-code validation)

* Prefix RouteXXX + Params and Body Validation Aliases

* Fix test broken by lodash

* Update API docs

* Add default types for simpler manual declaration

* Add run-time validation of the RouteValidateSpec

* Expose RouteValidationError instead of SchemaTypeError

* RouteValidator as a class to match config-schema interface

* Test for not-inline handler (need to check IRouter for #47047)

* Add preValidation of the input for a safer custom validation

* Better types for RouteHandlers

* [NP] Move route validation to RouteValidator wrapper

* Use the class only internally but maintain the same API

* Fix types

* Ensure RouteValidator instance in KibanaRequest.from

* Fix validator.tests (Buffer.from instead of new Buffer)

* Default precheck should allow null values

* Also allow undefined in preChecks

* MR feedback fixes

* Provide RouteValidationResolver to the validation function

* Add functional tests

* Fix new functional tests

* Fix validator additional test

* Fix test with new resolver

* Remove unused import

* Rename ValidationResolver to ValidationResultFactory and change the interface to look more like the KibanaResponseFactory

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2019-12-21 00:02:35 +00:00
Joe Reuter
66222f088c
Migrate kql telemetry and scripts api (#52651) (#53717) 2019-12-20 22:27:04 +01:00
Alexey Antonov
d20a6bc912
Cleanup - Typescript some of src/legacy/server/index_patterns (#53461) (#53593)
Part of #44190.
2019-12-19 21:40:55 +03:00
Pierre Gayvallet
d55c4c7bff
expose asScopedToClient in uiSettingsService start contract (#53290) (#53594)
* expose asScopedToClient in uisettings start contract

* add uiService mock in server tests

* Add tests for start method

* Updates generated doc

* properly export UiSettingsServiceStart from server

* remove useless async

* nit: rename
2019-12-19 17:41:16 +01:00
Mikhail Shustov
55feac99cf
Document how to extend request handler context (#53566) 2019-12-19 11:57:54 +01:00
Pierre Gayvallet
805179726f
Migrate instance uuid logic to new platform (#52060) (#53260)
* move and migrate uuid code to new platform

* create and wire uuid service

* handle legacy compatibility

* update generated docs

* add `set` to LegacyConfig interface

* Fix types

* fix config access

* respect naming conventions for uuid

* remove hardcoded config paths

* rename manageInstanceUuid to resolveInstanceUuid

* moves legacy config uuid set from uuid to legacy service

* log specific message depending on how uuid was resolved

* resolve merge conflicts

* use fs.promises

* add forgotten @public in uuid contract

* add explicit errors and tests

* ensure uuid is valid in configuration

* fix read/write tests
2019-12-17 11:16:38 +01:00
Eli Perelman
4e3095be0e
[7.x] Move CSP options to new platform (#52698) (#53049)
* Move CSP options to new platform (#52698)

* Move CSP options to new platform

* Expose SharedGlobalConfig from root

* Derive CSP options from config

* Consolidate CSP configuration with HTTP config

* Fix outstanding config renames

* Remove legacy CSP configuration calls, migrate to platform properties

* Revise docs

* Fix test from type change

* Expose ICspConfig, consolidate and simplify CSP defaults access

* Rebase and update docs

* Remove legacy API from route definition params, review nits

* Clean up config path usages for consistency

* Regenerate docs

* Test correct default value of csp.strict in 7.x
2019-12-16 10:53:30 -06:00
Pierre Gayvallet
9e9fea1659
Allow loggers to create child loggers via 'get' method (#52605) (#53106)
* add 'Logger.get' method

* updates generated doc

* resolve merge conflicts
2019-12-16 12:25:45 +01:00
Pierre Gayvallet
09e269508a
Implements config deprecation in New Platform (#52251) (#52976)
* implements 'rename' and 'unset' deprecations

* introduce usage of ConfigDeprecationProvider

* adapt RawConfigService to only returns unmodified raw config

* apply deprecations when accessing config

* register legacy plugin deprecation in new platform

* implements ConfigService#validate

* add exemple config deprecation usage in testbed

* documentation

* export public config deprecation types

* fix new test due to rebase

* name ConfigDeprecationFactory

* update generated doc

* add tests for unset and move it to src/core/utils

* add tests for renameFromRoot and unusedFromRoot

* cast paths as any as get expects a fixed-length string array

* use specific logger for deprecations

* add additional test on renameFromRoot

* update migration guide

* migrate core deprecations to NP

* add integration test

* use same log context as legacy

* remove old deprecation warnings integration tests, now covered in NP

* migrates csp deprecation to NP

* removes deprecationWarningMixin from legacy

* remove legacy core deprecations

* remove unused import

* rename setupConfigSchemas to setupCoreConfig

* update generated doc
2019-12-13 11:44:39 +01:00