Skip to content

[Osquery] Remove @kbn/timelines-plugin dependency from osquery plugin#250055

Merged
tomsonpl merged 17 commits intoelastic:mainfrom
tomsonpl:osquery-fix-timeline
Jan 29, 2026
Merged

[Osquery] Remove @kbn/timelines-plugin dependency from osquery plugin#250055
tomsonpl merged 17 commits intoelastic:mainfrom
tomsonpl:osquery-fix-timeline

Conversation

@tomsonpl
Copy link
Copy Markdown
Contributor

@tomsonpl tomsonpl commented Jan 22, 2026

This PR fixes a bug where Add to timelines functionality doesn't work in Osquery. It removes the dependency between Osquery and Timelines plugins. Timelines in Osquery is being used only from the Security Solution context - so we pass down Timelines logic through props. Instead of using it out of Osquery context (since the bug prevented this logic anyway, we were missing proper confiugration in kibana.jsonc file)

  - Create local DataProvider and AddToTimelineHandler types in osquery
    to avoid direct dependency on timelines plugin
  - Refactor AddToTimelineButton to require addToTimeline callback prop
    instead of using timelines service directly
  - Pass addToTimeline handler from security solution context
    (OsqueryFlyout, ResponseActionsResults) down to osquery components
  - Remove timelines from osquery's StartPlugins, moon.yml, and tsconfig.json
  - Re-enable previously broken timelines and cases cypress test
@tomsonpl tomsonpl self-assigned this Jan 22, 2026
@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl tomsonpl added release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Osquery v9.4.0 labels Jan 23, 2026
@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl tomsonpl marked this pull request as ready for review January 26, 2026 12:12
@tomsonpl tomsonpl requested review from a team as code owners January 26, 2026 12:12
@tomsonpl tomsonpl added the backport:skip This PR does not require backporting label Jan 26, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Scout: [ platform / streams_app-stateful ] plugin / stateful - Stream data processing - outdated documents - with up to date documents - should not display warning tip for kql samples datasource
  • [job] [logs] Scout: [ platform / streams_app-stateful ] plugin / with up to date documents - should not display warning tip for kql samples datasource

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 8688 8689 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
osquery 1.1MB 1.1MB +424.0B
securitySolution 10.8MB 10.8MB +764.0B
total +1.2KB
Unknown metric groups

References to deprecated APIs

id before after diff
osquery 45 44 -1

Unreferenced deprecated APIs

id before after diff
osquery 45 44 -1

History

cc @tomsonpl

Copy link
Copy Markdown
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

Did code review only and looks good to me. I've a few questions and suggestions but otherwise good to go.

});

