-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Adds secondary authorization header to Transforms in Fleet #154665
Merged
Merged
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1056f2f
Cherry pick only Fleet changes
qn895 a151080
Cherry pick only Fleet changes
qn895 59b7541
Fix i18n and types
qn895 605b27b
Fix tests
qn895 918c9c4
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine b74f843
[ML] Update hash
qn895 bef90f7
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 bc55ec8
[ML] Add username to transform meta
qn895 40802ff
[ML] Add callout message
qn895 98a01d4
[ML] Fix messaging
qn895 2885aa6
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 49562f4
[Fleet] Fix test
qn895 d11196c
[Fleet] Fix deferred missing due to transform not set to auto start
qn895 1cf340f
Merge upstream/main into branch
qn895 5bb5690
Add run_as_kibana_system check
qn895 d9b9da5
Add run_as_kibana_system check per transform basis
qn895 1400547
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 4d2eb77
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 0870d08
Remove todo
qn895 4e54dee
- Add key to fragment to rid of React errors
qn895 73b1216
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 22b5f9d
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 c7ad1c7
Update messaging
qn895 57bc06a
Merge remote-tracking branch 'upstream/main' into ml-fleet-2nd-auth
qn895 0187c5f
Add icon, remove fixme
qn895 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { KibanaRequest } from '@kbn/core/server'; | ||
|
||
// Duplicate of x-pack/plugins/security/server/authentication/http_authentication/http_authorization_header.ts | ||
// to prevent bundle being required in security_solution | ||
// FIXME: Put this in a package | ||
export class HTTPAuthorizationHeader { | ||
/** | ||
* The authentication scheme. Should be consumed in a case-insensitive manner. | ||
* https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes | ||
*/ | ||
readonly scheme: string; | ||
|
||
/** | ||
* The authentication credentials for the scheme. | ||
*/ | ||
readonly credentials: string; | ||
|
||
constructor(scheme: string, credentials: string) { | ||
this.scheme = scheme; | ||
this.credentials = credentials; | ||
} | ||
|
||
/** | ||
* Parses request's `Authorization` HTTP header if present. | ||
* @param request Request instance to extract the authorization header from. | ||
*/ | ||
static parseFromRequest(request: KibanaRequest) { | ||
const authorizationHeaderValue = request.headers.authorization; | ||
if (!authorizationHeaderValue || typeof authorizationHeaderValue !== 'string') { | ||
return null; | ||
} | ||
|
||
const [scheme] = authorizationHeaderValue.split(/\s+/); | ||
const credentials = authorizationHeaderValue.substring(scheme.length + 1); | ||
|
||
return new HTTPAuthorizationHeader(scheme, credentials); | ||
} | ||
|
||
toString() { | ||
return `${this.scheme} ${this.credentials}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/fleet/common/types/models/transform_api_key.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { GrantAPIKeyResult } from '@kbn/security-plugin/server'; | ||
|
||
export interface TransformAPIKey extends GrantAPIKeyResult { | ||
/** | ||
* Generated encoded API key used for headers | ||
*/ | ||
encoded: string; | ||
} | ||
|
||
export interface SecondaryAuthorizationHeader { | ||
headers?: { 'es-secondary-authorization': string | string[] }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this FIXME comment do we have an issue for the fix? When do we expect to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this FIXME for now as the file is modified from the original copy of security_solution's code
0187c5f
(#154665)