# 6.3.1 Ensure the 'external scripts enabled' Database Flag for Cloud SQL SQL Server Instance Is Set to 'off' (Automated)

- Source: https://support.icompaas.com/support/solutions/articles/62000233040-6-3-1-ensure-the-external-scripts-enabled-database-flag-for-cloud-sql-sql-server-instance-is-set-to
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [GCP Benchmarks](https://support.icompaas.com/support/solutions/62000112667) › [GCP Knowledge Bases](https://support.icompaas.com/support/solutions/folders/62000169178)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

#### Profile Applicability:

-   Level 1

Description:

The external scripts enabled flag allows execution of external scripts, such as those using R or Python. This functionality, though useful in some scenarios, introduces potential security vulnerabilities. It is recommended to disable this flag unless explicitly required.

Rationale:

Disabling the external scripts enabled flag prevents the execution of scripts that could adversely impact the security of the system by accessing external libraries or files. This reduces the risk of unauthorized access or exploitation through external scripting features.

Impact:

-   Disabling this flag might restrict certain advanced analytics or machine learning tasks that depend on external scripts.
    
-   Applying this change via CLI will overwrite previously set flags unless re-applied during configuration.
    
-   The instance will require a restart to apply the updated configuration.
    

Default Value:

By default, the external scripts enabled flag is set to off.

Audit Steps:

##### Using Google Cloud Console:

1.  Navigate to the [Cloud SQL Instances](https://console.cloud.google.com/sql/instances) page.
    

                     ![](https://support.icompaas.com/assets/kb/b5aa7a9500985e67.png)

2.  Select the SQL Server instance.
    

       ![](https://support.icompaas.com/assets/kb/3a860f6c97478997.png)

3.  Verify under the Flags section that the external scripts enabled flag is set to off.
    

              ![](https://support.icompaas.com/assets/kb/7fd84bae146a1595.png)

##### Using Google Cloud CLI:

Run the following command:

gcloud sql instances describe \[INSTANCE\_NAME\] --format=json | jq '.settings.databaseFlags\[\] | select(.name=="external scripts enabled")|.value'

1.  Confirm that the returned value is off.
    

Remediation Steps:

##### Using Google Cloud Console:

1.  Navigate to [Cloud SQL Instances](https://console.cloud.google.com/sql/instances).
    

              ![](https://support.icompaas.com/assets/kb/f7cbca8698c63439.png)

2.  Select the SQL Server instance to edit.
    

        ![](https://support.icompaas.com/assets/kb/df8735c67f604a8a.png)

3.  Click Edit.
    

       ![](https://support.icompaas.com/assets/kb/205cb045c443f262.png)

4.  Scroll down to the Flags section.
    

        ![](https://support.icompaas.com/assets/kb/33d16b8f572a8202.png)

5.  Add or modify the external scripts enabled flag to set its value to off.
    

         ![](https://support.icompaas.com/assets/kb/9a01e07bd818a634.png)

6.  Click Save to apply changes.
    

          ![](https://support.icompaas.com/assets/kb/26623f9b778315c9.png)

7.  Restart the instance to activate the updated configuration.
    

         ![](https://support.icompaas.com/assets/kb/52264ff0622ef5ea.png)

##### Using Google Cloud CLI:

Run the following command:

gcloud sql instances patch \[INSTANCE\_NAME\] --database-flags "external scripts enabled"=off

1.  Restart the instance for the changes to take effect.
    

## Backout Plan:

Step 1: Restore the external scripts enabled Flag If Needed

If disabling external scripts enabled breaks business-critical functionality, restore the flag:

gcloud sql instances patch <INSTANCE\_NAME> --database-flags "external scripts enabled=on"

Restart the instance to apply changes

gcloud sql instances restart <INSTANCE\_NAME>

Step 2: Notify Security Teams

-   Inform database security teams before making script execution changes.
    

Step 3: Restore from Backup (If Necessary)

-   If modifying external scripts enabled causes failures, restore the SQL instance from a backup.
    

Step 4: Validate Rollback Success

-   Run the audit steps again to confirm that the intended external scripts enabled setting is applied.

References:

1.  [Microsoft SQL Server: External Scripts Enabled Documentation](https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/external-scripts-enabled-server-configuration-option)
    
2.  [Cloud SQL Flags for SQL Server](https://cloud.google.com/sql/docs/sqlserver/flags)
    
3.  [Microsoft SQL Server Security Concepts](https://docs.microsoft.com/en-us/sql/advanced-analytics/concepts/security)
    
4.  [Microsoft Tutorial on Signed Stored Procedures](https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-signed-stored-procedure)
    

Additional Information:

-   Both flags (external scripts enabled and cross db ownership chaining) require a restart of the SQL Server instance for the changes to take effect.
    
-   Setting these flags improves the overall security posture of SQL Server instances by mitigating risks associated with unnecessary or outdated features.
    

CIS Controls:

####   

<table style="border:none;border-collapse:collapse;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><colgroup style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"></colgroup><tbody style="font-family:&quot;Helvetica Neue&quot;"><tr style="height:40pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">Control</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">Description</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 1</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 2</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:center;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:700;font-family:&quot;Helvetica Neue&quot;">IG 3</span></span></span></p></td></tr><tr style="height:40pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">2.7 Allowlist Authorized Scripts</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">Allow only authorized and signed scripts to execute.</span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></strong></span></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></strong></span></td></tr><tr style="height:40pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">2.9 Application Whitelisting</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">Ensure application whitelisting restricts unauthorized scripts from executing.</span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">✅</span></span></strong></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></strong></span></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><strong><span style="font-family:Helvetica Neue"><br style="font-family:&quot;Helvetica Neue&quot;"></span></strong></span></td></tr></tbody></table>

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
