<filters:filter-by-ip regex="127.0.0.1"/>
Migrating the Security Filters
Standard Support for Mule 4.1 ended on November 2, 2020, and this version of Mule reached its End of Life on November 2, 2022, when Extended Support ended. Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted. MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements. |
In Mule 3, the Security Filters where part of the Mule Module Security. In Mule 4, this where migrated to the Mule Validation Module.
IP filters
In mule 3 we had three different options to filter by IP:
* <filters:filter-by-ip>
* <filters:filter-by-ip-range>
* <filters:filter-by-ip-range-cidr>
Filtering By one IP
This will filter those IPs that matches the regex. In mule4:
<validation:is-blacklisted-ip blacklist="iplist" ip="#[vars.ip]">
<validation:ip-filter-list>
<validation:ips>
<validation:ip value="127.0.0.1"/>
</validation:ips>
</validation:ip-filter-list>
Where is necessary to set that ip
variable (or whichever variable suits).
Filtering by range of IPs
In mule 3, we had two ways of defining subnet mask to filter with:
<filters:filter-by-ip-range net="127.0.0.1" mask="255.255.255.0"/>
<!-- or -->
<filters:filter-by-ip-range-cidr cidr="127.0.0.1/24"/>
Both are replaced by:
<validation:is-blacklisted-ip blacklist="iplist" ip="#[vars.ip]">
<validation:ip-filter-list>
<validation:ips>
<validation:ip value="127.0.0.1/24"/>
</validation:ips>
</validation:ip-filter-list>
Where is necessary to set that ip
variable (or whichever variable suits).
-
Are there other similar validations added in mule 4?
Yes, there is also a WhiteList validation, which only allows IPs from a IP Filter List.
Time Expiration Filters
In mule 3 we could filter the message if it had elapsed some defined time from a starting date. For example:
<filters:filter-expired dateTime="#[vars.startingTime]" expiresIn="1000"/>
In Mule 4, this validation is in the validations module:
<validation:is-not-elapsed time="1" timeUnit="SECONDS" since="#[vars.startingTime]"/>
-
Are there other similar validations added in mule 4?
Yes, there is also a Time Elapsed validation, which validates if the time elapsed has exceeded a certain amount of time.