Safeguard
Developer Tools•

JetBrains IDE trusted projects and Safe Mode explained

When IntelliJ based IDEs ask whether to trust a project, Safe Mode limits builds and scripts. See what it blocks and how Trusted Locations work.

Safeguard Security Team
3 min read

When you open an unknown project in a JetBrains IDE, the Trust Project dialog offers Preview in Safe Mode, Trust Project, or Don't Open. Safe Mode lets you browse sources while build imports, startup tasks, version control support and some scripts are disabled, so project code cannot run at open time.

The three choices

Per the JetBrains documentation for IntelliJ IDEA:

  • Preview in Safe Mode lets you browse with code execution, build activity and scripts restricted. A notice above the editor lets you trust the project later.
  • Trust Project fully initialises the project, resolves its plugins and dependencies, and enables all features.
  • Don't Open cancels the action.

What Safe Mode restricts

  • Gradle, Maven and sbt imports are disabled, so build scripts do not run and dependencies are not resolved.
  • Startup tasks are disabled.
  • VCS support is fully disabled.
  • Groovy DSL scripts do not run.
  • File Watcher scripts do not trigger their tools.

Build scripts are real programs. A Gradle or Maven build can run arbitrary code, which is why importing a project is the risky moment, not reading files.

Trusting later

Click the Trust project link in the editor notice, or press double Shift and search for Trust project.

Trusted Locations

Under Settings, Appearance and Behavior, Trusted Locations, you can add directories. Projects opened from those directories load automatically as trusted. The checkbox Trust all projects in, in the Trust dialog, adds a folder to that list.

Be careful here. The documentation notes that adding your home directory suppresses untrusted project warnings. That removes the protection for every project you ever clone under it. Prefer a specific directory for code you wrote or control.

Headless instances started from the command line launcher open projects in trusted mode by default, so be thoughtful about automation that opens projects with the IDE.

A habit that works

  1. Open third party code in Safe Mode.
  2. Read the build files (build.gradle, pom.xml, wrapper scripts) first.
  3. Trust only when you understand what the build will run.
  4. Keep Trusted Locations narrow.

This mirrors what VS Code does. See VS Code Workspace Trust for the equivalent.

Why build tools are the real risk

A Gradle build file is a program. So is a Maven plugin configuration that pulls in a plugin to run during import. Opening the project and letting the IDE import it runs that code on your machine, often before you have read a line. This is why the IDE's trust dialog appears at import time and why Safe Mode disables imports and startup tasks.

For teams

Agree on a rule: third party code opens in Safe Mode, internal repositories live under a Trusted Location. Document the location so new starters do not add their home directory out of convenience. If you use automation that launches the IDE headlessly, remember it opens projects as trusted by default and keep it away from untrusted code.

Quick check

Can I read code in Safe Mode?

Yes. Safe Mode is for browsing sources with execution restricted.

Is it fine to add my home directory to Trusted Locations?

It suppresses warnings for every project beneath it, so it is better to add narrow folders you control.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.