Network List interface

The Azion.networkList.contains() interface can be used by edge functions on Edge Firewall to match an IP address against a specific network list. If the IP address informed is within the network list, it returns true and the desired implementation logic can go on based on that information.


Azion.networkList.contains(networklistID, ipAddress)

ParameterTypeDescription
networkListIdstringThe ID of the network list to be used for matching.
ipAddressstringThe IP address to be matched against the network list.

Note: if the network list ID informed is incorrect, an error is thrown.

Find out more about Network Lists on the Azion Platform.


bool: returns true if the IP address is in the network list and false if it’s not.


Basic usage of Azion.networkList.contains() with a specific IP address and network list ID:

addEventListener("firewall", (event) => {
let ip = event.request.metadata["remote_addr"] // Accessing the remote address
try {
let found = Azion.networkList.contains(String(networkListId), ip); // Checking if the ip is in the list
if (!found) {
event.continue(); // If it's not in the list, accept the request
return;
}
} catch (err) {
event.console.error(`Error: `, err.stack);
}
event.deny();
});

If an error occurs during the execution of Azion.networkList.contains(), an exception may be thrown. Make sure to handle potential errors and provide appropriate error messages or fallback actions in your code.


  • Regularly update and maintain the network lists to ensure accurate matching and minimize false positives or false negatives.
  • Combine network list matching with other security measures for comprehensive protection.
  • Ensure the integrity and security of the network lists to prevent unauthorized modifications or access.
  • Regularly review and update the network list configurations to address changing security threats and requirements.

Contributors