[Write restricted dashboards] Implements upsert for types supporting access control#247941
[Write restricted dashboards] Implements upsert for types supporting access control#247941jeramysoucy merged 10 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-security (Team:Security) |
|
ACK: will review today |
azasypkin
left a comment
There was a problem hiding this comment.
Looks good, thanks for adding the integration tests! Just a couple of minor nits.
Also, are we expected to cover this new case in the update.ts unit tests, or are we relying fully on the integration tests to verify access control functionality in general? I'm fine either way as long as we have integration tests.
src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.ts
Outdated
Show resolved
Hide resolved
src/core/packages/saved-objects/api-server-internal/src/lib/apis/update.ts
Outdated
Show resolved
Hide resolved
...tform/test/spaces_api_integration/common/plugins/access_control_test_plugin/server/plugin.ts
Outdated
Show resolved
Hide resolved
afharo
left a comment
There was a problem hiding this comment.
Approving to unblock. I can see that Oleg already covered all my concerns
…is/update.ts Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
@azasypkin Good point...let me take a look at what we can verify in the unit tests. |
|
@azasypkin Unit tests added in 8888294 |
💚 Build Succeeded
Metrics [docs]
History
|
|
@SiddharthMantri @legrego Do you think we should backport this to 9.3? |
|
@jeramysoucy I'm not sure. It's not something we committed for 9.3 - i'm happy to leave it for a patch or next minor release even. what do you think? |
…access control (elastic#247941) Closes elastic#239686 ## Summary This PR implements the "upsert" case for types supporting access control in the Saved Objects update operation. The default access mode is always used during an upsert. The active user profile becomes the owner. If there is no active user profile, no access control metadata is saved during the upsert. ### Tests - x-pack/platform/test/spaces_api_integration/access_control_objects/apis/spaces/access_control_objects.ts - 'should apply defaults when upserting a supported type' - 'should not write access control metadata when upserting unsupported types' - 'should not write access control metadata when upserting a supported type if there is no active user profile ID' Note: "upserting" is not supported in bulk update. --------- Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
|
I'll backport it so it lands in 9.3.1. |
|
Starting backport for target branches: 9.3 https://github.com/elastic/kibana/actions/runs/21129436370 |
|
Starting backport for target branches: 9.3 https://github.com/elastic/kibana/actions/runs/21129436358 |
…access control (elastic#247941) Closes elastic#239686 ## Summary This PR implements the "upsert" case for types supporting access control in the Saved Objects update operation. The default access mode is always used during an upsert. The active user profile becomes the owner. If there is no active user profile, no access control metadata is saved during the upsert. ### Tests - x-pack/platform/test/spaces_api_integration/access_control_objects/apis/spaces/access_control_objects.ts - 'should apply defaults when upserting a supported type' - 'should not write access control metadata when upserting unsupported types' - 'should not write access control metadata when upserting a supported type if there is no active user profile ID' Note: "upserting" is not supported in bulk update. --------- Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com> (cherry picked from commit 7975d47)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…access control (elastic#247941) Closes elastic#239686 ## Summary This PR implements the "upsert" case for types supporting access control in the Saved Objects update operation. The default access mode is always used during an upsert. The active user profile becomes the owner. If there is no active user profile, no access control metadata is saved during the upsert. ### Tests - x-pack/platform/test/spaces_api_integration/access_control_objects/apis/spaces/access_control_objects.ts - 'should apply defaults when upserting a supported type' - 'should not write access control metadata when upserting unsupported types' - 'should not write access control metadata when upserting a supported type if there is no active user profile ID' Note: "upserting" is not supported in bulk update. --------- Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com> (cherry picked from commit 7975d47)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…rting access control (#247941) (#249503) # Backport This will backport the following commits from `main` to `9.3`: - [[Write restricted dashboards] Implements upsert for types supporting access control (#247941)](#247941) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jeramy Soucy","email":"jeramy.soucy@elastic.co"},"sourceCommit":{"committedDate":"2026-01-13T15:45:02Z","message":"[Write restricted dashboards] Implements upsert for types supporting access control (#247941)\n\nCloses #239686\n\n## Summary\n\nThis PR implements the \"upsert\" case for types supporting access control\nin the Saved Objects update operation. The default access mode is always\nused during an upsert. The active user profile becomes the owner. If\nthere is no active user profile, no access control metadata is saved\nduring the upsert.\n\n### Tests\n\n-\nx-pack/platform/test/spaces_api_integration/access_control_objects/apis/spaces/access_control_objects.ts\n - 'should apply defaults when upserting a supported type'\n- 'should not write access control metadata when upserting unsupported\ntypes'\n- 'should not write access control metadata when upserting a supported\ntype if there is no active user profile ID'\n\nNote: \"upserting\" is not supported in bulk update.\n\n---------\n\nCo-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>","sha":"7975d473559c90f7361f7238023331fc906af47c","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","backport:version","v9.3.0","v9.4.0"],"title":"[Write restricted dashboards] Implements upsert for types supporting access control","number":247941,"url":"https://github.com/elastic/kibana/pull/247941","mergeCommit":{"message":"[Write restricted dashboards] Implements upsert for types supporting access control (#247941)\n\nCloses #239686\n\n## Summary\n\nThis PR implements the \"upsert\" case for types supporting access control\nin the Saved Objects update operation. The default access mode is always\nused during an upsert. The active user profile becomes the owner. If\nthere is no active user profile, no access control metadata is saved\nduring the upsert.\n\n### Tests\n\n-\nx-pack/platform/test/spaces_api_integration/access_control_objects/apis/spaces/access_control_objects.ts\n - 'should apply defaults when upserting a supported type'\n- 'should not write access control metadata when upserting unsupported\ntypes'\n- 'should not write access control metadata when upserting a supported\ntype if there is no active user profile ID'\n\nNote: \"upserting\" is not supported in bulk update.\n\n---------\n\nCo-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>","sha":"7975d473559c90f7361f7238023331fc906af47c"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247941","number":247941,"mergeCommit":{"message":"[Write restricted dashboards] Implements upsert for types supporting access control (#247941)\n\nCloses #239686\n\n## Summary\n\nThis PR implements the \"upsert\" case for types supporting access control\nin the Saved Objects update operation. The default access mode is always\nused during an upsert. The active user profile becomes the owner. If\nthere is no active user profile, no access control metadata is saved\nduring the upsert.\n\n### Tests\n\n-\nx-pack/platform/test/spaces_api_integration/access_control_objects/apis/spaces/access_control_objects.ts\n - 'should apply defaults when upserting a supported type'\n- 'should not write access control metadata when upserting unsupported\ntypes'\n- 'should not write access control metadata when upserting a supported\ntype if there is no active user profile ID'\n\nNote: \"upserting\" is not supported in bulk update.\n\n---------\n\nCo-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>","sha":"7975d473559c90f7361f7238023331fc906af47c"}}]}] BACKPORT--> Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co> Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Closes #239686
Summary
This PR implements the "upsert" case for types supporting access control in the Saved Objects update operation. The default access mode is always used during an upsert. The active user profile becomes the owner. If there is no active user profile, no access control metadata is saved during the upsert.
Tests
Note: "upserting" is not supported in bulk update.