Secure Architecture and Design Principles Questions
Designing systems that are secure by construction: core design principles (least privilege, separation of duties, fail-safe and fail-secure defaults, secure-by-default, attack surface reduction, assume-breach), defense-in-depth and layered control placement, classifying controls as preventive, detective and corrective, secure design patterns such as tenant isolation and blast-radius limiting, security architecture reviews and secure-by-design checklists, and reasoning about trade-offs between security, usability, performance and delivery speed when selecting and placing controls, including build, native or buy choices and making the secure option the easy one for developers. Covers enterprise-scale reference architecture, such as placing enforcement across hybrid and multi-cloud estates and giving many teams a consistent baseline, how security requirements shape system structure, designing safeguards to degrade safely when a dependency is down or in an emergency, and testing whether layers and isolation hold. Boundary: the mechanics of identity, cryptography, networking, threat models, detection, incident response and compliance evidence are covered elsewhere.
What does 'secure by design' mean to you in practice? You are starting a new microservices platform: which three design decisions would you make on day one, and what attack or failure does each one remove?
Sample Answer
Direct answer
"Secure by design" means security properties are built into the structure of the system before features are written, so a mistake by one developer or one compromised component cannot automatically become a breach. It is about decisions that are cheap on day one and expensive to retrofit. For a new microservices platform (an application split into many small services that call each other over the network), I would make three decisions first.
Three day-one decisions and what each removes
- Every service gets its own cryptographic identity, and every call is mutually authenticated and encrypted. Mutual TLS (mTLS) means both sides of a connection present certificates, so a service proves who it is, not just the server. Pair it with a default-deny network policy: a service can call only the services on its allow list. As a concrete rule, in Kubernetes that is a NetworkPolicy that first denies all inbound connections to every service in the namespace, then adds one allow rule such as "
paymentsaccepts connections only fromorders"; anything not listed is refused. Do the same for outbound traffic (egress): deny by default and allow each service only the destinations it needs, sonotificationscan reach its email provider and nothing else. Removes: spoofed internal calls, sniffing of east-west traffic (service-to-service traffic inside the platform), and free lateral movement (an attacker hopping from one compromised service to the next). - Least privilege per service, with short-lived credentials. Each service has its own role that can touch only its own database and queues, and its credentials expire in minutes or hours and are issued automatically, not stored in config. Removes: the "one stolen shared secret opens everything" failure and long-lived leaked keys.
- Authorization is checked in every service, not only at the front door. The gateway (the single entry point for outside traffic) authenticates the user and passes a signed token with their identity inward (a token is a small data package saying who the user is, signed by the identity service so it cannot be altered; each service checks the signature with the issuer's public key and also checks that the token has not expired and was meant for it). Each service then decides whether this user may do this action, instead of trusting that "the request came from inside". Removes: broken access control caused by trusting network location, and the confused-deputy problem (a legitimate service tricked into using its own privileges on an attacker's behalf).
Worked example
Suppose a vulnerable library lets an attacker run code inside the notifications service. With these decisions, the attacker holds only that service's identity: the egress policy lets it reach the email provider and nothing else, and payments accepts connections only from orders, so a direct call to payments is dropped at the network layer. Suppose a policy gap let the packet through anyway: payments would still reject it, because it verifies the token's signature and expiry and then finds no user with refund rights in it. Either way, the compromised service's role cannot read the payments database. One bug stays one bug.
Making it stick
I would ship these as a paved road (a service template and platform defaults) so teams get them without effort, and enforce them in CI (continuous integration, the automated build pipeline) so drift fails a build.
Trade-offs and pitfalls
- mTLS and per-service roles add operational work (certificate rotation, policy management). A service mesh (a layer of small proxies running beside each service that handles encryption, certificates and retries so application code does not) or other platform automation absorbs most of it.
- Do not choose "a WAF (web application firewall, a filter that blocks known attack patterns in web requests) at the edge" as a day-one answer. It is a useful layer, but it does nothing about a compromised internal service.
- What would change my choices: a very small platform with two services might defer the mesh and start with network policy plus per-service roles.
A prospect wants a security posture assessment of your product within two weeks, before they sign. How do you scope a lightweight, repeatable architecture review in that time, and what do you refuse to promise?
Sample Answer
Direct answer. I would sell a fixed-scope, evidence-based review: a two-week "posture review" built from the same six steps every time, delivered as a short written summary plus a call. I would promise what I can observe and show (architecture, controls as designed, evidence we already hold) and refuse to promise anything that amounts to a guarantee of security, a penetration test (an authorised, hired attempt to break into the product to find weaknesses) I have not run, or access to production.
Scope (what the review covers). Architecture review means walking the design and asking where trust boundaries (points where data passes between parts that trust each other differently, such as browser to server or our service to a partner) are and whether controls sit in the right layers. Keep it to the product the prospect will actually use.
| Working days | Step | Output |
|---|---|---|
| 1 | Intake: ask the prospect for their questionnaire and what data they will put in the product | Data classes and the 3-5 things they care about most |
| 2-4 | Walk our standard architecture pack (data-flow diagram, tenant isolation meaning one customer's data stays invisible to the others on the shared product, identity, encryption, logging, deployment) with the product architect | Annotated diagram, gaps noted |
| 5-6 | Map prospect requirements to existing evidence: independent audit reports (for example a SOC 2 report, an attestation by an outside auditor on controls), policies, last penetration-test summary | Requirement-to-evidence table |
| 7-8 | Triage gaps: fix now, compensate (cover the risk with an interim control until the real fix ships), roadmap, or decline | Gap list with owner and status |
| 9 | Draft summary, legal and security sign-off | One review document |
| 10 | Call with the prospect's security team | Agreed open items |
The ten working days are two calendar weeks, so the call lands on a weekday.
Repeatable. The architecture pack, the evidence index (a maintained list that maps each security claim to the document or report that proves it) and the answer library are maintained once and reused. Once the library exists, a second prospect should cost hours rather than weeks (an expectation to confirm by timing the first two reviews, not a measured figure). Anything new that a prospect asks goes back into the library.
What I refuse to promise.
- Any claim that the product is "secure" or "unbreachable". I state controls and evidence, with dates.
- A custom penetration test or code review inside two weeks, or any testing of production by the prospect.
- Features or fixes on a date before engineering has committed.
- Certification we do not hold. If the prospect wants an audit report we lack, I say so and offer a roadmap date only if leadership has approved it.
- Exceptions to standard contractual security terms; those go to legal.
Worked example. A prospect will upload customer invoices and asks for single sign-on, encryption at rest and a 24-hour breach notice. On day 1 I note invoices are sensitive financial data. In the architecture walk I confirm SSO and encryption are in the standard design, but find the audit log is not exportable. The gap table says: SSO met (evidence: configuration doc), encryption met, the log export gap is compensated (covered in the interim) by sending the prospect a monthly activity report until the export feature ships, roadmap item for the next quarter with product owner named. The 24-hour breach notice goes to legal, because it is a contract commitment, not an architecture fact.
Trade-offs and pitfalls. Over-sharing internal diagrams without a non-disclosure agreement; answering questionnaire rows from memory instead of from the evidence index; letting sales promise the roadmap. What would change my call: a very large deal could justify an outside penetration test that we schedule after signing, with the prospect's agreement, but never inside the two-week window.
Your organization is breaking a monolith into microservices. What security properties did the old design give you for free that you will lose, and how would you rebuild them in the new architecture?
Sample Answer
Direct answer
A monolith gives you several security properties implicitly because everything runs in one process: calls between modules never cross a network, one code path enforces authorization, one log shows what happened, and one dependency set is patched at once. Splitting into microservices turns each of those into a distributed problem. I would rebuild each one explicitly, and I would put identity and service-to-service trust in place before the first service is carved out.
What is lost and how to rebuild it
| Property the monolith gave for free | What breaks in microservices | How I rebuild it |
|---|---|---|
| In-process trust: a function call cannot be spoofed or sniffed | Every call is a network request an attacker can forge or observe | Mutual TLS (both sides prove identity with certificates) and per-service identities; default-deny network policy |
| One authorization enforcement point | Many services, each could check permissions differently or not at all | Shared policy library or central policy engine (a service that answers "may this user do this?" from written rules), plus user identity passed in a signed token (a tamper-evident proof of who the user is) and checked at each service |
| Immediate session revocation | Tokens already issued stay valid across services until they expire | Short token lifetimes, revocation lists (lists of tokens cancelled before expiry) for high-risk actions, re-check sensitive operations online |
| One database and one transaction | Data spreads across services; multi-step operations can fail halfway, leaving security-relevant state inconsistent (for example, a refund is recorded but the step that revokes the customer's access never ran) | Each service owns its data with its own credentials; design sagas (a sequence of steps with compensating undo steps) and idempotent operations (safe to repeat: running the same request twice has the same effect as once, so a retry after a failure cannot double a refund) |
| One log and one audit trail | Actions span many services | Correlation IDs (one unique ID attached to a request and passed to every service it touches, so its trail can be reassembled) on every request, structured logs, central collection with tamper protection |
| One perimeter and one patch cycle | Many images, many dependencies, many endpoints | Standard base images, automated dependency scanning, an API gateway as the only public entry |
| One configuration and secret store | Many secrets, many places to leak | Vault with short-lived dynamic credentials per service |
If I could name only three in an interview, I would start with in-process trust (mutual TLS), the single authorization enforcement point, and revocation, because they are the hardest to retrofit once dozens of services call each other, while logging, patching and secret handling can be improved incrementally afterwards.
Worked example
In the monolith, refund(order) ran after the web layer checked the user's role in one place. In microservices, orders calls payments. If payments trusts anything from orders, an attacker who compromises orders can issue refunds for anyone. The fix is two checks: payments verifies the caller is really the orders service (mTLS), and verifies the end user's token authorizes a refund for this order. That avoids the confused deputy problem (a trusted service abused to use its own power for someone else).
Trade-offs
- Not everything should be split: keep security-critical, tightly coupled logic (such as the authorization decision) in few places.
- Each rebuilt control costs operations effort. Sequence the work: identity, then transport, then logging, then fine-grained policy. Splitting first and securing later leaves a long window with a flat, trusting internal network.
- Failure behavior now needs a decision: if the policy service is down, sensitive actions fail closed (deny, so that doubt means refusal rather than access), low-risk reads may use a short cache.
Here is an architecture: public web servers, a single application tier, and one database, all sitting behind one firewall. Where does the failure of a single control turn into a full compromise, and what would you change first to bound the damage?
Sample Answer
Direct answer
In this design one firewall is the only boundary, so any single failure turns into full compromise at three main points (the first three rows of the table below; the last three rows are amplifiers that make any breach worse): a compromised public web server sits on the same flat network as the app and the database; the single app tier holds a database credential that is probably broad; and the firewall itself is one policy, one admin plane and one failure point. I would change the network first: split the three tiers into separate zones with deny-by-default rules between them, because it is quick and limits every later failure.
Where one failure becomes everything
| Weak point | What fails | Result |
|---|---|---|
| Flat network behind one firewall | A web server is exploited | Attacker can scan and reach the app and database directly |
| Firewall rules too broad or misconfigured | One bad rule | All tiers exposed at once, no second boundary |
| App tier holds a broad database login | App is exploited (for example SQL injection) | Attacker can read and write all data, as the app can |
| One database for all data | Any database access | Everything is in the blast radius (the amount of damage one failure can cause) |
| No egress (outbound) filtering | Any host compromised | Data can leave freely; the attacker can fetch tools |
| Logs only on the same hosts | Host compromised | Attacker deletes the evidence |
What I would change, in order
- Segment into three zones: web servers in a DMZ (demilitarized zone, a network segment for internet-facing hosts), app tier and database in separate private segments. Allow only web to app on one port and app to database on one port; everything else denied. A web-server compromise now yields a web-server compromise, not the database. Enforce the zone boundaries at separate enforcement points rather than as more rules on the one existing firewall: for example host-level or cloud security-group rules on each tier, administered from a different account or console than the edge firewall, or a second internal firewall with its own admin credentials and rule source. If one device and one admin plane enforce every boundary, a single bad rule or one stolen admin login still removes all of them.
- Shrink the database login: a dedicated account for the app with only the operations on the tables it uses, no administrative rights. This bounds what a hacked app can do.
- Restrict outbound traffic from each zone to what it needs, and ship logs off-host to a separate system.
- Then separate sensitive data into its own store and add a second control type (such as a WAF in front of the web tier).
What would change my order
If the known weakness is SQL injection in the app, I would do the database account first. If the firewall is the bigger worry (for example a poorly governed rule set), the segmentation comes first anyway, provided it is enforced at separate points (see step 1), because then it adds a second boundary.
Pitfall
Adding more rules to the same single firewall is not a second layer; the layers must fail independently.
Design a multi-region service so that the full compromise of one region, including its compute and network, cannot expose data or secrets in the others. What trade-offs are you accepting for failover?
Sample Answer
Direct answer
I treat each region as a separate trust zone (a cell) with its own accounts, keys, secrets and data, and I make sure no credential or key in one region can read anything in another. Then I accept slower, gated failover as the price. The question is not whether regions copy data to each other, but whether an attacker holding everything in region A, including administrator rights there, can turn that into read access in region B.
Design
flowchart LR
subgraph RegionA[Region A: own account, keys, secrets]
A1[Compute] --> A2[(Data A)]
end
subgraph RegionB[Region B: own account, keys, secrets]
B1[Compute] --> B2[(Data B)]
end
P[Deploy pipeline outside both regions] --> RegionA
P --> RegionB
A2 -. one-way replica, B key, A has no read .-> B2
- Separate cloud accounts or projects per region. The account is the strongest boundary the cloud offers. No role in A can be assumed from B and the reverse.
- Per-region keys and secrets. Each region has its own encryption keys and secret store with no shared master key. A key that exists in two regions defeats the isolation.
- Home-region data. Where the business allows, keep each tenant's data only in its home region, so the other regions do not hold it at all.
- Replication that cannot be turned backwards. For disaster recovery, replicate one way with a write-only permission into the replica, encrypted under the replica region's own key. This works because encryption needs only the write side of a key: region B's key service hands the replication role a fresh one-time data key (the key service returns it both in the clear and in a copy locked by B's key). The role encrypts each object with it, stores the locked copy beside the object and discards the clear one. Region A's role is granted that generate-data-key action and permission to put objects in the replica bucket, but not the decrypt action and not get-object, so it can add data under B's key without ever being able to read any of it back. The source region's compromise lets an attacker push junk or delete in the replica unless it has versioning and retention locks, so enable those: versioning keeps every earlier copy of an object when it is overwritten, and a retention lock (object lock, in its strict mode, which AWS calls compliance mode) refuses deletion of a version for a fixed period, say 30 days, even to an administrator or the root user in the replica account. The softer governance mode can be bypassed by anyone granted the bypass permission, so it does not give this guarantee.
- No trust by network location. Calls between regions use short-lived, narrowly scoped credentials, and the receiving region checks authorization per request. "It came from region A" is not an authorization.
- Shared things are common failure points. The deployment pipeline, identity, DNS and configuration service reach all regions. Keep the pipeline outside the regions, give it a separate deploy role per region, require approval for production changes, and monitor for deploys that touch all regions at once.
A worked trace (illustrative)
Region A is us-east and region B is eu-west. An attacker takes full control of A's servers and its administrator role. They try to read B's database: A's role is not trusted in B's account, so the call is refused. They try to read the replica bucket in B: the role lacks get-object, and even if an object were fetched it is encrypted under B's key, whose decrypt action A's role does not hold. They try to delete or overwrite the replica: the retention lock refuses deletion, and an overwrite only adds a new version, so the clean version can be restored. They try the pipeline route: it sits outside both regions and holds a separate deploy role per region, so a push needs approval and a simultaneous push to all regions raises an alert. The attacker's real gain is limited to region A's own data and the ability to add junk to the replica. The guarantee is directional: any data replicated INTO a region is exposed if that region is compromised, so in this one-way design a full compromise of region B would expose the replica of A's data (B holds the key). Replicate only the datasets disaster recovery needs, and if both regions must back each other up, each holds the other's replica and the isolation claim weakens to the data that was never replicated.
Trade-offs for failover
- Slower recovery. Promoting the replica needs a human-approved key grant and runbook, rather than automatic failover. Say, as an illustration, minutes of automated failover traded for tens of minutes. The business has to pick that number against the downtime cost.
- Data loss window. One-way asynchronous replication (the source commits a write first and copies it afterwards) means the replica lags, so recovery loses the most recent writes. The amount of recent data the business can afford to lose, expressed as time, is the recovery point objective (RPO); measure the replication lag and compare it with that target.
- Cost and operations. Duplicated key management, accounts, monitoring and testing.
- Weaker global features. No cross-region read, global search or shared cache without a deliberate, scoped exception.
What would change my call
If availability truly outranks confidentiality (for example a public information service), I would allow automated failover with per-region keys still separate.
Unlock Full Question Bank
Get access to all 41 Secure Architecture and Design Principles interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.