Commit graph

174 commits

Author SHA1 Message Date
Brandon Kobel
42da86a09e
Using the server's basePath when building the SAML ACS (#51391) (#51638)
* Using the server's basePath when building the SAML ACS

* Fixing getACS call
2019-11-25 17:32:59 -05:00
Aleh Zasypkin
da745fad97
[7.x] Preserve URL fragment during SAML handshake. (#47742) 2019-10-10 14:36:49 +02:00
Josh Dover
8e8a6ef754
[7.x] Add types to Elasticsearch API calls (#46668) (#47496) 2019-10-07 15:55:06 -05:00
Aleh Zasypkin
aba8200533
[7.x] Properly apply rename deprecation to xpack.security.authProviders. (#45755) 2019-09-16 15:51:26 +02:00
Aleh Zasypkin
7b12301f2d
[7.x] Provide realm name for OIDC/SAML authenticate requests. (#45756) 2019-09-16 13:33:41 +02:00
Aleh Zasypkin
49c38378c3
[7.x] Downgrade log level from info to debug for cases when we cannot handle authentication attempt. (#44944) 2019-09-06 00:33:42 +02:00
Aleh Zasypkin
81992535d4
[7.x] Introduce PKI authentication provider. (#44114) 2019-08-27 22:45:18 +02:00
Mike Côté
66ecd21d36
Add invalidateAPIKey support to security plugin (#43707) (#44097)
* Initial work

* Fix failing jest test

* Use APIKeys class

* Only use id to invalidate

* Log all errors in invalidate function

* Cleanup

* Apply PR feedback
2019-08-27 11:57:34 -04:00
Rudolf Meijering
1d7c0d4cad Response factory parameters as named arguments (#43248) (#43883) 2019-08-23 14:49:36 -05:00
Mike Côté
2c75961ff6
Add security support for alerts and actions (#41389) (#43592)
* Initial work

* Cleanup add createAPIKey fn pt1

* Change getServices function to take request as parameter

* Use API key when executing alerts

* Revert task manager using encrypted saved objects

* Store fired actions within a saved object to encrypt API keys

* Fix fireActionId

* Cleanup code, fix type check error

* Add a type for getScopedSavedObjectsClient

* Fix getBasePath and spaceIdToNamespace functions

* Add safety check for API key and action

* Fix integration tests

* Fix broken jest tests

* Cleanup

* Rename generatedApiKey to apiKeyValue

* Ensure access to action record

* Cleanup

* Add unit tests

* Fix variable conflict

* Revert task manager specific code (no longer needed)

* Remove fire terminology

* Move tests to spaces and security folder

* Use ES Archiver to remove spaces (empty_kibana)

* Fix missing pieces

* Convert action tests to run per user

* Convert alerting tests to run per user

* Fix type check issue

* Fix failing test

* Add callCluster and savedObjectsClient authorization tests

* Make savedObjectsClient return 403 for authorization tests

* Cleanup

* Fix test failure

* Common function to get data from test index

* Create ObjectRemover

* Cleanup

* useApiKey now provided to functions instead of relying on condition of two strings

* Fix typo

* Make tests it(...) start with should

* Rename useApiKey to isSecurityEnabled

* Merge apiKeyId and apiKeyValue into one

* Update docs

* Use feature controls for list alert / action types API

* Remove need to add ! in TypeScript for required plugins

* Fix ESLint issue

* Include actions and alertTypeParams into AAD and genereate new API key on update

* Generate random id for API key name attribute

* Include interval in AAD

* Send pre-encoded string

* Fix ExecutorError

* Fix apiKey snapshot

* Fix 'default' typo

* De-compose apiKey

* Refresh API key when enabling / disabling an alert

* Add updatedBy

* Make unauthorized APIs return 404
2019-08-20 13:23:09 -04:00
Aleh Zasypkin
ce716ae042
[7.x] Properly validate current user password during password change. (#43489) 2019-08-16 22:28:58 +02:00
Aleh Zasypkin
4c396f85a3
[7.x] Add support for OpenID Connect implicit authentication flow. (#42938) 2019-08-08 18:02:46 +02:00
Mikhail Shustov
26bd65014b
Unify response interface in handler and request interceptors (#42442) (#42918)
* add response factory to the interceptors

* adopt x-pack code to the changes

* Add a separate response factory for lifecycles.

Only route handler can respond with 2xx response.
Interceptors may redirect or reject an incoming request.

* re-generate docs

* response.internal --> response.internalError

* use internalError for exceptions in authenticator

* before Security plugin proxied ES error status code. now sets explicitly.

* provide error via message field of error response for BWC

* update docs

* add customError response

* restore integration test and update unit tests

* update docs

* support Hapi error format for BWC

* add a couple of tests
2019-08-08 13:51:01 +02:00
Mike Côté
38226a120e
Add createApiKey support to security plugin (#42146) (#42381)
* Add createApiKey support to security plugin

* Expiration is optional

* Start moving code to new platform

* Add unit tests

* Fix jest test

* Apply PR feedback

* Apply PR feedback

* Apply PR feedback pt2
2019-07-31 16:49:19 -04:00
Aleh Zasypkin
bbf8da002f
[7.x] Add support for Kerberos output/response tokens. (#42013) 2019-07-25 23:08:55 +02:00
Mikhail Shustov
2dcc69c4fe
AuthResultData configures response headers (#41775) (#41948)
* extend AuthResultData with response headers

* add tests

* update docs

* rename headers --> requestHeaders to clarify intention

* update docs

* address comments
2019-07-25 08:50:49 +02:00
Mikhail Shustov
8058093241
core doesn't use Record<string, unknown> for public API (#41448) (#41742)
* core contracts don't use unknown to support type assignment

limitations of https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#-k-string-unknown--is-no-longer-a-wildcard-assignment-target

* regenereate docs

* remove type over-write
2019-07-23 11:25:26 +02:00
Aleh Zasypkin
e19a03bb7b
[7.x] Migrate authentication subsystem to the new platform. (#41593) 2019-07-22 10:47:54 +02:00
Court Ewing
dbb0534c21 Move x-pack plugins/server/common to x-pack/legacy 2019-06-20 13:35:00 -04:00
Larry Gregory
36f094b8fa
[7.x] Spaces - New Platform Migration, Step 1 (#35429) (#39270)
* crude test updates

* remove custom server typedef

* allow spaces to aquire security plugin after init

* split CoreSetup into CoreSetup and PluginsSetup

* move interfaces to new plugin

* init interceptors in legacy plugin

* fix import

* add placeholder kibana.json

* use NP Elasticsearch service instead of legacy ES Plugin

* cleanup imports

* don't destructure the es client

* introduce request facade

* document reason for getSecurity

* prefer relative imports from src/core

* fix typo in filename: inteceptors --> interceptors

* fix imports; remove stray ts-ignore

* improve typings for spaces client

* rename InterfaceExcept --> Omit

* don't use legacy config in NP

* additional comment

* shim NP config service

* fix merge from master

* revert relative imports into src/core and src/legacy

* shim capabilities modifier into new platform

* removing placeholder kibana.json

* fix prettier problem

* temporary: patch NP 'setUrl'

* migrate onRequest interceptor to NP, without tests

* fix ts error

* testing and deps cleanup for onRequestInterceptor

* replace spaces's usages of request.getBasePath with http.getBasePathFor

* add explicit timeouts for jest interceptor tests

* attempt to fix imports

* use NP logging instead of faked implementation

* revert stray yarn.lock change

* attempt to stablize and fix tests

* update jest config to include src/core/server/mocks

* fix plugin config typings

* add service tests

* fix merge

* allow spaces service to also work with legacy requests

* update interfaces to confirm to new internal/external API convention

* re-enable some post auth interceptor tests

* add explicit timeouts for tests

* prefer modifyUrl instead of manual url modification

* update logger shim to conform to PluginInitializerContext

* remove spaces ConfigClass

* don't weaken type declaration for scoped cluster client calls

* remove legacy server from SpacesCoreSetup

* remove spaces service cache

* remove legacy server as an interceptor dependency

* use modifyUrl on the raw request too

* remove unused import

* cleanup typings

* replace onRequest interceptor with new onPreAuth interceptor

* fix onPostAuth tests

* temporarily copy modifyUrl into spaces plugin

* fix mock export

* fix merge from master

* spaces scopedClient always uses updated ES client and config

* improve typings for usage collector

* rename isLegacyRequest -> isFakeRequest

* use updated NP base path API

* remove commented code

* only expose scoped spaces client

* use OptionalPlugin instead of getSecurity

* update imports of Saved Objects Service to use new src/core/server location

* update core docs
2019-06-19 14:24:14 -04:00
Larry Gregory
8358fe20ea
[7.x] Spaces - use kfetch in SpacesManager (#39102) (#39189) 2019-06-19 07:24:55 -04:00
Greg Thompson
0ca094b416 [7.x] Upgrade EUI to 11.3.2 (#38262) (#39031)
* Upgrade EUI to 11.3.2 (#38262)

* eui 11.3.1

* EuiSuperSelect TS updates

* EuiColorPicker updates

* EuiBadge updates

* a11y updates

* i18n service updates

* remove unused translations

* move valueOfSelected logic to private method

* update EuiColorPicker class name

* Updated canvas storyshots

* i18n fixes; maps color selection position

* i18n snapshot updates

* update canvas storyshots

* snapshot updates

* 11.3.2

* maps colorpicker

* space avatar colorpicker

* update i18n json
2019-06-17 07:57:18 -06:00
Tim Roes
95bf5c067d
Improve jest mocking infrastructure (#38760) (#39033)
* Always mock metadata/chrome in OSS

* Enable jest env in jest mocks

* Exclude jest mocks in karma bundles

* Use setupFilesAfterEnv in config

* Remove chrome/metadata mock from x-pack

* Remove kuery mock

* Add missing mock to SIEM test

* Fix typo in mock import

* Remove top level capabilities x-pack mock

* Move kfetch mock to ui/public

* Move moment-timezone to mocks file

* Unmock kfetch in kfetch specific tests

* Make kfetch mock manual

* Removed unnecessary jest.mock

* Remove kfetch unmocks
2019-06-15 09:45:40 +02:00
Aleh Zasypkin
329dff61c2
[7.x] Make Kerberos authentication provider to accept requests with Authorization: Bearer xxx header to support reporting use case. Disable Kerberos support for the Windows Chromium build. (#38998) 2019-06-14 19:58:28 +02:00
Brandon Kobel
3362066469
Spaces - Hiding management link (#38472) (#38903)
* Changing the Spaces management section to behave like the other FC
controlled sections

* Adding those glorious tests and fixing a bug

* Fixing some test descriptions

* Making the mergeCapabilities operation emulate the old behavior

* Fixing privileges test with the addition of the new action

* Updating jest snapshot

* Adding tests, preventing additional clobbering

* Changing requireUICapability to use management.kibana.spaces
2019-06-13 10:35:26 -07:00
Aleh Zasypkin
4cf8d46332
[7.x] Make SAML realm name configurable (#38667) 2019-06-11 19:21:27 +02:00
Larry Gregory
2fd33c9371
[7.x] Feature Controls - Simplify Saved Objects Management UI Capabilities (#38461) (#38618)
* start simplifying saved objects management UI Capabilities

* update tests

* simplify UI

* address PR feedback

* remove savedObjectsManagement UI Capabilities tests
2019-06-10 19:23:10 -04:00
Matthew Kime
7d3b5564af
d13n PathProvider (#38505) (#38574)
* d13n PathProvider
2019-06-10 13:43:08 -05:00
Matthew Kime
24282a57be
No unused vars cleanup set two (#37051) (#37124)
* no unused vars cleanup
2019-06-08 22:25:33 -05:00
Larry Gregory
00f220df0e
[7.x] Security - remove usage of legacy notifier (#38260) (#38452)
* remove usage of legacy notifier

* fix superfluous whitespace changes

* fix redirection on role management screen

* extract session expiration warning into its own component
2019-06-07 16:51:37 -04:00
Larry Gregory
95e9e75c58
Feature Controls - update base privilege tooltip (#37868) (#37970) 2019-06-04 08:06:01 -04:00
Larry Gregory
d07034e269
Security - display message when logging out of kibana (#37234) (#37969)
* display message when logging out of kibana

* update provider tests

* fix token logout test

* remove newline
2019-06-04 08:05:30 -04:00
Chandler Prall
8e37d72558
Upgrade EUI to 11.0.1; support dynamic import() calls in UI code + eui (#36316) (#37900)
* Upgrade EUI to 11.0.1; support dynamic import() calls in UI code + eui

* update snaps

* Clicking on the svg itself once loaded

* updated snaps

* update icon in snapshots

* Fix snapshot
2019-06-03 17:13:06 -04:00
Larry Gregory
99c174111a
[7.x] Security - remove auth scope provider (#36998) (#37339)
* remove auth scope provider

* handle missing roles

* guard for unauthenticated calls

* update functional tests to not expect a scope property

* there's always money in the banana stand

* revert interceptor optimizations

* protect against missing roles

* address pr feedback

* remove scope as expected property on kerberos auth response
2019-05-29 12:09:39 -04:00
Aleh Zasypkin
c62833b204
[7.x] Introduce Kerberos authentication provider. (#37313) 2019-05-29 11:59:04 +03:00
Ioannis Kakavas
2d668db9c1
Adjust validation for OIDC endpoint (#37303)
This change adjusts validation of query parameters in the
/api/security/v1/oidc endpoint. It was discovered during manual
testing that Google's OP is sending extra parameters than the ones
identified in https://tools.ietf.org/html/rfc6749#section-4.1.2
which is refernced by
https://openid.net/specs/openid-connect-core-1_0.html#AuthResponse
(for instance auth_user and session_state). The existing validation
rules only allowed the expected query parameters but this
means that Kibana wouldn't be able to complete OpenID Connect
authentication with Google acting as the OP.
As dictated in the standard (RFC6749), "The client MUST ignore
unrecognized response parameters." so we should allow but discard
any extra parameters we do not recognize and not throw an error.
Furthermore, it adds stricter validation for the issuer and all
parameters of type URI when these are present.
2019-05-29 09:31:45 +03:00
Brandon Kobel
ef0bfba39d
Switching from public/private to external/internal APIs (#36815) (#36886)
* Switching from public/private to external/internal APIs

We use the public folder a lot of other places to denote files which
should be exposed client-side. Using folders names public was causing
issues with some of the operations team's tooling, so we're renaming
these.

* Fixing forgotten import in test
2019-05-24 12:56:58 -04:00
Larry Gregory
90435dd95a
Add manage_oidc privilege (#36873) (#36882)
manage_oidc cluster privilege was added to Elasticsearch in
https://github.com/elastic/elasticsearch/pull/40674
2019-05-22 17:26:59 -04:00
Brandon Kobel
1b4f6e0245 Add OpenID Connect auth provider (#36201) (#36838)
The OpenID Connect authProvider is the accompanying authProvider for the OpenID Connect authentication realm in Elasticsearch. This is very similar to the saml authProvider in most ways with three noticeable differences:

- We require explicit configuration regarding the Elasticsearch realm name instead of trying to build an environment aware string (like ACS URL in saml) and pass that to Elasticsearch for it to resolve the realm.
- We do not support multiple values for the realm specific nonces (state and nonce) as we do with requestId in the SAML realm. Instead if an existing value ( for state and nonce) is present in the user's session, we pass that to Elasticsearch to be reused. The end goal is the same, allow a better UX for users attempting many requests over different tabs in the same browser context.
- IDP initiated SSO ( Third Party initiated authentication in OIDC-speak ) is implemented but starts as an unsolicited request to initiate the handshake, instead of an unsolicited request with an authentication response (which is not supported here)

This change also adds a fake plugin named oidc_provider to be used in integration tests for mocking calls to the token and userinfo endpoint of an OpenID Connect Provider

This does not support the OpenID Connect Implicit flow as that depends on fragment handling/processing as described for instance in the spec

Co-Authored-By: Brandon Kobel <kobelb@elastic.co>
2019-05-21 21:57:39 -04:00
Matthew Kime
4012fac123
emove angular i18n service calls (#36329) (#36851)
* Remove angular i18n service calls
2019-05-21 19:58:27 -05:00
Spencer
f7a8b33723
[7.x] [xpack/encryptionKeys] use default keys when running from source (#36452) (#36461)
* [xpack/encryptionKeys] use default keys when running from source

* add tests for the config schema with different contexts

* share the getConfigSchema helper

* await promises returned by expect().resolves

* tweak test naming

* use data-driven tests

* fix type error

* hide platform dependent config from snapshot
2019-05-10 13:21:46 -07:00
Brandon Kobel
3d5f1c9bce
Deleating the capabilityDecorator, there are no usages currently. (#36206) (#36220) 2019-05-07 13:27:26 -07:00
Larry Gregory
4f9e8d6e80
[7.x] TypeScriptify and test user management (#36039) (#36222)
* convert user management screen to TypeScript

* rename Users to UsersListPage for consistency

* unit testing for user management page

* fix props for change password form

* test authentication state page

* add access modifiers

* remove unused translations

* reorganize user management files to be consistent with the rest of security's mgmt ui

* add missing license header

* fix import

* remove stray import

* remove unnecessary style hacks

* Update x-pack/plugins/security/public/views/management/edit_user/components/edit_user_page.tsx

Co-Authored-By: legrego <lgregorydev@gmail.com>

* address pr feedback
2019-05-07 15:59:40 -04:00
Larry Gregory
871ce5527b
[7.x] Feature Controls - Add saved objects management feature (#35982) (#36212)
* adds saved objects management feature

* document TODO

* testing UI Capbilities

* update SOM functional tests

* fixing privilege action mapping from merge

* remove describe.only

* add new feature to expected feature list

* prettier

* adds simple unit tests for OSS feature registration

* fix tests following merge
2019-05-07 14:20:16 -04:00
Josh Dover
d6f15af6e5
[7.x] [new-platform] Introduce ApplicationService scaffolding and capabilities loading (#35545) (#36154) 2019-05-07 09:43:52 -05:00
Larry Gregory
c019ff8a9e
[7.x] Feature Controls - remove "grantWithBaseRead" flag (#36121) (#36134) 2019-05-07 08:47:07 -04:00
Aleh Zasypkin
4c26ccca65
[7.x] Introduce Encrypted Saved Objects plugin (#36045) 2019-05-03 19:21:10 +02:00
Larry Gregory
f796084d32
[7.x] [Feature Controls] - Secure Features API (#35841) (#36019)
* restrict access to Features API

* introduce featureControls.manage capability to control calls to features api

* add snapshots

* rename manage_feature_controls api tag to features

* Revert "introduce featureControls.manage capability to control calls to features api"

This reverts commit addc149193.

* update spaces management to only call APIs if authorized

* handle 404 response when requesting features on role management page

* better variable naming

* remove unnecessary mock

* remove unused code

* remove unnecessary snapshots
2019-05-03 09:23:46 -04:00
Larry Gregory
88bb450637
[7.x] Role Management - update index fields API to account for removed types (#35986) (#36015)
* update index fields API to account for removed types

* adds API test
2019-05-03 09:04:51 -04:00
Peter
6d5f29deac
enable security plugin in basic (#35892)
enable security on file dataviz and import (ML plugin)

update unit tests

add api test coverage for security in basic

move audit logging to standard+ license level
2019-05-02 12:32:57 -07:00