Repository navigation
[System] Fix system.auth IAM events event.outcome - #22212
Conversation
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
✅ 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. |
There was a problem hiding this comment.
🟡 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
failedprefix check for IAM outcomes. - Adds a regression fixture covering
failin 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
| 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) |
There was a problem hiding this comment.
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.
🚀 Benchmarks reportTo see the full report comment with |
kcreddy
left a comment
There was a problem hiding this comment.
The commit message says message.startsWith("failed") while the fix has message.startsWith("fail")
Co-authored-by: Krishna Chaitanya Reddy Burri <krish.reddy91@gmail.com>
|
✅ All changelog entries have the correct PR link. |
|
🟢 No issues across the latest commits c857620.
|
💚 Build Succeeded
History
|
|
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. |
|
Package system - 3.3.1 containing this change is available at https://epr.elastic.co/package/system/3.3.1/ |

Proposed commit message
Checklist
changelog.ymlfile.Related issues