Repository navigation
Conversation
enrich_attribute() posted to attributes/enrichAttribute/{id}, which is not an
action on AttributesController -- MISP defines enrich($id) (app/Controller/
AttributesController.php:3717). Every call was a MissingAction.
Both AttributesController::enrich() and EventsController::enrichEvent() read the
posted data as $module => $enabled pairs, so the body must be a map of module
name to true. The previous {"modules": [...]} body meant enrich_event(), whose
path was already correct, requested a single module literally named "modules".
PyMISP posts to /attributes/enrich/{id} with {module_name: True} (api.py:1164).
Adds wiremock coverage asserting both the path and the body shape; there was no
test for enrich_attribute before.
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:05
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 — Enrichment now hits
attributes/enrich/{id}and sends the module map MISP actually reads.enrich_attributeinsrc/client.rsposted toattributes/enrichAttribute/{id}, not an action onAttributesController(MISP definesenrich($id)), so every call was aMissingAction. Both also sent{"modules": [...]}where MISP readsmodule => enabledpairs, soenrich_eventasked for a module namedmodules.enrich_attributeand builds both bodies via a sharedenrichment_body()helper emitting{module: true}.enrich_attributeever had.ubuntu-22.04runner lacks php8.3mod_php;test_event_crud_lifecycleraces the publish worker), fixed in unmerged PR fix: [ci] Run integration tests on ubuntu-24.04 to match php8.3 #53 and unrelated to this change.Finding
enrich_attribute()posted toattributes/enrichAttribute/{id}. That is not an action onAttributesController— MISP definesenrich($id)(app/Controller/AttributesController.php:3717). Every call was a MissingAction.While fixing the path I found the request body is wrong too, on both enrichment methods:
MISP reads the posted data as
$module => $enabledpairs, so the body must be a map of module name totrue.EventsController::enrichEvent()does the same (wrapping in anEventkey if absent). The previous{"modules": [...]}body therefore meantenrich_event()— whose path was already correct — requested a single module literally named"modules", with the array as its truthy "enabled" value. Soenrich_eventwas silently broken as well, which is why it is included here.PyMISP agrees on both points:
POST /attributes/enrich/{id}with{module_name: True}(pymisp/api.py:1164).Change
enrich_attribute→attributes/enrich/{id}enrichment_body()helper emitting{module: true}Tests
There was no test for
enrich_attributeat all. Adds three:enrich_attribute_uses_misp_path_and_module_map_body— asserts the path and the body viabody_jsonenrich_event_sends_module_map_body— asserts the corrected body on the already-correct pathenrichment_body_is_a_module_map— unit test on the helper, including theNonecaseVerified locally:
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --all-features --lib(370 passed) all clean, plus--test integration_tests --no-runandcargo check --examples.Verified against MISP core
843b6744and PyMISPe7debb4f.🤖 Generated with Claude Code