Skip to content

[Security Solution][EDR] Fix import of endpoint exceptions#233142

Merged
paul-tavares merged 9 commits intoelastic:mainfrom
paul-tavares:task/olm-230679-fix-import-endpoint-exceptions
Sep 2, 2025
Merged

[Security Solution][EDR] Fix import of endpoint exceptions#233142
paul-tavares merged 9 commits intoelastic:mainfrom
paul-tavares:task/olm-230679-fix-import-endpoint-exceptions

Conversation

@paul-tavares
Copy link
Copy Markdown
Contributor

@paul-tavares paul-tavares commented Aug 27, 2025

Summary

  • Fix import of Endpoint Exceptions to ensure they are made visible and accessible via API
    • A bug was introduced with v9.1.0, as part of support for Spaces, that made imported endpoint exceptions unaccessible after import. Items were imported into the index, but they did not include a tag indicating that the exception is Global. This was a new requirement with v9.1.0

Checklist

@paul-tavares paul-tavares self-assigned this Aug 27, 2025
@paul-tavares paul-tavares added release_note:fix Team:Defend Workflows “EDR Workflows” sub-team of Security Solution backport:version Backport to applied version labels v9.1.0 v9.2.0 labels Aug 27, 2025
@paul-tavares
Copy link
Copy Markdown
Contributor Author

/ci

@paul-tavares paul-tavares marked this pull request as ready for review August 27, 2025 15:49
@paul-tavares paul-tavares requested a review from a team as a code owner August 27, 2025 15:49
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

Comment on lines +15 to +17
export default function ({ getService }: FtrProviderContext) {
const endpointArtifactTestResources = getService('endpointArtifactTestResources');
const utils = getService('securitySolutionUtils');
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.

From what I recall, these callbacks have relatively low test coverage. Could we at least add a few error-handling tests?

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.

What do you mean by Error handling?

Also - FYI: there are tests for endpoint exceptions that will be transitioned to be owned by our team as you all work on migrating the endpoint exceptions to our area of the UI. I don't know what the coverage is like there.

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.

OH. Wait. I think you mean error conditions that tests the code that was already there in the import extension point.

I'll add some test :)

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.

FYI: I added tests to ensure we get an error for every other artifact

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.

Sorry for the unclear comment earlier, and thanks for addressing it anyway 🙂

.send()
.expect(200);

expect(body.data.length).to.eql(3);
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.

could you please refactor or just comment this test so it's a bit easier to understand? also, could you help me understand? : )

so 3 list items are imported, 1 with policy:all tag, 2 without it. how does this GET _find api call test this?

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.

So the bug was: imported items were not returned on the GET request. They were imported, but never returned.

This test imports 3 items: some have the Global tag; others don't.... but after the import, all 3 items should be returned - which means that the fix that was applied is working

I will add a comment to this assertion to indicate this. Was there anything else that I can help clarify for you/

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.

thanks for the explanation, all clear. i think this is a good regression test to ensure we don't have the original bug, but it is too indirect for testing that the global artifact tag is really added.

could we also check if the tags are really present either here or in unit test level?

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.

Sure. I will add a check here to ensure the tag was added

.send()
.expect(200);

expect(body.data.length).to.eql(3);
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.

thanks for the explanation, all clear. i think this is a good regression test to ensure we don't have the original bug, but it is too indirect for testing that the global artifact tag is really added.

could we also check if the tags are really present either here or in unit test level?

@paul-tavares paul-tavares enabled auto-merge (squash) September 2, 2025 19:10
@paul-tavares paul-tavares merged commit 5be7a8f into elastic:main Sep 2, 2025
12 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.1

https://github.com/elastic/kibana/actions/runs/17415879529

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Saved Objects .kibana field count

Every field in each saved object type adds overhead to Elasticsearch. Kibana needs to keep the total field count below Elasticsearch's default limit of 1000 fields. Only specify field mappings for the fields you wish to search on or query. See https://www.elastic.co/guide/en/kibana/master/saved-objects-service.html#_mappings

id before after diff
_data_stream_timestamp 1 - -1
_doc_count 1 - -1
_ignored_source 1 - -1
_index_mode 1 - -1
_inference_fields 1 - -1
_tier 1 - -1
apm-custom-dashboards 5 - -5
apm-server-schema 2 - -2
apm-service-group 5 - -5
application_usage_daily 2 - -2
config 2 - -2
config-global 2 - -2
coreMigrationVersion 1 - -1
created_at 1 - -1
created_by 1 - -1
entity-definition 9 - -9
entity-discovery-api-key 2 - -2
event_loop_delays_daily 2 - -2
favorites 4 - -4
file 11 - -11
file-upload-usage-collection-telemetry 3 - -3
fileShare 5 - -5
infra-custom-dashboards 4 - -4
infrastructure-monitoring-log-view 2 - -2
intercept_trigger_record 5 - -5
legacy-url-alias 7 - -7
managed 1 - -1
ml-job 6 - -6
ml-module 13 - -13
ml-trained-model 7 - -7
monitoring-telemetry 2 - -2
namespace 1 - -1
namespaces 1 - -1
observability-onboarding-state 2 - -2
originId 1 - -1
product-doc-install-status 7 - -7
references 4 - -4
sample-data-telemetry 3 - -3
security-ai-prompt 8 - -8
slo 11 - -11
space 5 - -5
synthetics-monitor 34 - -34
synthetics-monitor-multi-space 34 - -34
tag 4 - -4
type 1 - -1
typeMigrationVersion 1 - -1
ui-metric 2 - -2
updated_at 1 - -1
updated_by 1 - -1
upgrade-assistant-ml-upgrade-operation 3 - -3
upgrade-assistant-reindex-operation 3 - -3
uptime-synthetics-api-key 2 - -2
url 5 - -5
usage-counters 2 - -2
total -246

History

cc @paul-tavares

@paul-tavares paul-tavares deleted the task/olm-230679-fix-import-endpoint-exceptions branch September 2, 2025 21:08
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.1 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 233142

Questions ?

Please refer to the Backport tool documentation

kowalczyk-krzysztof pushed a commit to kowalczyk-krzysztof/kibana that referenced this pull request Sep 3, 2025
…33142)

