Skip to content

set-custom-icons.py reports successful icon creation as failure #17

Description

@p0dalirius

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions