Skip to main content
jhimanshu
Staff
Staff
July 15, 2026

Troubleshooting Tip: How to fix code snippet action failure

  • July 15, 2026
  • 0 replies
  • 31 views

Description

This article describes the steps to overcome failures for the code snippet connector action due to the following error:

'This connector restricts certain modules: cPickle, ctypes, glob, http, imp, importlib, inspect, io, marshal, multiprocessing, os, pathlib, pickle, shelve, shutil, socket, subprocess, sys, tempfile. Remove these imports from the code and retry.'

Scope

FortiSOAR.

Solution

These modules have been restricted in newer versions of the code-snippet connector as a security enhancement, as they could be leveraged to manipulate application resources, execute unauthorized operations, access sensitive data, or otherwise impact the security and integrity of the application.

If it is required to be enabled for Admin Teams:

  1. Take a backup of the existing file using the following:


sudo cp -a /opt/cyops/configs/integrations/connectors/code-snippet_2_2_1/constants.py /opt/cyops/configs/integrations/connectors/code-snippet_2_2_1/constants.py_bkp


  1. Edit the file using:


sudo vi /opt/cyops/configs/integrations/connectors/code-snippet_2_2_1/constants.py


  1. Comment on the modules that need to be allowed from the PERMANENTLY_BLACKLISTED_MODULES dictionary, save the file using 'ESC' followed by ':wq' and execute the following:


sudo rm -rvf /opt/cyops/configs/integrations/connectors/code-snippet_2_2_1/__pycache__ 
sudo systemctl restart uwsgi


Use this to limit access to these modules across users. The instance can be configured with a private configuration. 

Related documents:

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!