Skip to content

Migrate Security and EncryptedSavedObjects test plugins to the Kibana Platform#61614

Merged
azasypkin merged 5 commits intoelastic:masterfrom
azasypkin:issue-xxx-np-migrate-test-plugins
Mar 30, 2020
Merged

Migrate Security and EncryptedSavedObjects test plugins to the Kibana Platform#61614
azasypkin merged 5 commits intoelastic:masterfrom
azasypkin:issue-xxx-np-migrate-test-plugins

Conversation

@azasypkin
Copy link
Copy Markdown
Contributor

PR migrates two test plugins we have to the Kibana Platform. I also finally moved ESO API integration tests to a dedicated directory in a preparation to upcoming ESO enhancements.

Note to reviewers: it's a bit easier to review commit by commit (plain move -> changes).

@azasypkin azasypkin added test chore Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// release_note:skip Skip the PR/issue when compiling release notes Feature:NP Migration v7.7.0 v7.8.0 labels Mar 27, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-security (Team:Security)

@azasypkin azasypkin force-pushed the issue-xxx-np-migrate-test-plugins branch from 2802b2d to a32e93d Compare March 27, 2020 12:53
core.http.createRouter().get(
{
path: '/api/saved_objects/get-decrypted-as-internal-user/{id}',
validate: { params: value => ({ value }) },
Copy link
Copy Markdown
Contributor Author

@azasypkin azasypkin Mar 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: custom ^validation^ to unblock this PR as it's not important for the test plugins anyway (it seems we're hitting the bug #61652).

@azasypkin azasypkin requested a review from jportner March 27, 2020 16:38
Copy link
Copy Markdown
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines 56 to 63
const namespace = deps.spaces.spacesService.getSpaceId(request);

try {
return response.ok({
body: await encryptedSavedObjects.getDecryptedAsInternalUser(
SAVED_OBJECT_WITH_SECRET_TYPE,
request.params.id,
{ namespace: namespace === 'default' ? undefined : namespace }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
const namespace = deps.spaces.spacesService.getSpaceId(request);
try {
return response.ok({
body: await encryptedSavedObjects.getDecryptedAsInternalUser(
SAVED_OBJECT_WITH_SECRET_TYPE,
request.params.id,
{ namespace: namespace === 'default' ? undefined : namespace }
const spaceId = deps.spaces.spacesService.getSpaceId(request);
const namespace = deps.spaces.spacesService.spaceIdToNamespace(spaceId);
try {
return response.ok({
body: await encryptedSavedObjects.getDecryptedAsInternalUser(
SAVED_OBJECT_WITH_SECRET_TYPE,
request.params.id,
{ namespace }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, awesome, didn't new about spaceIdToNamespace, thanks!

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@azasypkin
Copy link
Copy Markdown
Contributor Author

7.7/7.7.0: 2d6f2dc
7.x/7.8.0: 07f5798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported chore Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// test v7.7.0 v7.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants