← Cloudflare Interview Insights

Cloudflare·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

System design round at Cloudflare for a software engineer role, focused entirely on building an encrypted key-value store with user auth. Pretty deep on crypto primitives and threat modeling, which I wasn't fully expecting.

Questions Asked (3)

Q1

Design a key-value store that supports user login and stores values encrypted at rest using the user's own password.

System DesignTechnical Trade-offsData Modeling
Author's notes

This question sprawled way more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements: scale, consistency, security model, and whether the service should be zero-knowledge. Then design a layered architecture: authentication, key derivation from the user's password, encryption/decryption at the client or server, and a scalable key-value storage backend. Discuss trade-offs around key management, performance, and security guarantees.

Pro tip: Emphasize that deriving an encryption key directly from the password is dangerous; instead, use a strong KDF like Argon2 with a per-user salt, and consider a split-key or envelope encryption scheme to avoid re-encrypting all data on password change.

1. Clarify Requirements and Constraints

Ask about scale, latency, consistency, multi-device support, and whether the server should ever see plaintext or the user's password. This sets the security and performance goals.

2. Design Authentication and Key Derivation

Outline user registration/login, password hashing for authentication (e.g., Argon2), and derivation of a master key from the password using a KDF with a unique salt. Discuss how to avoid storing the password or derived key on the server.

3. Design Encryption and Key Management

Choose an encryption scheme (e.g., AES-GCM or ChaCha20-Poly1305) and key hierarchy: derive a master key, then per-value data keys wrapped by the master key. Explain how to handle password changes without re-encrypting all data.

4. Design the Key-Value Store Backend

Propose a scalable storage layer (e.g., distributed KV like Cloudflare Workers KV, DynamoDB, or Cassandra) with appropriate partitioning, replication, and consistency. Address how encrypted blobs are stored and retrieved.

5. Discuss Trade-offs and Security Considerations

Cover trade-offs: client-side vs server-side encryption, performance overhead of KDF, key rotation, recovery mechanisms, and threat model. Mention zero-knowledge vs server-assisted encryption.

Key Points to Mention

  • Use a strong password-based key derivation function (e.g., Argon2, scrypt) with per-user salt to derive encryption keys.
  • Employ envelope encryption: a master key encrypts per-value data keys, which encrypt the actual values.
  • Consider client-side encryption to achieve zero-knowledge, but discuss the trade-off of losing server-side search and recovery.
  • Design for password changes: re-wrap the master key with a new password-derived key instead of re-encrypting all data.
  • Choose an appropriate encryption mode (e.g., AES-GCM) that provides confidentiality and integrity.
  • Address scalability and consistency of the underlying key-value store, including partitioning and replication.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you handle a password change without losing access to existing encrypted values?

System DesignTechnical Trade-offs
Author's notes

This follow-up stung a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the encryption scheme and key management setup, then propose a key rotation strategy that re-encrypts data with a new key while maintaining access. Emphasize the importance of a phased rollout with backward compatibility and thorough testing to avoid downtime or data loss.

Pro tip: Mention envelope encryption with a key hierarchy (e.g., data encryption keys wrapped by a master key) and how rotating the master key only requires re-wrapping DEKs, not re-encrypting all data. This shows you understand scalable, secure key management practices used in cloud environments.

1. Clarify requirements and constraints

Ask about the encryption scheme (e.g., AES, RSA), key management system, data volume, and acceptable downtime. This ensures your solution fits the specific context.

2. Choose a key rotation strategy

Decide between re-encrypting all data with the new key or using a key hierarchy (envelope encryption) to minimize re-encryption. Consider performance, security, and operational complexity.

3. Implement dual-key support

During transition, support both old and new keys for decryption, and use the new key for encryption. This allows gradual migration without breaking existing access.

4. Migrate data in batches

Re-encrypt data in batches to avoid overwhelming the system, with monitoring and rollback plans. For envelope encryption, re-wrap DEKs with the new master key.

5. Verify and decommission old key

After migration, verify all data is accessible with the new key, then securely retire the old key. Update documentation and access controls accordingly.

Key Points to Mention

  • Envelope encryption and key hierarchy (DEKs and KEKs)
  • Key rotation best practices and compliance requirements (e.g., PCI DSS, GDPR)
  • Backward compatibility and dual-key decryption during transition
  • Performance impact of re-encryption and batching strategies
  • Secure key storage and access control (e.g., HSM, KMS)
  • Monitoring, logging, and rollback procedures

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

What does your threat model look like, and what attacks does your design protect against versus not protect against?

System DesignTechnical Trade-offs
Author's notes

Went okay.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the system's assets, trust boundaries, and likely adversaries, then explicitly state the security goals and assumptions. Walk through the top threats you considered and how your design mitigates them, and be equally clear about what you deliberately left out of scope and why. Tie your choices to Cloudflare's context—edge, scale, and DDoS—to show relevance.

Pro tip: Explicitly call out what you are NOT protecting against and why (e.g., compromised insiders, physical access, zero-days) — interviewers value engineers who understand trade-offs and avoid over-claiming security.

1. Define assets and trust boundaries

Identify what you're protecting (data, credentials, availability) and where trust changes (client to edge, edge to origin, service to service). This sets the scope for the threat model.

2. Identify adversaries and attack vectors

List likely attackers (script kiddies, DDoS botnets, malicious insiders, nation-states) and the attacks they might use (injection, credential stuffing, DDoS, MITM). Prioritize by likelihood and impact.

3. Map mitigations to threats

For each significant threat, describe the design controls you put in place (e.g., rate limiting, input validation, encryption, least privilege) and how they reduce risk.

4. State explicit non-goals and assumptions

Clearly list what the design does not protect against (e.g., compromised endpoints, physical attacks, zero-day exploits) and the assumptions that make those exclusions acceptable.

5. Discuss residual risk and trade-offs

Acknowledge remaining risks and explain the trade-offs (e.g., performance vs. security, complexity vs. coverage) and how you'd monitor or iterate on them.

Key Points to Mention

  • STRIDE or similar threat modeling framework to structure the analysis
  • Trust boundaries and data flow diagrams to visualize attack surface
  • Specific attacks mitigated: DDoS, injection, credential stuffing, MITM, privilege escalation
  • Explicit non-goals: insider threats, physical access, zero-days, supply chain compromises
  • Security controls: encryption in transit/at rest, rate limiting, input validation, least privilege, logging/monitoring
  • Trade-offs: performance impact, complexity, cost, and how you prioritize based on risk

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.