Repository navigation
Conversation
The Content-handling arm matched both Event::Start and Event::Empty and set in_content = true for either. quick-xml never emits a matching Event::End for a self-closed element, so a self-closed <Content/> left in_content stuck true with no corresponding reset. The next Text node encountered anywhere in the document (e.g. unrelated whitespace/text inside the same IndicatorItem) was then attributed to the stale current_search, fabricating a bogus MISP attribute from non-IOC text. Fix: only arm in_content on a real Event::Start for Content; an Event::Empty Content contributes no text and should not open the flag. This is local OpenIOC XML parsing logic with no MISP REST wire format involved, so no upstream controller/PyMISP citation applies. Added openioc_self_closed_content_does_not_leak_into_next_text, which fails before this fix (asserts len 1, previously got 2 with a bogus "leaked-non-ioc-text" md5 attribute) and passes after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JoSButbVaWEtGMXwTx73BZ
elhoim
marked this pull request as draft
September 3, 2026 05:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF — Stop a self-closed
<Content/>from leavingin_contentset and fabricating a bogus IOC attribute.load_openioc, the Content arm matchedEvent::Start(e) | Event::Empty(e)and always setin_content = true, but quick-xml emits noEvent::Endfor a self-closed element, so the flag stuck.in_contentis set only when it is anEvent::Start; a self-closed Content element is a no-op, as it carries no text.<Content/>is no longer attributed to the stalecurrent_search, so imports stop inventing attributes.ubuntu-22.04(no php8.3 mod_php) andtest_event_crud_lifecycleraced the publish worker; both fixed in PR fix: [ci] Run integration tests on ubuntu-24.04 to match php8.3 #53.Finding
self-closed leaves in_content stuck true
The Content arm fires for Event::Empty too, so there is no matching End to clear the flag; the next unrelated Text node is attributed to the stale current_search, fabricating a bogus IOC.
Change
The Content-handling arm in load_openioc matched Event::Start(e) | Event::Empty(e) and unconditionally set in_content = true. quick-xml never emits a corresponding Event::End for a self-closed element (Event::Empty), so a self-closed left in_content stuck true. The next Text node parsed anywhere afterward (whitespace, stray text, or a subsequent unrelated element's text) got attributed to the still-set current_search, fabricating a bogus MISP attribute. Fixed by binding the matched event with
ref ev @ (...)and only setting in_content=true whenmatches!(ev, Event::Start(_))is true, leaving Event::Empty Content as a no-op (correct, since it has no text content and no End to clear a flag).Upstream evidence
Not applicable — this is local OpenIOC XML parsing logic (src/tools/openioc.rs) with no MISP REST controller or PyMISP wire-protocol dependency; the bug is purely a quick-xml Event::Start/Event::Empty/Event::End state-machine defect, verifiable directly from quick-xml's documented event model (Event::Empty has no paired Event::End) rather than from the MISP/PyMISP pinned checkouts.
Verified against MISP core
843b6744and PyMISPe7debb4f.Tests
openioc_self_closed_content_does_not_leak_into_next_textVerified locally:
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --all-features --lib,--test integration_tests --no-run, andcargo check --examples, each in an isolated target directory.🤖 Generated with Claude Code