What the security level does in ComfyUI
ComfyUI's security level controls how strictly the software restricts what code can run when you load a workflow or custom node. The setting sits in your startup command and determines whether ComfyUI will execute Python scripts from external sources, block certain operations, or run everything without restriction. Most people start with a default level and never change it, but if you are installing custom nodes, running workflows from other users, or working in an environment where you need tighter control, you will need to adjust this setting.
The security level is not something you change inside the ComfyUI interface itself — it is a command-line argument you pass when you start the software. This means you either add it to a startup script, a batch file, or a shell command, depending on your operating system.
Key Takeaways
- ComfyUI security level is set via a command-line argument when you start the software, not through a menu or settings panel.
- The three main levels are normal (default, allows most operations), strict (blocks potentially unsafe code), and relaxed (allows everything without checks).
- If you use custom nodes from trusted sources, normal level is usually sufficient and safer than relaxed.
- Changing the security level requires editing your startup script or command and restarting ComfyUI.
Finding your startup command or script
Before you can change the security level, you need to locate how ComfyUI starts on your machine. Most installations use one of three methods: a batch file on Windows, a shell script on Mac or Linux, or a direct command you type into a terminal.
On Windows, look for a file named run_cpu.bat, run_nvidia.bat, or run_amd.bat in your ComfyUI folder — the exact name depends on your graphics card. On Mac or Linux, look for run_cpu.sh or a similar shell script. If you start ComfyUI by typing a command directly into a terminal, you will be editing that command instead of a file.
Open the file with a text editor like Notepad (Windows), TextEdit (Mac), or any plain-text editor. Do not use Word or a rich-text editor — the file must remain plain text. Once open, you will see a line that starts with python followed by a filename like main.py. This is the line you will modify.
Adding the security level argument to your startup command
At the end of the line that starts with python, add a space and then type --security-level followed by the level you want. The three standard levels are normal (the default), strict (more restrictive), and relaxed (least restrictive).
An example: if your original line reads python main.py, it becomes python main.py --security-level normal. If you want strict mode, it becomes python main.py --security-level strict. Save the file after making the change — use Ctrl+S on Windows or Linux, or Command+S on Mac.
If you start ComfyUI by typing a command in a terminal, add the same argument to the end of your command before you press Enter. The next time you run that command, the new security level takes effect.
Understanding the three security levels
Normal is the default level and the one most users should stay on. It allows custom nodes and workflows to run, but blocks operations that could directly access your file system or run arbitrary system commands without explicit permission. This is a reasonable middle ground if you are using custom nodes from known sources or the ComfyUI community.
Strict mode is more cautious. It blocks more types of operations and may prevent some custom nodes from working if they rely on file system access or system calls. Use strict mode if you are running workflows from untrusted sources or if you want maximum protection. Be aware that some legitimate custom nodes may not function in strict mode, and you may need to switch back to normal to use them.
Relaxed mode removes most restrictions and allows code to run with minimal checks. This is the least find option and should only be used if you are working in a completely isolated environment or if you trust everything running on your machine. Do not use relaxed mode if you are downloading workflows or nodes from the internet.
Restarting ComfyUI after the change
After you save your startup script or command with the new security level, you must close ComfyUI completely and start it again. If ComfyUI is running in a terminal window, close that window. If it is running as a background process, stop it through your system's task manager or process list.
Once it is fully closed, run your startup script or command again. ComfyUI will start with the new security level. You can verify the change took effect by looking at the terminal output when ComfyUI starts — it will usually print the security level it is running with.
What to do if a custom node stops working after changing security level
If you switched to strict mode and a custom node no longer works, the node likely requires file system or system-level access that strict mode blocks. You have two options: switch back to normal mode, or contact the node creator to ask if they can modify the node to work within strict mode constraints.
If you need strict mode for security reasons but want to use a specific node, you can also run two instances of ComfyUI — one in strict mode for untrusted workflows and one in normal mode for trusted custom nodes. This requires more system resources but gives you flexibility.
Frequently Asked Questions
What is the default security level if I do not set one?
The default is normal level. ComfyUI will run with normal security restrictions unless you explicitly add the --security-level argument to your startup command. You do not need to do anything if normal level is what you want.
Can I change the security level without editing a file?
No. The security level must be set via command-line argument when ComfyUI starts. There is no menu or settings panel inside the software to change it. You must edit your startup script or command and restart.
Will changing security level affect my existing workflows?
Existing workflows will usually continue to work, but custom nodes may behave differently depending on the level. A workflow that runs in normal mode might fail in strict mode if it uses nodes that require restricted operations. Test your workflows after changing the level.
Is strict mode worth using if I only read from trusted sources?
Probably not. If you trust your sources and keep ComfyUI updated, normal mode is find enough for most users. Strict mode adds protection but also limits functionality. Use it only if you are running untrusted code or if you work in a high-security environment.
What happens if I type the security level argument wrong?
ComfyUI will either ignore the incorrect argument and run with the default level, or it will display an error message telling you the argument is not recognized. Check your spelling and make sure there is a space between --security-level and the level name (normal, strict, or relaxed).