it('should add result a case and have add to timeline in result', () => {
it('should add result a case and not have add to timeline in result', () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test description doesn't make sense. Consider updating it. should add result to a case and not show timeline in result? Also is this test asserting two things?

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.

Thanks, rephrased 👍

* Hook that returns a callback to add data providers to the active timeline.
* Shows a success toast notification after adding.
*/
export const useAddToTimeline = () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider adding a return type to this hook.

value: string | string[];
operator: ':' | ':*' | 'includes';
};
and: DataProvider[];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You need to exclude this and from the type assigned to and no? Something like
and: Omit<DataProvider, 'and'>[] unless you want a recursive entry for and?

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.

Good catch! However, the recursive and: DataProvider[] (now OsqueryDataProvider[]) is intentional here.

The original DataProvider type in @kbn/timelines-plugin uses the same recursive structure:

  // From timelines plugin
  export interface DataProvider {
    // ...
    and: DataProvider[];
  }

Since this local type is meant to be compatible with the timelines plugin's type (so that useAddToTimeline in security_solution can accept it), I've kept the same recursive structure to ensure type compatibility at the boundary where osquery passes providers to security_solution.

In practice, the osquery code always sets and: [] (empty array), so the recursion is never actually used - but keeping the type signature aligned avoids potential type mismatches.

Would that be ok with you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to confirm, I notice the the original Timelines DataProvider['and'] (and also the security solutions copy) also excludes itself from the type.

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, you're actually right, I missed it. Fixed with Omit<> :) Thanks! 👍

* This is a local definition to avoid direct dependency on @kbn/timelines-plugin.
* The structure is compatible with the timelines plugin's DataProvider type.
*/
export interface DataProvider {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe name this something else so devs don't auto-import this type by mistake (via code editors) instead of the timelines one? @deprecated might also help warn devs.

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.

Good point, renamed to OsqueryDataProvider 👍

  - Fix test description grammar in cases.cy.ts
  - Add return type to useAddToTimeline hook
  - Rename DataProvider → OsqueryDataProvider to avoid import confusion
Copy link
Copy Markdown
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

@tomsonpl
Copy link
Copy Markdown
Contributor Author

/ci

@tomsonpl tomsonpl merged commit dbbc994 into elastic:main Jan 29, 2026
16 checks passed
gsoldevila added a commit that referenced this pull request Jan 30, 2026
## Summary

#250055 is removing the dependency
`osquery => timelines`, which was forcing the `@kbn/timelines-plugin` to
be part of _platform/shared_.

The goal of this PR is to relocate the `@kbn/timelines-plugin` to
_security/private_ (after the PR above is merged).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Jan 30, 2026
## Summary

elastic#250055 is removing the dependency
`osquery => timelines`, which was forcing the `@kbn/timelines-plugin` to
be part of _platform/shared_.

The goal of this PR is to relocate the `@kbn/timelines-plugin` to
_security/private_ (after the PR above is merged).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3b61978)
mbondyra added a commit to mbondyra/kibana that referenced this pull request Jan 30, 2026
…iew_cps

* commit '5f7fec57cb01883038810bd735a0666683b49904': (116 commits)
  [Security Solution][Attacks/Alerts][Setup and miscellaneous] Advanced setting to control feature visibility (elastic#250157) (elastic#250830)
  Fix synthtrace `fetch` usage (elastic#250950)
  [APM] Add Nodes and Edges components and selection logic (elastic#250937)
  [Docs] Update alerting-settings.md and add serverless value for one parameter (elastic#250842)
  [Agent Builder] filestore: initial implementation (elastic#250043)
  [CPS] Support CPS in Vega ESQL (elastic#250693)
  Adjustments to cascade document esql helpers (elastic#250560)
  [Security Solutions] Trial Companion - adds ai chat and elastic agent detectors (elastic#250908)
  [Obs Presentation] Code Scanning Alert Fixes (elastic#250858)
  [performance] add return and refresh render scenarios to dashboard journeys (elastic#250939)
  skip failing test suite (elastic#245458)
  Add Cloud Forwarder onboarding tile to O11y Solution (elastic#250325)
  [Traces] Remove APM unified trace waterall embeddable registration (elastic#250808)
  [Discover] [Metrics] Fix: metrics grid titles do not update on order change (elastic#250963)
  [a11y] Fix Eui modal title annoucment (elastic#250459)
  [Cloud Security] [Fleet] Add cloud connector access scope for input or package level credential definitions (elastic#250280)
  [WorkplaceAI] SharePoint Online stack connector (elastic#248737)
  [Response Ops][Task Manager] Update functions do not handle API key invalidation (elastic#249109)
  [Osquery] Remove @kbn/timelines-plugin dependency from osquery plugin (elastic#250055)
  [One Discover][Logs UX] Update OpenTelemetry Semantic Conventions (elastic#250346)
  ...
hannahbrooks pushed a commit to hannahbrooks/kibana that referenced this pull request Jan 30, 2026
## Summary

elastic#250055 is removing the dependency
`osquery => timelines`, which was forcing the `@kbn/timelines-plugin` to
be part of _platform/shared_.

The goal of this PR is to relocate the `@kbn/timelines-plugin` to
_security/private_ (after the PR above is merged).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Osquery release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants