Repository navigation
Conversation
MispEvent.protected was the only bool-shaped field not using flexible_bool/flexible_bool_opt, even though the MISP Event model (app/Model/Event.php:176) declares it as a plain boolean column alongside published, locked, proposal_email_lock, and disable_correlation — all of which the API serializes as 0/1 or "0"/"1" the same way it does for the other flags. Because `protected` was a bare `Option<bool>`, a response containing "protected": 0 or "protected": "0" failed to deserialize, taking down parsing of the entire event. Applied the existing `flexible_bool_opt` helper (already used nowhere else in event.rs, but present in serde_helpers.rs, mirroring flexible_bool for Option<bool> fields) to `protected`, matching every sibling flag. Added event_protected_accepts_flexible_bool_variants, which fails on main (numeric/string 0 previously errored) and passes after the fix, covering 0, "0", 1, "1", true, and the missing case. 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 — A numeric
protectedflag from MISP fails deserialization of the whole event.MispEvent.protectedinsrc/models/event.rswas a bareOption<bool>, the only bool-shaped field not using theflexible_boolhelpers; MISP emits boolean columns as0/"0", so"protected": 0breaks deserialization of the entire event.flexible_bool_optmodule fromserde_helpers.rstoprotected, matchingpublished,locked,proposal_email_lockanddisable_correlation, with a test covering0,"0",1,"1",trueand absent.protectedflag parse instead of failing outright.test_event_crud_lifecycleraced the publish worker), fixed in PR fix: [ci] Run integration tests on ubuntu-24.04 to match php8.3 #53 and unrelated to this PR.Finding
protected is the only MispEvent bool without flexible_bool
Every sibling flag uses flexible_bool because MISP emits 0/"0". If MISP returns "protected": 0, deserialization of the entire event fails.
Change
Confirmed MispEvent.protected (src/models/event.rs) was the only bool-shaped field using a bare
Option<bool>instead of the flexible_bool helper family used by published/locked/proposal_email_lock/disable_correlation. Applied the existing flexible_bool_opt module (already defined in serde_helpers.rs for Option fields) to protected, and added a test that deserializes protected from 0, "0", 1, "1", true, and absent, which fails on main for the numeric/string-zero cases and passes after the fix.Upstream evidence
MISP core app/Model/Event.php:176 lists 'protected' as a plain field alongside published/locked/etc. in the Event model's schema-derived field list (also referenced at lines 3187, 5370, 5764), confirming MISP treats it as the same boolean-column type as the other flags that are already wrapped in flexible_bool in event.rs (published at line ~57, locked/proposal_email_lock/disable_correlation nearby) — MISP's CakePHP/MySQL boolean columns serialize as 0/1 or "0"/"1" over the API the same way for every such field, so protected needed the identical treatment.
Verified against MISP core
843b6744and PyMISPe7debb4f.Tests
event_protected_accepts_flexible_bool_variants (src/models/event.rs)Verified 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