Skip to content

fix: [event_delegation] Add serde renames for Org/RequesterOrg fields - #11

Draft
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/delegation-renames
Draft

elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/delegation-renames

Conversation

@elhoim

@elhoim elhoim commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

BLUF — MispEventDelegation lacked serde renames, so Org and RequesterOrg deserialized to None.

  • Problem — MISP's EventDelegation.php $belongsTo aliases the organisations as Org and RequesterOrg, but the org/requester_org fields in src/models/event_delegation.rs matched only lowercase keys and silently deserialized to None.
  • Fix — Adds #[serde(rename = "Org")] and #[serde(rename = "RequesterOrg")] to the two fields, plus a deserialization test asserting both populate from capitalized MISP-shaped JSON.
  • Effect — Delegation records carry the delegating and requesting organisations instead of dropping them.
  • CI — Red from a known repo CI bug (an ubuntu-22.04 runner with no php8.3 mod_php, plus a publish-worker race in test_event_crud_lifecycle), fixed in PR fix: [ci] Run integration tests on ubuntu-24.04 to match php8.3 #53 and unrelated to this PR.

Finding

org/requester_org lack rename to Org/RequesterOrg
MISP EventDelegation.php $belongsTo uses 'Org' and 'RequesterOrg'; both fields silently deserialize to None.

Change

MISP's EventDelegation.php $belongsTo declares aliases 'Org' and 'RequesterOrg', so API responses nest organisation details under capitalized keys. MispEventDelegation's org/requester_org fields lacked serde renames and matched only lowercase keys, so they silently deserialized to None. Added #[serde(rename = "Org")] and #[serde(rename = "RequesterOrg")] to the two fields, and added a new deserialization test asserting both fields populate correctly from capitalized MISP-shaped JSON.

Upstream evidence

MISP core app/Model/EventDelegation.php:21-30 — public $belongsTo = array('Event', 'Org' => array('className' => 'Organisation'), 'RequesterOrg' => array('className' => 'Organisation'), 'SharingGroup');

Verified against MISP core 843b6744 and PyMISP e7debb4f.

Tests

  • event_delegation_deserialize_org_fields

Caveats

Minimal, self-contained field-level serde fix; no dependency on other findings.


Verified locally: cargo fmt --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --all-features --lib, --test integration_tests --no-run, and cargo check --examples, each in an isolated target directory.

🤖 Generated with Claude Code

MISP's EventDelegation model declares $belongsTo with the aliases 'Org'
and 'RequesterOrg' (app/Model/EventDelegation.php:21-30, pinned
843b6744), so the API response nests the related organisation objects
under the capitalized keys "Org" and "RequesterOrg". MispEventDelegation
was deserializing the lowercase "org"/"requester_org" keys, which never
match, so both fields silently deserialized to None on every real MISP
response.

Added #[serde(rename = "Org")] and #[serde(rename = "RequesterOrg")]
to the org and requester_org fields, and added a deserialization test
covering the capitalized keys.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JoSButbVaWEtGMXwTx73BZ
@elhoim
elhoim marked this pull request as draft September 3, 2026 05:05
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.

1 participant