Skip to content

Fix sending user_enabled instead of enabled when creating/updating integrations - #426

Draft
Desvelao wants to merge 2 commits into
5.0.0from
fix/1470-integration-user-enabled-field
Draft

Fix sending user_enabled instead of enabled when creating/updating integrations#426
Desvelao wants to merge 2 commits into
5.0.0from
fix/1470-integration-user-enabled-field

Conversation

@Desvelao

@Desvelao Desvelao commented Jul 29, 2026

Copy link
Copy Markdown
Member

Description

The Content Manager is changing how an integration's enabled state is stored: an integration now carries three boolean fields (cti_enabled, user_enabled, enabled), each written by exactly one actor. Reading keeps using document.enabled unchanged, but the Content Manager now derives enabled itself and rejects create/update requests that still send it directly (400 Missing [user_enabled] field).

This PR renames the field sent in the outgoing create/update payload from enabled to user_enabled, in every space (standard, draft, test, custom).

Closes #427

Proposed Changes

  • Added IntegrationResourcePayload type (types/Integrations.ts): the Content Manager resource shape, IntegrationBase['document'] minus enabled plus user_enabled.
  • Added toIntegrationResourcePayload() (server/utils/helpers.ts): renames enableduser_enabled on the document before it is sent to the Content Manager.
  • server/services/IntegrationService.ts: createIntegration and updateIntegration now build the outgoing resource body through toIntegrationResourcePayload().
  • No changes to read paths (searchIntegrations, PoliciesService, browser code) — they keep using document.enabled as returned by the Content Manager, unchanged.

Results and Evidence

Not yet verified end-to-end: the Content Manager's user_enabled/cti_enabled support depends on the indexer package from wazuh/wazuh-indexer-plugins#1403, which is not yet available. This PR stays in draft until that package is published and the create/update flows can be validated against a real cluster, in every space.

Tests Introduced

  • server/utils/helpers.test.ts: unit tests for toIntegrationResourcePayload, covering enabled: true/false and confirming the rest of the document is left untouched across standard/draft/test/custom spaces.

Review Checklist

  • Code changes reviewed
  • Relevant evidence provided (pending indexer package availability, see above)
  • Tests cover the new functionality
  • Configuration changes documented (n/a)
  • Developer documentation reflects the changes (n/a)
  • Meets requirements and/or definition of done (pending validation against the new indexer package)
  • No unresolved dependencies with other issues (tracked: wazuh-indexer-plugins#1403)
  • PR is linked to the relevant issue(s)
  • Correct labels applied (e.g., no-changelog)

…grations

The Content Manager now derives document.enabled from user_enabled and
cti_enabled itself, and rejects requests that still send enabled
directly (400 Missing [user_enabled] field). Rename the field on the
outgoing create/update resource payload in every space; reads keep
using document.enabled unchanged.

Signed-off-by: Antonio David Gutiérrez <antonio.gutierrez@wazuh.com>
@Desvelao
Desvelao marked this pull request as ready for review July 29, 2026 10:30
@Desvelao
Desvelao marked this pull request as draft July 29, 2026 10:30
@Desvelao Desvelao self-assigned this Jul 29, 2026
@Desvelao Desvelao linked an issue Jul 29, 2026 that may be closed by this pull request
Signed-off-by: Antonio David Gutiérrez <antonio.gutierrez@wazuh.com>
@Desvelao Desvelao changed the title fix: send user_enabled instead of enabled when creating/updating integrations Fix sending user_enabled instead of enabled when creating/updating integrations Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use user_enabled when creating and updating integrations

1 participant