About the Web Policy Code
You can work on the code that underlies the rules and rule sets of your web policy to create, edit, or delete any of them.
WARNING: If you modify the web policy code incorrectly, the web policy functions may fail. Make sure that you understand the code before making changes to it.
Web Policy Code View
To view the web policy code:
Login in to Secure Web Gateway with your tenant, and go to Policy > Web Policy > Policy.
The Web Policy page appears.
From the navigation panel, select the rule set for which you want to view the code. For example, select Global Block > Global Block Lists.
The selected rule set appears along with the rules in the configuration area.
Click the three dots menu next to the specific rule, then select View Policy Code.
The web policy code for the selected rule set appears.
How the Code Enables a Web Policy
The web policy code for Secure Web Gateway contains rules (IF-THEN statements) that address various web threats and serve as the framework for your web policy.
A general rule for a web threat policy might read as follows:
- If a threat from web usage is identified, take action to counter it.
A rule that addresses a specific threat (malware-infected file) might read as follows:
- If a file sent from a website in response to a user's request contains malware, block the response. This rule is represented in the web policy code by the following IF-THEN statement:
IF MWG.Body.Infected THEN MWG.Block
This code prevents a user from accessing malware-infected files using the following code items:
For more information about some important web policy code elements used by Secure Web Gateway, see List of Important Web Policy Code Elements.
When a website responds to a user's request, it sends the file as the body of the response. Secure Web Gateway scans the response body based on the rule defined in your web policy, and if the body (file) is infected, it is not sent to the user.
You can also use the following IF-THEN statements in reference to the above mentioned code items:
- If a specific function returns a value (indicating a web threat), then a suitable procedure is run.
IF function returns critical value THEN execute procedure
NOTE: Several code items are prefixed with MWG because they were created for Secure Web Gateway Cloud based on similar items from the Secure Web Gateway (formerly McAfee Web Gateway) on-premises web security product.