PrepGenAICerts
Domain 7: Security and SafetyLesson 29 of 32

7.3 Identity, Secrets, and Key Management

7.3.1 Secrets and API Key Hygiene

Securing a Claude application includes the ordinary identity and credential hygiene any production system needs — the model does not change these requirements. API keys and secrets belong in environment variables or a secrets manager. They must never be hard-coded in source, committed to version control, or pasted into prompts or logs — each of those creates a durable, hard-to-revoke leak that outlives the moment it happened.

Notice what makes each of those three wrong locations especially dangerous: they persist. A key hard-coded in source lives on in every clone of the repository and every deployed build until someone finds and removes it. A key committed to version control lives on in git history even after it's deleted from the current file — removing the line doesn't remove the commit. A key pasted into a prompt or log can be captured by anything downstream that has access to prompts or logs: observability tooling, a debugging session, a support ticket with a pasted transcript. None of these are one-time exposures; they're durable ones, which is exactly why rotation and revocation exist as separate, ongoing practices rather than one-time setup steps.

  • Belongs: environment variables, a dedicated secrets manager.
  • Never belongs: hard-coded in source, committed to a repo, pasted into a system prompt, written to logs.
  • Scope per environment — dev, staging, and prod each get their own keys.
  • Rotate on a schedule, and revoke immediately the moment a key is exposed.

7.3.1 — Key Concept

Hard-coding or committing an API key is the classic leak pattern this domain tests for. Exam items reliably reward env/secret-store storage, environment scoping, and rotation over any form of embedding a key directly in code, prompts, or logs.

7.3.2 Identity, Authentication, and Authorization

Authentication and authorization are distinct checks, and skipping either one leaves a gap. Identity and authentication mean validating the caller's identity and authenticating every request, rather than assuming a request is legitimate simply because it reached the system. Authorization — access-level verification — means separately confirming the caller is approved for this specific action and this specific data, at the right access level, before the agent acts on their behalf. An agent acting with a caller's identity should never end up with broader access than the caller would have directly.

This distinction matters most exactly where it's easiest to collapse: an agent that proxies requests on behalf of a human user. It's tempting to treat "the request came from an authenticated session" as the whole security story, but authentication only answers who is asking. A correctly authenticated user might still not be entitled to the specific record, tool, or action their request implies — a support agent authenticated as themselves should not thereby be able to ask the system to pull another customer's billing history just because the session is valid. Authorization has to be checked per action and per data item, every time, not assumed once at login and carried forward.

Request flow: authenticate, then authorize, then logAuthenticatewho is the caller?Authorizeapproved for this action/data?Agent actsLogmonitor

Authentication verifies who is calling; authorization separately verifies what they're allowed to do; access monitoring logs both authorized and attempted access so misuse is detectable after the fact.

ℹ️

7.3.2 — Key Concept

Authenticating who the caller is does not verify what they're authorized to do. Authorization/access-level verification is a distinct, additional check that must happen before the agent acts on the caller's behalf — assuming authentication alone is sufficient is a common gap.

7.3.3 Access Monitoring and the Worked Example

The last piece is access monitoring: log and monitor authorized (and attempted) access so misuse is detectable, not just theoretically preventable by the controls above. A system that authenticates and authorizes correctly but keeps no record of who accessed what still can't answer "was this misused?" after the fact — detection is a distinct requirement from prevention.

Attempted access deserves equal billing with authorized access in what gets logged. A denied authorization check is itself a signal — a single denial is probably a legitimate mistake, but a pattern of repeated denials against different records from the same caller is exactly the kind of thing that indicates probing or a compromised credential. If only successful, authorized actions are logged, that signal never surfaces, and the system loses its best early warning that something is wrong before any data has actually been exposed.

Worked example: which is a safe way to handle an API key? Store it in an environment variable or secrets manager, scoped per environment and rotated — not hard-coded in source, not committed to the repo "for the team," and not pasted into the system prompt. Secrets belong in env/secret stores, never in code, version control, or prompts.

⚠️

Where this shows up on the exam

Exam trap: hard-coding or committing an API key is the classic wrong answer to flag on this task statement. The safe pattern is always env/secret-store storage with environment scoping and rotation — no exam item on this topic rewards embedding a credential directly in code, prompts, or version control.

7.3.4 Zero Data Retention: Eligibility Varies by Model and Platform

It's tempting to treat an existing Zero Data Retention (ZDR) agreement as a single switch that covers everything an organization does with Claude. That assumption is exactly what creates a scoping surprise later. ZDR eligibility varies by model and by platform, and it is not automatically guaranteed just because an organization already has a ZDR agreement in place. Not every current model is ZDR-eligible, and this isn't limited to the direct Claude API -- it applies just as much across Amazon Bedrock, Google Vertex AI, and Microsoft Foundry.

Concretely, a team could have a fully executed ZDR agreement at the organization level, deploy a newer or higher-capability model that simply hasn't had its ZDR status confirmed yet, and discover mid-project that the specific model/platform combination they picked isn't covered -- even though 'ZDR' appears in their contract.

7.3.4 -- Key Concept

Confirm current ZDR coverage for the specific model/platform combination in use, at scoping time, via Anthropic's Trust Center -- and for Bedrock, Vertex AI, or Microsoft Foundry, confirm data retention under that specific platform as well. 'We have a ZDR agreement' is not itself an answer to 'is this model, on this platform, ZDR-eligible right now' -- those are two different questions, and only the second one matters for a given deployment.

Key Takeaways

  • API keys and secrets belong in environment variables or a secrets manager, scoped per environment, and rotated on a schedule; revoke immediately on exposure.
  • Never hard-code, commit, or paste a secret into a prompt or log — each is a durable, hard-to-revoke leak.
  • Authentication (who is calling) and authorization (what they're allowed to do) are distinct checks; verify both before the agent acts on a caller's behalf.
  • An agent acting with a caller's identity should never end up with broader access than the caller would have directly — least privilege applies to identity, not just to tools.
  • Access monitoring — logging authorized and attempted access — is what makes misuse detectable after the fact, distinct from prevention controls.
  • Exam trap: hard-coding or committing an API key is the classic leak pattern; env/secret-store storage with environment scoping and rotation is the rewarded pattern.
  • ZDR eligibility varies by model and by platform (direct API, Bedrock, Vertex AI, Microsoft Foundry) and is not automatically covered by a general ZDR agreement -- confirm the specific model/platform combination at scoping time via Anthropic's Trust Center

Check Your Understanding

Test what you learned in this lesson.

Q1.Which is a safe way to handle an API key used by a Claude application?

Q2.An agent authenticates every incoming request but then executes any action the caller asks for without further checks. What is missing?

Q3.A system correctly authenticates and authorizes every request but keeps no logs of what was accessed. What capability is missing?

Q4.An agent is granted a service account with admin-level database access so it can act on behalf of any user who queries it, even though most users only have read access to their own records. What principle does this violate?

Q5.An organization has a signed ZDR agreement with Anthropic and assumes every model they might deploy on any platform is automatically covered. Is this assumption correct?

Practice This Lesson

PrepGenAICerts.com is an independent third-party exam-prep platform for the Claude Certified Architect (CCA-F) certification. We are not affiliated with, endorsed by, or acting on behalf of Anthropic PBC.

Note: New premium upgrades are temporarily paused while we resolve an issue with our payment provider. Existing premium members retain full access.