Skip to content

Nested aliases are not being allowed with PUT /api/v2/firewall/aliases #619

@jaredhendrickson13

Description

@jaredhendrickson13

Describe the bug

When replacing all firewall aliases using PUT /api/v2/firewall/aliases, nested aliases are not being allowed even when the referenced alias was validated and set in the config earlier in the call.

To Reproduce

Run curl -s -k -u admin:pfsense -X PUT https://localhost/api/v2/firewall/aliases -H "content-type: application/json" -d '[{"name": "test_alias_1", "type": "host", "address": []}, {"name": "test_alias_2", "type": "host", "address": ["test_alias_1"]}]'

Expected behavior

Nested aliases should be allowed.

Screenshots or Response

If applicable, add screenshots or response data to help explain your problem.

pfSense Version & Package Version:

  • pfSense Version: CE 2.7.2
  • Package Version v2.2.2

Affected Endpoints:

  • PUT /api/v2/firewall/aliases

Additional context

This seems to be caused by the pfSense is_ipaddroralias and is_port_or_range_or_alias functions not fetching changes to the configuration between each validation. We should either force a config reload between objects or use a different method to determine if a nested alias is being used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    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