## Summary

- Fix import of Endpoint Exceptions to ensure they are made visible and
accessible via API
- A bug was introduced with `v9.1.0`, as part of support for Spaces,
that made imported endpoint exceptions unaccessible after import. Items
were imported into the index, but they did not include a `tag`
indicating that the exception is Global. This was a new requirement with
`v9.1.0`
@paul-tavares
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

paul-tavares added a commit to paul-tavares/kibana that referenced this pull request Sep 3, 2025
…33142)

## Summary

- Fix import of Endpoint Exceptions to ensure they are made visible and
accessible via API
- A bug was introduced with `v9.1.0`, as part of support for Spaces,
that made imported endpoint exceptions unaccessible after import. Items
were imported into the index, but they did not include a `tag`
indicating that the exception is Global. This was a new requirement with
`v9.1.0`

(cherry picked from commit 5be7a8f)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/server/lists_integration/endpoint/handlers/exceptions_pre_import_handler.ts
#	x-pack/solutions/security/test/security_solution_endpoint/services/endpoint_artifacts.ts
paul-tavares added a commit that referenced this pull request Sep 4, 2025
…3142) (#233890)

# Backport

This will backport the following commits from `main` to `9.1`:
- [[Security Solution][EDR] Fix import of endpoint exceptions
(#233142)](#233142)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Paul
Tavares","email":"56442535+paul-tavares@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-09-02T21:02:24Z","message":"[Security
Solution][EDR] Fix import of endpoint exceptions (#233142)\n\n##
Summary\n\n- Fix import of Endpoint Exceptions to ensure they are made
visible and\naccessible via API\n- A bug was introduced with `v9.1.0`,
as part of support for Spaces,\nthat made imported endpoint exceptions
unaccessible after import. Items\nwere imported into the index, but they
did not include a `tag`\nindicating that the exception is Global. This
was a new requirement
with\n`v9.1.0`","sha":"5be7a8f4c914eea310ca137407403a67fcb923e5","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Defend
Workflows","backport:version","v9.1.0","v9.2.0"],"title":"[Security
Solution][EDR] Fix import of endpoint
exceptions","number":233142,"url":"https://github.com/elastic/kibana/pull/233142","mergeCommit":{"message":"[Security
Solution][EDR] Fix import of endpoint exceptions (#233142)\n\n##
Summary\n\n- Fix import of Endpoint Exceptions to ensure they are made
visible and\naccessible via API\n- A bug was introduced with `v9.1.0`,
as part of support for Spaces,\nthat made imported endpoint exceptions
unaccessible after import. Items\nwere imported into the index, but they
did not include a `tag`\nindicating that the exception is Global. This
was a new requirement
with\n`v9.1.0`","sha":"5be7a8f4c914eea310ca137407403a67fcb923e5"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/233142","number":233142,"mergeCommit":{"message":"[Security
Solution][EDR] Fix import of endpoint exceptions (#233142)\n\n##
Summary\n\n- Fix import of Endpoint Exceptions to ensure they are made
visible and\naccessible via API\n- A bug was introduced with `v9.1.0`,
as part of support for Spaces,\nthat made imported endpoint exceptions
unaccessible after import. Items\nwere imported into the index, but they
did not include a `tag`\nindicating that the exception is Global. This
was a new requirement
with\n`v9.1.0`","sha":"5be7a8f4c914eea310ca137407403a67fcb923e5"}}]}]
BACKPORT-->
ymao1 pushed a commit to ymao1/kibana that referenced this pull request Sep 4, 2025
…33142)

## Summary

- Fix import of Endpoint Exceptions to ensure they are made visible and
accessible via API
- A bug was introduced with `v9.1.0`, as part of support for Spaces,
that made imported endpoint exceptions unaccessible after import. Items
were imported into the index, but they did not include a `tag`
indicating that the exception is Global. This was a new requirement with
`v9.1.0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:fix Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v9.1.0 v9.1.4 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants