Top 7 mistakes that lead to prompt injection you must avoid
This article explains the most common engineering and security mistakes that increase prompt injection risk, and how to avoid them when building LLM-powered systems. […]
AI-assisted development and AI-native companies are becoming more and more popular, but security is not catching up. This article compares the most common AI development setups, rates their security and shows when each one makes sense.
Each AI development setup gives the agent a different level of access to your machine, code, secrets, commands and network.
The goal is not to always choose maximum security and ignore convenience. The goal is simpler: do not use a weak setup for a high-risk task.
This article reviews the setups themselves, from the least isolated to the most isolated:
This is the simplest setup and probably still the most common one.
The AI coding tool runs directly on the developer’s machine, on the normal user account, with access to the regular project folder and local terminal.
It is fast and easy. There is no container, no VM, no remote workspace and no extra configuration.
The developer installs the AI tool, opens the project and starts working.
This setup provides almost no real isolation.
The AI tool runs with the same access as the developer’s normal user account. So its security depends mostly on manual approvals, tool configuration and developer attention.
It may be acceptable only for disposable, trusted projects, where the machine has no secrets and no access to internal systems.
The main protection here is awareness, not architecture.
This is the highest-risk everyday setup because the AI tool may be close to everything the developer can access:
If the AI tool can also run commands, the local machine becomes the execution environment.
A malicious instruction, compromised dependency, unsafe script, or wrongly approved command may affect the host directly.
The agent suggests running a setup command.
The command looks like a normal dependency installation, but it downloads and executes a remote script.
Because the tool runs on the main machine, the script can access local credentials and exfiltrate them over the network.
In this setup, the AI tool still runs locally, but its permissions are restricted.
Many AI coding tools provide configuration options for hardening the environment. These may include sandboxing, tool permissions and network access controls.
For Claude Code, Composable Security covered this with a separate tool and will publish an article about secure local configuration soon – sign up to the newsletter to get informed!
This is a practical improvement over unrestricted local access.
It can work for small, trusted projects where convenience matters and the local environment does not expose secrets, other projects, or internal systems.
This setup is safer than unrestricted local access because the AI tool may be blocked from editing specific files, running specific commands, or accessing the network.
But it is still not a strong isolation boundary.
Defining strict rules and enforcing them can be tricky. In many cases, the last security layer is still the permission prompt.
A wrong approval, misconfiguration, or unsafe command may still affect the host.
The security comes from permission prompts, limited tool access and careful review – not from real separation from the operating system.
The important point: permissions are guardrails, not a strong security boundary.
This setup still depends heavily on correct permissions, sandbox configuration and careful human review. That is hard in real workflows.
AI agents can be tricked quite easily, and may ask for many approvals. Some approvals are easy to understand.
Others involve long shell commands, generated scripts, dependency changes, Dockerfiles, CI/CD updates, or package manager hooks.
A tired or rushed developer may approve something without fully understanding it.
The AI tool asks to modify package.json. The change looks like a normal script update, but it adds a command that will run later during installation or deployment.
The change is then pulled by other developers and executed in their workspaces.
At that point, it may bypass the original permissions and sandboxing entirely.
A sandboxed shell gives the AI tool a restricted command execution environment.
The goal is to allow useful commands while limiting filesystem access, network access and impact on the host.
This can be implemented with a local sandboxing tool, such as agent-safehouse on macOS.
This setup is useful for CLI-first workflows where the AI agent needs to run tests, format code, inspect logs, or execute project commands.
It is also useful when you do not want to rely only on the AI tool’s built-in security controls and want an extra layer around command execution.
A sandboxed shell can reduce the blast radius compared with direct local execution, especially when filesystem access, network access, environment variables and command permissions are restricted.
But it is not a strong isolation model by default. Its real security level depends on configuration.
If secrets are available, host directories are broadly mounted, network access is unrestricted, or system services are exposed, the practical security level can quickly fall back to low.
A sandboxed shell is only as safe as its boundaries.
The main risks are:
A badly configured sandbox can give a false sense of security.
The sandbox restricts file reads and writes to the project directory. But environment variables still contain cloud credentials.
A command inside the sandbox can read and exfiltrate them.
A sandboxed shell should follow least privilege:
A Dev Container runs the project inside a containerized development environment, usually with good IDE integration.
The editor may run locally, but project tools, terminal, dependencies and runtime execute inside the container.
For many teams, this is the best default. It gives a good balance between security, reproducibility and developer experience.
Dev Containers are especially useful when a project needs a consistent runtime, specific dependencies, local services, or onboarding automation.
They also integrate well with IDEs. For example, IDE extensions can run inside the container instead of directly on the host.
This makes it easier for teams to define a standard development environment.
A Dev Container usually gives a better security baseline than running the AI tool directly on the host.
Project commands, dependencies and runtime behavior are moved into a containerized environment, which helps limit accidental impact on the developer’s main machine.
But a Dev Container should not be treated as a strong security boundary. Its security depends on configuration.
If the container runs as root, uses privileged mode, mounts the Docker socket, exposes the developer’s home directory, or receives long-lived secrets, the isolation value drops quickly.
Use secure-by-default configuration.
A Dev Container is not automatically secure. It can become risky when it is configured to behave like the host.
Common dangerous patterns include:
The biggest mistake is treating “inside a container” as “100% secure.”
A Dev Container mounts the host’s ~/.ssh directory so Git works easily.
If the AI agent or a dependency reads that directory, private keys may be exposed.
A secure Dev Container should be intentionally limited:
A virtual machine runs a separate operating system on top of the host.
The AI tool, repository, dependencies and commands run inside the VM, not directly on the developer’s main OS.
A VM is a strong choice for untrusted code, sensitive projects, external pull requests, customer-provided repositories and security research.
It is also useful when the developer wants a clear boundary between the main machine and the AI-assisted environment.
A virtual machine provides a stronger isolation boundary than local configuration, a sandboxed shell, or a typical Dev Container.
The AI tool and the code it interacts with run inside a separate operating system. This makes it harder for a compromise to directly affect the developer’s main machine.
The host is better protected, but the risk is not gone.
If sensitive credentials, broad shared folders, clipboard access, VPN connectivity, or internal network access are available inside the VM, an attacker may still reach valuable assets.
A VM provides stronger isolation than a container, but it does not remove all risk.
Problems can still happen if:
The VM protects the host better, but the VM itself can still be compromised.
An unknown repository is opened inside a VM, which is good.
But the VM has access to the company VPN and long-lived cloud credentials, for example copied through the clipboard.
A compromise inside the VM can still reach internal systems.
Use the VM as a controlled boundary:
A remote development environment runs outside the developer’s laptop.
It may run on a cloud VM, managed workspace, Kubernetes platform, Codespaces-like service, or self-hosted development server.
The IDE may run locally, but the repository, terminal, dependencies, runtime and AI tool run remotely.
This setup is useful for teams that want central governance, standard images, consistent onboarding, disposable workspaces, and less exposure of developer laptops.
It can also help when the company wants to control source code access, logging, secrets, and network policies in one place.
A remote development environment can protect the developer’s laptop because the repository, terminal, dependencies, runtime and AI-assisted execution happen outside the local machine.
But the risk does not disappear. It moves to the remote workspace.
In some cases, the remote environment may even have more privileged access than a local developer machine.
The risk moves from the laptop to the remote environment.
A remote workspace can still be dangerous if it has:
It also introduces provider or platform trust.
If a third-party service hosts the workspace, the organization must trust that provider and configure access carefully.
A remote workspace protects the developer’s laptop. But it has access to multiple private repositories and internal deployment credentials.
A compromise may affect more systems than a local machine would.
Remote workspaces should be controlled centrally:
An ephemeral environment is created for one specific task and destroyed after the task is complete.
The AI agent receives only the repository, tools, credentials and network access needed for that task.
This is the strongest model for high-risk AI-assisted workflows.
It is especially useful for:
An ephemeral environment per task gives the strongest security model from this list.
Each task starts in a fresh, limited environment. The environment is destroyed after the task is complete.
This reduces persistence, cross-project contamination and long-term credential exposure. The blast radius can be limited to one task.
This setup is strong only if the environment receives minimal permissions, short-lived credentials and restricted network access.
Also, the output still needs review. Generated code, scripts, dependency changes and CI/CD modifications can introduce risk after they leave the isolated workspace.
This setup has the smallest blast radius, but it is more complex to build and operate.
Risks remain if:
The environment may be disposable, but its output can still be dangerous.
An ephemeral environment safely contains an external pull request. But the AI agent modifies a build script and opens a merge request.
If the change is merged without review, the malicious behavior can still reach CI/CD or other developers.
This setup should combine isolation with output review:
For most professional teams, broad local access should not be the default.
A well-configured Dev Container or sandboxed shell is usually a better baseline.
For unknown code, sensitive projects, external pull requests, customer-provided repositories, or high-risk AI agents, move up to a VM, remote workspace, or ephemeral environment.
A simple rule:
The more the AI tool can read, execute, modify, or reach, the more isolation the setup needs.
And when unsure:
Move one level up in isolation.
There is no single AI development setup that fits every workflow. The right choice depends on what the AI tool can read, modify, execute and reach over the network. For most professional teams, broad local access should not be the default.
A well-configured Dev Container or sandboxed shell is usually a better baseline for regular development.
For higher-risk work, such as untrusted repositories, customer-provided code, sensitive projects, or autonomous agents, move to stronger isolation: VM, remote workspace, or ephemeral environment.
Need help choosing the right setup?
If you are introducing AI coding agents in your team, Composable Security can help you create a threat model of your workflow, choose a reasonable isolation level, review your configuration, or harden the right isolation level for your team.
Email us at info@composable-security.com or DM us on Telegram at @drdr_zz or @wh01s7.
Meet Composable Security
Get throughly tested by the creators of Smart Contract Security Verification Standard
Let us help
Get throughly tested by the creators of Smart Contract Security Verification Standard