Skip to content

[System] Fix system.auth IAM events event.outcome - #22212

Merged
moxarth-rathod merged 5 commits into
elastic:mainfrom
moxarth-rathod:system-event-outcome-fix
Nov 2, 2026
Merged

moxarth-rathod merged 5 commits into
elastic:mainfrom
moxarth-rathod:system-event-outcome-fix

Conversation

@moxarth-rathod

@moxarth-rathod moxarth-rathod commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Proposed commit message

  system: set IAM event.outcome from failed-prefix

  Change the system.auth IAM outcome processors so success and failure
  are decided with `message.startsWith("fail")` instead of
  `message.contains("fail")`. Useradd events whose username, home
  directory, or shell contains "fail" (for example `faileduser` or
  `/usr/local/fail/sh`) no longer get `event.outcome: failure`.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Related issues

@moxarth-rathod moxarth-rathod self-assigned this Oct 28, 2026
@moxarth-rathod moxarth-rathod added Integration:system System bugfix Pull request that fixes a bug issue labels Oct 28, 2026
Copilot AI balanced review requested due to automatic review settings October 28, 2026 07:03
@moxarth-rathod moxarth-rathod added Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Team:SDE-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors] labels Oct 28, 2026
@moxarth-rathod
moxarth-rathod requested review from a team as code owners October 28, 2026 07:03
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Elastic Docs Style Checker (Vale)

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.

Copilot AI left a comment

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.

🟡 Changes recommended

The release-note entry links to unrelated PR #1 and should instead point to this fix’s PR or related issue #17662.

1 open issue
What changed in this PR

Fixes System authentication IAM outcome classification for issue #17662, so successful account operations are not marked as failures when account fields contain fail.

Changes:

  • Replaces substring matching with a failed prefix check for IAM outcomes.
  • Adds a regression fixture covering fail in the username, home directory, and shell.
  • Bumps the package to version 3.2.1 and adds a changelog entry.
File Description
packages/​system/​manifest.yml Bumps the package version to 3.2.1.
packages/​system/​data_stream/​auth/​elasticsearch/​ingest_pipeline/​message.yml Uses the failed prefix to classify IAM outcomes.
packages/​system/​data_stream/​auth/​_dev/​test/​pipeline/​test-iam-fail-in-name.log-expected.json Expects a successful user-creation outcome.
packages/​system/​data_stream/​auth/​_dev/​test/​pipeline/​test-iam-fail-in-name.log-config.yml Configures the regression fixture’s log input.
packages/​system/​data_stream/​auth/​_dev/​test/​pipeline/​test-iam-fail-in-name.log Adds a user-creation event with fail in account fields.
packages/​system/​changelog.yml Documents the outcome-classification fix.

Review effort: Balanced

Comment thread packages/system/changelog.yml Resolved
Copilot AI balanced review requested due to automatic review settings October 28, 2026 07:06

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues block the IAM outcome-classification fix.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

field: event.outcome
value: failure
if: ctx.process?.name != null && (ctx.message != null && ctx.message.contains("fail")) && ['groupadd', 'groupdel', 'groupmod', 'useradd', 'userdel', 'usermod'].contains(ctx.process.name)
if: ctx.process?.name != null && (ctx.message != null && ctx.message.startsWith("failed")) && ['groupadd', 'groupdel', 'groupmod', 'useradd', 'userdel', 'usermod'].contains(ctx.process.name)

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.

Severity: 🟡 Medium confidence: medium path: packages/system/data_stream/auth/elasticsearch/ingest_pipeline/message.yml:645

startsWith("failed") stops shadow-utils "failure while writing changes to ..." errors from being set to event.outcome failure; they now get success. Match the "fail" prefix instead of "failed".

Details

