Repository navigation
fix: [objects] categories that MISP rejects for the attribute type - #615
Merged
Merged
Conversation
Member
|
Thank you! |
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.
Seven attributes in five templates list only categories that MISP core does not allow for their attribute type.
The object form builds the Category dropdown from the template's list alone (object_add_attributes.ctp#L48-L50). The attribute then fails validation because its type is not in the chosen category (MispAttribute.php#L1001-L1008, table at L4229-L4306), and
ObjectsController::addrefuses the whole object (L219-L234). So the object cannot be saved from the form while that row has a value. Incytomic-orion-machinethis hitsmachineName, the only required attribute, so as I read it that object cannot be created from the form at all.This only affects the web form, or a client that sends the template's category as is. PyMISP drops a category that does not fit the type and falls back to the type default (mispevent.py#L590-L596), and a REST call without
categorygets the type default from core (MispAttribute.php#L913-L915).categoriesnowmachineName(target-machine)clientName(target-org)fileName(filename)hash-sha512(sha512)timestamp(datetime)threat-score(integer)ip-range-score(float)Where core allows a single category, I set it. Where it allows several (
filename,sha512) I removed thecategorieskey instead of picking one: MISP then offers every valid category and preselects the type default (MispObject.php#L1010-L1019), which is what most attributes in this repository already rely on. Each touched template'sversiongoes up by one.Scope: the category/type table was parsed out of
MispAttribute.phpat d66fb5c and all 506 templates were checked against it. These seven are the only attributes where every listed category is invalid. Not touched: 18portattributes that list "Network activity" (valid) and "External analysis" (not valid forport); the form still works for them.Checked: the five files are byte-identical to the output of
jq -S -j .(jq 1.7.1), they validate againstschema_objects.json, and UUIDs are unchanged. Not tested on a MISP instance: the behaviour above is from reading the code linked.Prepared with Claude Code (AI-assisted).
🤖 Generated with Claude Code