Repository navigation
Conversation
search_index() posted SearchParameters::to_json() straight to events/index, which sends restSearch-shaped `from`/`to` keys. The events/index CakePHP action only recognizes `datefrom`/`dateuntil` (EventsController.php:37, 333, 339), so date filters were silently dropped. PyMISP's search_index() explicitly pops `date_from`/`date_to` and reinserts them as `datefrom`/ `dateuntil` before posting to events/index (pymisp/api.py:3214-3217). Rename `from`->`datefrom` and `to`->`dateuntil` in the request body built for the events/index POST, matching PyMISP's behavior. Added a wiremock test asserting the exact renamed request body; it fails against the old code (wrong keys -> no matching mock -> 404) and passes after the fix. 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 —
search_indexposts restSearch-shaped date keys toevents/index, which drops them.search_index()insrc/client.rspostedSearchParameters::to_json()verbatim, sendingfrom/to, butEventsController's index action only recognizesdatefrom/dateuntil, so date filters were silently discarded.fromtodatefromandtotodateuntilin the JSON body immediately before theevents/indexPOST, mirroring PyMISP's explicit rename, with a wiremock testsearch_index_renames_date_keys_for_events_indexasserting the exact body.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
search_index sends restSearch-shaped date keys to events/index
events/index expects datefrom/dateuntil; PyMISP explicitly renames date_from->datefrom and date_to->dateuntil. Date filters are silently dropped.
Change
search_index() posted SearchParameters::to_json() (restSearch-shaped
from/tokeys) directly to events/index, but MISP's events/index action only recognizesdatefrom/dateuntil, so date filters were silently dropped. Fixed by renamingfrom->datefromandto->dateuntilin the JSON body immediately before the events/index POST in search_index, mirroring PyMISP's explicit rename. Added a wiremock test that asserts the exact renamed request body via body_json.Upstream evidence
pymisp/pymisp/api.py:3214-3217 (search_index pops 'date_from'/'date_to' and reinserts as 'datefrom'/'dateuntil' before posting to events/index, contrasted with search() at api.py:3027-3028 which uses 'from'/'to' for restSearch); misp/app/Controller/EventsController.php:37,333,339,719 (events/index action recognizes 'datefrom'/'dateuntil', not 'from'/'to').
Verified against MISP core
843b6744and PyMISPe7debb4f.Tests
search_index_renames_date_keys_for_events_indexCaveats
cargo test could not be run per task constraints (serialized/shared target dir); fail-before-fix reasoning is by inspection: pre-fix body is {"from":...,"to":...}, which would not satisfy the test's exact body_json({"datefrom":...,"dateuntil":...}) matcher, so wiremock returns no match (404) and the test fails; post-fix the body matches exactly since only the two date fields are set on the SearchParameters used in the test. SearchParameters is a general restSearch-shaped struct reused across
search()andsearch_index(); only the date_from/date_to mapping was audited/fixed for the events/index path — other events/index-specific quirks, if any, are out of scope for this minimal fix.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