The old condition ctx.message.contains("fail") set event.outcome: failure for every IAM message that contained the substring. The new startsWith("failed") only matches messages beginning with failed (for example failed adding user 'aol', exit code: 4, which is in test-auth-rhel79.log). As far as I recall, useradd/usermod/userdel/groupadd/groupdel/groupmod also log failure while writing changes to <db> when committing /etc/passwd, /etc/group or /etc/shadow fails. I could not open the upstream shadow-utils source to confirm this, because the host is not allowlisted. If that wording is right, these messages start with fail but not failed. Before this PR they got event.outcome: failure. With this change the success processor at line 640 matches them instead, so a failed account or group write is reported as a successful IAM change. No fixture covers this message form, so the pipeline tests would not catch the regression. Both IAM success messages, new user: ... and new group: ..., start with fixed prefixes, so a fail prefix check still fixes issue 17662 (a username, home directory or shell containing fail).

Recommendation:

Match the fail prefix in both the success and failure conditions so that failed ... and failure ... messages are both treated as failures, while values inside new user: and new group: lines still are not. Also add a pipeline fixture line such as useradd[1234]: failure while writing changes to /etc/passwd to cover this branch.

  - set:
      tag: set_outcome-success
      field: event.outcome
      value: success
      if: ctx.process?.name != null && (ctx.message == null || !ctx.message.startsWith("fail")) && ['groupadd', 'groupdel', 'groupmod', 'useradd', 'userdel', 'usermod'].contains(ctx.process.name)
  - set:
      tag: set_outcome-failure
      field: event.outcome
      value: failure
      if: ctx.process?.name != null && (ctx.message != null && ctx.message.startsWith("fail")) && ['groupadd', 'groupdel', 'groupmod', 'useradd', 'userdel', 'usermod'].contains(ctx.process.name)

Also in: packages/system/data_stream/auth/elasticsearch/ingest_pipeline/message.yml:640


🤖 AI-Generated Review | Vera Review Bot - v0.4.3 | 📚 Knowledge base: integration-skills

⚠️ Automated review — verify suggestions before applying.

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

Copilot AI balanced review requested due to automatic review settings November 2, 2026 06:24

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues were identified for the IAM outcome-classification fix.

No open issues 🎉

Review effort: Balanced

@kcreddy kcreddy left a comment

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.

The commit message says message.startsWith("failed") while the fix has message.startsWith("fail")

Comment thread packages/system/changelog.yml Resolved
Co-authored-by: Krishna Chaitanya Reddy Burri <krish.reddy91@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 09:53

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed because the ingest pipeline can overwrite previously identified PAM authentication failures with success for listed tools.

No open issues 🎉

Review effort: Balanced

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

✅ All changelog entries have the correct PR link.

@vera-review-bot

Copy link
Copy Markdown
Contributor

🟢 No issues across the latest commits c857620.

⚠️ 1 comment still unresolved from earlier commits — 1 medium
  • 🟡 startsWith("failed") stops shadow-utils "failure while writing changes to ..." errors from being set to event.outcome failure (link)

Review summary

Issues found across earlier commits 4214d1d — 1 medium
  • 🟡 startsWith("failed") stops shadow-utils "failure while writing changes to ..." errors from being set to event.outcome failure (link) (Outdated)

A new commit triggers another review — at most once every 15 minutes. I skip the PR while it's approved or has merge conflicts.

🤖 AI-Generated Review | Vera Review Bot - v0.4.3 | 📚 Knowledge base: integration-skills

⚠️ Automated review — verify suggestions before applying.

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @moxarth-rathod

@mergify

mergify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@moxarth-rathod
moxarth-rathod merged commit c5ed7d1 into elastic:main Nov 2, 2026
14 checks passed
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package system - 3.3.1 containing this change is available at https://epr.elastic.co/package/system/3.3.1/

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

Labels

bugfix Pull request that fixes a bug issue Integration:system System Team:SDE-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors] Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[system.auth] event.outcome incorrectly set to "failure" when username, homedir, or shell contains the word "fail"

3 participants