Skip to content

fix: [objects] categories that MISP rejects for the attribute type - #615

Merged
adulau merged 1 commit into
MISP:mainfrom
GTosetti:fix-invalid-categories
Nov 30, 2026
Merged

adulau merged 1 commit into
MISP:mainfrom
GTosetti:fix-invalid-categories

Conversation

@GTosetti

Copy link
Copy Markdown
Contributor

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::add refuses the whole object (L219-L234). So the object cannot be saved from the form while that row has a value. In cytomic-orion-machine this hits machineName, 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 category gets the type default from core (MispAttribute.php#L913-L915).

Template Attribute (type) categories now Valid for the type in core Change
cytomic-orion-machine machineName (target-machine) Other Targeting data Targeting data
cytomic-orion-machine clientName (target-org) Other Targeting data Targeting data
cytomic-orion-file fileName (filename) Other Payload delivery, Artifacts dropped, Payload installation, Persistence mechanism, External analysis key removed
trusted-timestamp hash-sha512 (sha512) External analysis Payload delivery, Artifacts dropped, Payload installation key removed
trusted-timestamp timestamp (datetime) External analysis Other Other
google-threat-intelligence-report threat-score (integer) External analysis Other Other
crowdsec-ip-context ip-range-score (float) Network activity, External analysis Other Other

Where core allows a single category, I set it. Where it allows several (filename, sha512) I removed the categories key 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's version goes up by one.

Scope: the category/type table was parsed out of MispAttribute.php at d66fb5c and all 506 templates were checked against it. These seven are the only attributes where every listed category is invalid. Not touched: 18 port attributes that list "Network activity" (valid) and "External analysis" (not valid for port); 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 against schema_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

@adulau
adulau merged commit 3ace84c into MISP:main Nov 30, 2026
6 checks passed
@adulau

adulau commented Nov 30, 2026

Copy link
Copy Markdown
Member

Thank you!

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.

2 participants