Skip to content

REST response for empty XML elements incorrect #944

Description

@nolsen311

Describe the bug
A clear and concise description of what the bug is.

As I'm trying to modernize one of the pfsense integrations for home assistant, I've found a couple places where the rest API isn't returning correct data, relative to the existing XML api.

  1. Firewall rules - enabled - is represented as an empty xml element when disabled (e.g., . Which is returned as an empty string by the rest api.
  2. Firewall rules - statetype - also often represented as an empty xml element, and rest api may fail due to empty statetype during PATCH.

To Reproduce

  1. PATCH method to /firewall/rule endpoint with "" as statetype (rule must have default statetype; if "keepstate" seems to work properly with empty string) attempting to toggle enabled/disabled on rule.

Expected behavior
expected rule to toggle enabled/disabled

Screenshots or Response
no screenshots at this time

pfSense Version & Package Version:

  • pfSense Version: pfSense 26.07
  • Package Version v2.10.2

Affected Endpoints:

  • URL: /api/v2/firewall/rule

Additional context
Add any other context about the problem here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions