# Security

How the Droid CLI protects code and data with local execution, command approval, sandboxing, and enterprise controls.

## Security-first design

The Droid CLI runs where your code already lives. Shell commands and file edits execute locally, while prompts and selected context follow the model and gateway configuration set by you or your organization.

Use this page for user-facing CLI protections. For organization-wide enforcement, see [Enterprise Controls](/enterprise/hierarchical-settings-and-org-control) and [Agent Safety & Controls](/enterprise/llm-safety-and-agent-controls).

---

## Key security features

<CardGroup cols={3}>
  <Card title="Secure Authentication" icon="shield-check" href="/enterprise/identity-and-access">
    OAuth login with encrypted token storage. Tokens auto-rotate every 30 days and are stored with OS-level file permissions.
  </Card>
  <Card title="Permission Controls" icon="user-lock" href="/enterprise/llm-safety-and-agent-controls">
    Risky operations require explicit approval unless your settings allow them. Organizations can enforce command allowlists, denylists, and blocklists.
  </Card>
  <Card title="Local Execution" icon="computer" href="/enterprise/privacy-and-data-flows">
    Droid reads and edits files on the machine where it runs. It does not require uploading or indexing a static copy of your repository.
  </Card>
  <Card title="Enterprise Controls" icon="lock" href="/enterprise/hierarchical-settings-and-org-control">
    Org-managed settings control models, MCP servers, hooks, plugins, sandboxing, retention, and feature access.
  </Card>
  <Card title="Sandbox" icon="box" href="/autonomy-and-safety/sandbox">
    Optional isolation for filesystem and network access when running commands.
  </Card>
  <Card title="Agent Safety" icon="shield" href="/enterprise/llm-safety-and-agent-controls">
    Command policies, hooks, and Droid Shield bound agent behavior before model output matters.
  </Card>
</CardGroup>

---

## Security best practices

<Warning>
  Always review suggested code and commands before approval. You control what Droid can access and execute.
</Warning>

{/* sweep-allow: term-bullets */}

- **Review before approving.** Verify proposed commands and file changes, especially package installs or system-file edits, operations involving sensitive data or credentials, network requests to external services, and file operations outside your project directory.
- **Use isolated environments.** Run Droid in containers or VMs for untrusted code repositories, external APIs or web services, experimental or potentially risky operations, and shared development environments.
- **Manage permissions carefully.** Block commands that should never run, use "ask" for medium-risk operations that need oversight, "allow" only low-risk commands you trust completely, and review permissions regularly in the Settings menu.
- **Protect sensitive data.** Never include secrets in prompts: use environment variables for API keys and tokens, store credentials in secure credential managers, exclude sensitive files from Droid's working directory, and use `FACTORY_API_KEY` for CI/CD and service-account automation.

---

## Built-in protections

The Droid CLI includes multiple layers of security:

<PropertyList>
  <Property name='Write access restriction'>
    Droid file-edit tools are scoped to the active project directory and
    subdirectories.
  </Property>
  <Property name='Command approval'>
    Risky operations require explicit user confirmation.
  </Property>
  <Property name='Command policy'>
    Managed allowlists, denylists, and blocklists constrain shell execution.
  </Property>
  <Property name='Droid Shield'>
    Secret scanning can block `git commit` and `git push` when staged diffs
    contain likely credentials.
  </Property>
  <Property name='Network controls'>
    Sandbox rules and enterprise IP restrictions reduce where commands and
    Factory requests can go.
  </Property>
  <Property name='Session isolation'>
    Each conversation maintains separate, secure context.
  </Property>
</PropertyList>

---

## Enterprise security

<CardGroup cols={2}>
  <Card title="SSO & Identity" icon="user-shield" href="/enterprise/identity-and-access">
    SAML/OIDC single sign-on, Directory Sync, roles, and service accounts.
  </Card>
  <Card title="Governance" icon="database" href="/enterprise/hierarchical-settings-and-org-control">
    Enterprise Controls for model access, BYOK policy, MCP allowlists, hooks, plugins, sandboxing, and retention.
  </Card>
  <Card title="Trust Center" icon="certificate" href="https://trust.factory.ai">
    Current reports, subprocessor lists, and security materials are available in the Factory Trust Center.
  </Card>
  <Card title="Telemetry & Analytics" icon="chart-line" href="/enterprise/telemetry-and-analytics">
    OpenTelemetry metrics, hosted analytics, audit events, and workflow logs for enterprise monitoring.
  </Card>
</CardGroup>

---

<Note>
  Report security vulnerabilities through our responsible disclosure program. Contact [security@factory.ai](mailto:security@factory.ai) for details.
</Note>

<RelatedLinks>
  <RelatedLink href="mailto:security@factory.ai" title='Security questions'>
    Email the security team at security@factory.ai.
  </RelatedLink>
  <RelatedLink href="https://trust.factory.ai" title='Trust Center'>
    Compliance documents and certifications.
  </RelatedLink>
</RelatedLinks>
