Repository navigation
[o365] Fix pipeline failures on list events with a non-numeric ListBaseType - #22177
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.
🟢 Approval recommended
The localized fix preserves successful conversions and includes regression coverage, with only a nonblocking changelog-link correction remaining.
1 open issue
What changed in this PR
This PR fixes Office 365 audit pipeline failures when SharePoint or OneDrive events contain a non-numeric ListBaseType, addressing #22053.
Changes:
- Preserve strings that cannot be normalized as integers while retaining successful numeric conversions.
- Add regression coverage for
ListBaseType: DocumentLibrary. - Bump the package to 4.0.2 and document the fix.
| File | Description |
|---|---|
packages/o365/manifest.yml |
Bumps the package version to 4.0.2. |
packages/o365/data_stream/audit/elasticsearch/ingest_pipeline/default.yml |
Handles number-format and arithmetic exceptions during normalization. |
packages/o365/data_stream/audit/_dev/test/pipeline/test-sharepoint-events.json-expected.json |
Expects the non-numeric value to survive successful processing. |
packages/o365/data_stream/audit/_dev/test/pipeline/test-sharepoint-events.json |
Adds DocumentLibrary to a regression fixture. |
packages/o365/changelog.yml |
Adds the 4.0.2 bugfix release note. |
Review effort: Balanced
🚀 Benchmarks reportTo see the full report comment with |
marc-gr
left a comment
There was a problem hiding this comment.
Verified: with the PR, elastic-package test pipeline --data-streams audit
passes (54 cases, ES 8.19.21). With the pipeline reverted to main, only
test-sharepoint-events.json fails, with the error from #22053. Nothing
blocking.
Requested changes
-
Remove
ListBaseTypefromscript_normalize_numbersparams.fields;
keep the try/catch.
Microsoft documents it as a string: the Management Activity API schema
hasListBaseType | Edm.String, and MS-SITEDATS defines it as an enum of
names (UnspecifiedBaseType, GenericList, DocumentLibrary, Unused,
DiscussionBoard, Survey, Issue). As efd6 said on #22053, it should not
have been added to the list in #21875. The PR's reason for keeping it
("a numeric value from the o365audit input still becomes an integer
string, as it did before 3.8.2") does not hold: before 3.8.2 the pipeline
ranconvert type: stringon it (convert-listbasetype-to-string), which
turns a double 1.0 into "1.0", not "1". The field is mappedkeyword, so
a numeric value still indexes fine without the normalisation. -
Add a test for the
ArithmeticExceptionbranch.
Removing that catch leaves every pipeline test passing. The branch is
reachable: on main,"1.5e0"and"1.5E-3"fail with "Rounding
necessary" and"1e2147483648"with "Underflow"; with the PR they are
kept unchanged. A value like"1.5e0"in a normalised field (for example
UserType) intest-numbery-json-events.json, next to the #21875 number
cases, would cover it. -
Use a real list event in the test.
The newListBaseTypeis added to aPageViewedevent (RecordType 4,
ItemType: Page), which does not carry that field in real data. Please
add a separate RecordType 36ListViewed(orListUpdated) event so the
test shows the case from #22053. It goes through the same processors, so
the code path is unchanged.
Suggestions
-
Commit message, input attribution. "Numeric values, including those
in scientific notation from the legacy o365audit input, are normalized as
before" names the wrong input. o365audit values arrive asNumberand
take thelongValue()branch; strings in scientific notation come from
the CEL input (decode_json_string_numbers()). Suggested: "Numbers from
the o365audit input, and numeric strings in scientific notation from the
CEL input, are normalized as before." -
Changelog: say when it started. Suggested:
Fix ingest pipeline failures, introduced in 4.0.0, on SharePoint and
OneDrive list events whoseListBaseTypeis a name such as
DocumentLibrary. These events were indexed aspipeline_error
without any ECS fields. -
Pipeline description. "Values that are not integers ... are left
unchanged" is only true for strings; a number 1.5 still becomes "1"
throughlongValue(). With item 1 the ListBaseType example also goes.
Suggested: "Strings that are not integers are left unchanged."
Suggested proposed commit message (if items 1 to 4 are taken)
o365: fix pipeline failures on list events with a named ListBaseType
SharePoint and OneDrive list events (RecordType 36, such as ListViewed,
ListUpdated, ListColumnCreated and ListColumnUpdated) report
ListBaseType as a name such as "DocumentLibrary". Since 4.0.0 (#21875),
ListBaseType has been in the script_normalize_numbers field list, and
these events failed with:
Character D is neither a decimal digit number, decimal point, nor "e"
notation exponential mark.
The script treats any string that contains an "e" or "E" as a number in
scientific notation and passes it to
new BigDecimal(value).toBigIntegerExact(). The names contain an "e", so
BigDecimal threw, and the whole document was indexed as
event.kind: pipeline_error with only the raw o365audit.* fields.
Microsoft documents ListBaseType as a string enumeration, so remove it
from the list. Also catch NumberFormatException and ArithmeticException
in normalize() and return the value unchanged, the same way
script_convert_numbers handles values it cannot parse, so that a
non-integer string in another listed field no longer fails the whole
document. Numbers from the o365audit input, and numeric strings in
scientific notation from the CEL input, are normalized as before.
Add a SharePoint list event with a ListBaseType of "DocumentLibrary",
and a non-integer value in scientific notation, to the pipeline tests.
How to test (for the PR body)
cd packages/o365
elastic-package test pipeline --data-streams audit
All cases pass. The RecordType 36 event fails on main in
script_normalize_numbers and, with the change, is indexed with
event.action: ListViewed and o365.audit.ListBaseType: DocumentLibrary.
No system or script test reaches this path (no mock record has
ListBaseType or RecordType 36), so system tests add nothing here.
Checked and fine
- Version 4.0.2 in manifest and changelog,
type: bugfix, link correct. - No mapping change:
o365.audit.ListBaseTypeis alreadykeyword
(fields/fields.yml:416), README matches, no dashboard uses it. - No backport: o365 has no backport branches, and the bug exists only in
4.0.0 and 4.0.1. - No overlapping open PR (only #21804, which touches script tests only).
Closes #22053is right.
Not checked: Elasticsearch 9.x, the legacy o365audit input end to end,
real Microsoft RecordType 36 payloads.
| - UserType | ||
| - AzureActiveDirectoryEventType | ||
| - ListBaseType | ||
| list_fields: |
|
🟢 Reviewed the latest commits 1897f67 — nothing new beyond already posted comments.
🤖 AI-Generated Review | Vera Review Bot - v0.4.3 | 📚 Knowledge base: integration-skills
|
|
Thanks @marc-gr for the detailed review and for running the tests.
Also took the commit message, changelog and pipeline description |
|
✅ All changelog entries have the correct PR link. |
💚 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 o365 - 4.0.2 containing this change is available at https://epr.elastic.co/package/o365/4.0.2/ |


Proposed commit message
Checklist
changelog.ymlfile.How to test this PR locally
The RecordType 36
ListViewedevent intest-sharepoint-events.jsonfails on main in
script_normalize_numbers. With the change it isindexed with
event.action: ListViewedando365.audit.ListBaseType: DocumentLibrary. The new event intest-numbery-json-events.jsonkeepsUserType: "1.5e0"andLogonType: "Delegate"unchanged instead of failing.Related issues