Review and update scripts incompatible with guarded script
Review scripts that are incompatible with guarded script and either rewrite them to use supported features or create an exemption for scripts that can't be rewritten.
Before you begin
Role required: guarded_script_admin or admin
About this task
Guarded script detects and records scripts that use unsupported JavaScript features in the Incompatible Guarded Scripts list when transactions calling those scripts are sent to the server.
- Complexity of the script logic
- Frequency of script execution
- Business criticality of the functionality
- Feasibility of rewriting using supported guarded script features
Automatic exemptions are created for incompatible scripts sent by authenticated users and detected during Phase 1: Detection and Phase 2: Syntax enforcement. To further secure your instance, you can still review any scripts that have automatic exemptions, update them to be compatible with guarded script, and then remove the exemptions. For more information about automatic exemptions, see Guarded script enforcement.
Procedure
Rewriting a script to use a script include
| Before | After |
|---|---|
The Incompatible Guarded Scripts list includes the following script because it uses a variable and conditional logic: |
Move the complex logic from the original script to a script include:Then, update the original script to use only a simple expression calling the script include so it's compatible with guarded script: |
What to do next
Monitor the Incompatible Guarded Scripts list regularly to identify any scripts that may need remediation. The list is updated when transactions calling those scripts are sent.