Summary
When a custom node icon is created for the first time, update_icon treats the BloodHound API's 201 Created response as a failure and prints an error, even though the icon was registered successfully.
Location
- File(s):
set-custom-icons.py
- Line(s) / function(s):
update_icon() at L47 (success check after the POST /api/v2/custom-nodes request)
Category
functional
Severity
low
Brief justification: Successful first-time icon registration is reported to the operator as a failure, causing confusion and potential redundant retries; the icons are nonetheless created.
Reproduction / Evidence
Verified by code analysis. The creation branch issues a POST to api/v2/custom-nodes (L27) and then checks if r.status_code == 200: (L47) to decide success. The BloodHound API returns 201 Created for a successful POST to this endpoint, so the equality check is false and the code falls through to the failure branch at L49 printing Failed to update custom icon.
Expected Behavior
A 201 Created response from the POST is treated as success and prints the success message.
Actual Behavior
A 201 Created response falls into the failure branch and prints Failed to update custom icon for <kind> (HTTP 201).
Root Cause
The POST success check accepts only HTTP 200 and not 201, which is the status the create endpoint returns.
Summary
When a custom node icon is created for the first time,
update_icontreats the BloodHound API's201 Createdresponse as a failure and prints an error, even though the icon was registered successfully.Location
set-custom-icons.pyupdate_icon()at L47 (success check after thePOST /api/v2/custom-nodesrequest)Category
functionalSeverity
lowBrief justification: Successful first-time icon registration is reported to the operator as a failure, causing confusion and potential redundant retries; the icons are nonetheless created.
Reproduction / Evidence
Verified by code analysis. The creation branch issues a
POSTtoapi/v2/custom-nodes(L27) and then checksif r.status_code == 200:(L47) to decide success. The BloodHound API returns201 Createdfor a successful POST to this endpoint, so the equality check is false and the code falls through to the failure branch at L49 printingFailed to update custom icon.Expected Behavior
A
201 Createdresponse from the POST is treated as success and prints the success message.Actual Behavior
A
201 Createdresponse falls into the failure branch and printsFailed to update custom icon for <kind> (HTTP 201).Root Cause
The POST success check accepts only HTTP 200 and not 201, which is the status the create endpoint returns.