CertSafari
    Anthropic Claude Certified Developer – Foundations (CCDV-F)· Lessons

    Domain 7 · Lesson 20/25

    Secure-by-Design Deployment: Least Privilege, Access Management, Secrets and Privacy

    Guardrails and Safe Deployment

    10 min read
    2.03% of exam
    6 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Apply least privilege to an agent's tools with allow, ask and deny permission rules
    • Design identity and access management for agents: minimal IAM permissions and credentials injected through a proxy
    • Store, rotate and scan for API keys using Anthropic's documented practices
    • Use data-retention and zero data retention (ZDR) arrangements to meet privacy requirements

    1.Least privilege: limit how much damage a mistake can do

    Guardrails make an attack less likely to succeed. Secure-by-design deployment assumes some attacks will succeed anyway and limits what they can do. Anthropic's guidance says it directly: give Claude no secrets it doesn't need, run tools in sandboxes, and scope permissions as narrowly as you can.

    In Claude Code and the Agent SDK, least privilege is expressed through permission rules. Allow rules run a tool without asking. Ask rules ask for confirmation every time. Deny rules block the tool completely. Rules can name a whole tool (Bash, WebFetch, Read) or one specific use of it (Read(./.env), WebFetch(domain:example.com)), and organizations can push policies to every user.

    A permission policy that allows build and commit commands but denies git pushjson
    {
      "permissions": {
        "allow": [
          "Bash(npm run *)",
          "Bash(git commit *)"
        ],
        "deny": [
          "Bash(git push *)"
        ]
      }
    }

    Wildcards are easy to write too broadly. The * matches whatever text is in its position, and a missing space changes the result:

    How Bash rule wildcards match
    RuleMatchesDoesn't match
    Bash(npm run *)npm run build, npm run test --watch, npm runnpm install
    Bash(ls *)ls -la, lslsof
    Bash(ls*)ls -la, lsof—
    Bash(git * main)git merge main, git push origin main, git -c core.fsmonitor=<script> diff maingit log

    Permission rules are a gate, not a sandbox. Claude Code parses each Bash command and matches it against your rules. Apart from a few built-in checks, it does not judge whether a command is dangerous from its effects. To contain what a command can actually do, use OS-level sandboxing.

    Checkpoint 1 of 4· Fill the gap

    This policy is meant to stop the agent from using any MCP tool. Which key fills the blank?

    {
      "permissions": {
        " ? ": [
          "mcp__*"
        ]
      }
    }

    Sources123

    2.Identity and access management: keep credentials away from the agent

    For an agent, identity and access management mostly means keeping secrets out of its reach. Anthropic's secure-deployment guide recommends running a proxy outside the agent's environment, such as Envoy with its credential_injector filter. The proxy validates each request, enforces a domain allowlist, adds the credential and logs the traffic. The agent never sees the credential. Credentials live in one secure place instead of being copied to every agent, and you get an audit trail of every request. On the cloud side, give the agent's service account minimal IAM permissions, and block all egress except to the proxy.

    Isolation backs this up. A hardened container drops privileges and mounts only what the agent needs:

    Selected container options and the privilege each one removes
    OptionPurpose
    --cap-drop ALLRemoves Linux capabilities like NET_ADMIN and SYS_ADMIN that could enable privilege escalation
    --network noneRemoves all network interfaces; the agent communicates through a mounted Unix socket to the proxy
    --user 1000:1000Runs as a non-root user
    -v ...:/workspace:roMounts code read-only; avoid mounting ~/.ssh, ~/.aws, or ~/.config

    Checkpoint 2 of 4· Check yourself

    Which statement best describes the documented cloud IAM posture for an agent's service account?

    Access management also covers the people and workloads that call the Claude API. In the Claude Console, a key's type decides who it acts as:

    - A personal key acts as you, with your roles and permissions. - A service account key acts as a service account. - A workspace key is legacy. It acts as no one, and identity-backed keys or Workload Identity Federation are preferred.

    Personal and service account keys are identity-backed. When the user or service account is removed from the organization, the key stops working, so keys don't outlive the people or workloads that own them. Use a personal key for your own development and scripts. For shared or automated workloads such as CI and production services, an organization admin creates a service account so the workload has its own identity. Don't share one person's key.

    A key can also be scoped to a single workspace, where it works only in that workspace. For production workloads on cloud platforms or CI/CD, Workload Identity Federation exchanges your identity provider's token for a short-lived token, which removes the static secret.

    Sources34

    3.Storing, rotating and scanning for API keys

    Your own Claude API key needs the same care. Anthropic's API key guidance says to load it from the environment instead of hard-coding it, as in the snippet below. In the cloud, use your hosting provider's mechanism for injecting environment variables. As the number of secrets grows, a Key Management System (KMS) gives you central encrypted storage, fine-grained access control, audit trails and simpler rotation.

    Loading the Claude API key from an environment variable instead of hard-coding itpython
    from dotenv import load_dotenv
    
    import os
    
    load_dotenv()
    my_api_key = os.getenv("ANTHROPIC_API_KEY")

    Three habits keep the damage small if a key leaks:

    - Rotate on a schedule, for example every 90 days, by creating new keys and deactivating old ones. Don't wait for a leak. - Use separate keys per environment (development, testing, production), so you can disable only the compromised one. - Scan for committed secrets. Turn on secret scanning in your source-control provider, use SAST tools such as Gitleaks, and put scanning in CI/CD so a secret is caught before it reaches the main branch.

    Anthropic is also in GitHub's Secret scanning partner program. If a Claude API key turns up in a public repository, Anthropic deactivates it automatically and emails the owner. Agents can leak other secrets too: files such as .env, ~/.aws/credentials, ~/.kube/config and *.pem should never be mounted where an agent can read them.

    Checkpoint 3 of 4· Check yourself

    A team uses one Claude API key for development, staging and production. The development key leaks. Which documented practice would have limited the damage most directly?

    Sources5

    4.Privacy: data retention and zero data retention

    Privacy by design starts with the prompt. The guardrail examples on Anthropic's jailbreak-mitigation page write data protection directly into the system prompt, for example "Protect client privacy; never disclose personal or financial data." The other half is the data's lifecycle: what the platform keeps, and for how long.

    Data minimization is the underlying principle. Anthropic keeps only what is technically necessary for a feature to work, and conversation content (your prompts and Claude's outputs) is not retained by default. Retained API data is never used for model training without your express permission.

    For stricter needs, Anthropic offers two data handling arrangements for the Claude API: zero data retention (ZDR) and HIPAA readiness. They are separate arrangements, and the feature eligibility table lists which API features each one covers. Under ZDR, Anthropic does not store prompts or responses at rest once the response is returned. Plan around a few details:

    - ZDR is enabled per organization. A new organization needs it enabled separately. - Features marked "No" in the eligibility table, such as code execution, are not covered even though they use /v1/messages. - On Amazon Bedrock and Google Cloud's Agent Platform, the cloud provider is the data processor, so their controls apply instead.

    Some retention sits outside both arrangements. The Activity Feed retains data for 6 years, and claude.ai chat, file and project content follows your organization's retention policy. Check which model applies before you promise users that data is not stored.

    Checkpoint 4 of 4· Check yourself

    A company has ZDR enabled on its main Claude API organization and creates a second organization for a new product. What is the ZDR status of the new organization?

    Sources61

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.A Bash deny rule or allowlist sandboxes the agent and contains what a command can do.Why is that wrong?

      Permission rules match command text. Claude Code says this is a permission gate, not a sandbox; use OS-level sandboxing to restrict filesystem and network access.

      Covered in Least privilege: limit how much damage a mistake can do

    2. 2.API keys only need rotating after a suspected leak.Why is that wrong?

      Anthropic recommends rotating on a consistent schedule, such as every 90 days, so a key that is compromised without anyone noticing has a limited lifetime.

      Covered in Storing, rotating and scanning for API keys

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “don't give Claude access to secrets it doesn't need, run tools in sandboxed environments, and scope permissions as narrowly as possible.”
      ↩︎ Least privilege: limit how much damage a mistake can do
      “Protect client privacy; never disclose personal or financial data.”
      ↩︎ Privacy: data retention and zero data retention
    2. 2.
      “Deny rules prevent Claude Code from using the specified tool.”
      ↩︎ Least privilege: limit how much damage a mistake can do
    3. 3.
      “Organizations can set policies that apply across all users.”
      ↩︎ Least privilege: limit how much damage a mistake can do
      “Credentials are stored in one secure location rather than distributed to each agent”
      ↩︎ Identity and access management: keep credentials away from the agent
      “Avoid mounting sensitive host directories like ~/.ssh, ~/.aws, or ~/.config”
      ↩︎ Identity and access management: keep credentials away from the agent
      “This is a permission gate, not a sandbox”
      ↩︎ Exam trap 1
      “The agent never sees the actual credentials”
      ↩︎ Prediction
      “Assign minimal IAM permissions to the agent’s service account, routing sensitive access through the proxy where possible”
      ↩︎ Checkpoint
    4. 4.
      “Personal keys and service account keys are identity-backed: each belongs to a user or service account your organization already manages”
      ↩︎ Identity and access management: keep credentials away from the agent
      “For shared or automated workloads (CI, production services), have an organization admin create a service account so the workload has its own identity.”
      ↩︎ Identity and access management: keep credentials away from the agent
    5. 5.
      “Integrate secret scanning into your CI/CD pipeline to catch any secrets before they are pushed to the main branch”
      ↩︎ Storing, rotating and scanning for API keys
      “To prevent potential abuse, Anthropic automatically deactivates the exposed API key.”
      ↩︎ Storing, rotating and scanning for API keys
      “A KMS provides a centralized solution for storing, accessing, and managing secret keys, including API keys.”
      ↩︎ Storing, rotating and scanning for API keys
      “Regularly rotate your API keys on a consistent schedule (for example, every 90 days) by creating new ones and deactivating old ones.”
      ↩︎ Exam trap 2
      “If possible, use different API keys for development, testing, and production environments.”
      ↩︎ Checkpoint
    6. 6.
      “Retained data is never used for model training without your express permission.”
      ↩︎ Privacy: data retention and zero data retention
      “Under a ZDR arrangement, Anthropic does not store customer prompts or responses at rest after the API response is returned.”
      ↩︎ Privacy: data retention and zero data retention
      “Anthropic offers two data handling arrangements for the Claude API: zero data retention (ZDR) and HIPAA readiness.”
      ↩︎ Privacy: data retention and zero data retention
      “Only what is technically necessary for the feature to work is retained.”
      ↩︎ Privacy: data retention and zero data retention
      “The Activity Feed retains data for 6 years.”
      ↩︎ Privacy: data retention and zero data retention
      “ZDR is enabled per organization; each new organization requires ZDR to be enabled separately by your account team”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise the 20 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.