Zero Trust, Segmentation, and Service-to-Service Security Questions
Designing network and service-communication trust models where no implicit trust is granted by network location. Covers zero-trust access, microsegmentation and identity-aware perimeters, least-privilege network access, lateral-movement prevention, and segmenting environments to contain blast radius, together with securing service-to-service communication in distributed and microservices architectures: mutual authentication between services, service mesh security, multi-tenancy isolation, east-west traffic, and the security implications of scale and geographic distribution. The architectural trust-boundary pattern and its enforcement across decomposed, high-scale systems, distinct from device-level firewall configuration.
You find an internal host beaconing to a suspicious internal IP in a different network zone, a sign of active lateral movement. Draft a containment plan using segmentation controls (access rule changes, microsegmentation, host-based firewall policy) that stops the spread while minimizing disruption to legitimate traffic, and describe how you would verify containment actually held.
Sample Answer
Contain fast without destroying evidence: isolate the host at the segmentation layer, not by powering it off, tighten its reachability to nothing except a monitored forensics path, and verify containment by confirming, from telemetry outside the host itself, that the beaconing traffic has actually stopped and the host can no longer reach anything it previously could.
Step 1: isolate without destroying evidence
Rather than shutting the host down, which can lose volatile evidence such as in-memory malware artifacts, or manually killing the suspicious process, which can tip off active command-and-control (some malware has dead-man-switch behavior), move the host into a quarantine segment or apply a host-based firewall policy that denies essentially all outbound and inbound traffic except a narrow, monitored path to incident-response tooling.
Step 2: contain with layered segmentation controls
Combine several levers rather than relying on one: revoke or change the host's existing access-rule membership (an access-rule change removing it from whatever security group previously granted it broad reach); apply microsegmentation-style explicit deny rules for the specific suspicious internal address and any other destinations flagged during triage; add a host-based firewall policy on the host itself as a second, independent layer; and, if the host holds a workload identity or certificate, revoke it so even a valid-looking authenticated request from it is rejected by other services' policy.
Step 3: narrow the blast radius further
Rotate any credentials or secrets the host had access to, on the assumption that isolation stops FUTURE misuse but doesn't undo anything already taken.
Step 4: verify containment actually held
Don't rely on "I applied the rule" as proof. Confirm from independent telemetry, network flow logs, the destination's own connection logs, or the segmentation control plane's enforcement confirmation, that the specific beaconing pattern has stopped appearing after the change, that the host can't reach any segment or service it could reach before, and that no OTHER host has started showing a similar beaconing pattern, which would indicate the compromise had already spread before containment.
Worked example
A host is observed beaconing every few minutes to a suspicious internal address in the payments segment. Containment: move the host's security-group membership from its normal tier to a quarantine group that denies all except a forensics jump host; add an explicit deny rule for the specific destination address at the payments segment boundary as a second layer, in case the quarantine change is delayed or incomplete; and revoke the host's workload certificate so any request it still manages to send is rejected by identity-aware policy on the receiving end, not just blocked at the network. Verification, roughly fifteen minutes later: flow logs show zero connections from the host to the previously targeted address, and payments-segment access logs show zero requests bearing the host's now-revoked identity, confirming both the network path and the identity path are closed, not just one of the two.
Trade-offs and pitfalls
Isolating too aggressively, killing the process or shutting the host down, can destroy forensic value and, in some cases, trigger a scripted destructive response from the malware faster than a quiet network-level isolation would; isolating too slowly to preserve evidence risks continued lateral movement while you wait. Most incident-response playbooks resolve this by favoring immediate network-level containment, fast and low-risk of tipping off the attacker, while deferring host-level forensic actions like memory capture or a process kill to a separate, deliberate step once network isolation is confirmed.
Walk through onboarding a new employee and their corporate-managed device into a zero-trust environment: identity proofing, device enrollment, certificate or key issuance, initial posture checks, policy assignment, and ongoing monitoring.
Sample Answer
Direct answer
Onboarding a new employee and their corporate-managed device into zero trust means establishing two linked identities, the person and the device, before either gets meaningful access, then continuously verifying both, rather than treating enrollment as a one-time gate that is trusted forever afterward.
Structured elaboration
- Identity proofing: verify the person is who they claim to be before creating their account, typically through HR-verified documents plus a manager or HR sign-off, feeding the identity provider (IdP) as the authoritative source for this employee.
- Device enrollment: register the corporate-managed device with the mobile device management (MDM) system, which lets the organization enforce configuration policy on it and later query its state.
- Certificate or key issuance: issue the device, and often the user, a cryptographic identity tied to the enrollment record, so the device can later prove its identity cryptographically rather than by a shared secret alone.
- Initial posture checks: before granting any access, confirm the device meets baseline requirements, current operating system, disk encryption enabled, endpoint protection installed, the same signals used for ongoing checks later.
- Policy assignment: assign the new person-plus-device identity to access policies based on role, starting narrow, default deny beyond what the role explicitly needs, with more access requested and granted as it actually becomes necessary.
- Ongoing monitoring: after onboarding completes, continuously re-check posture and baseline behavior, so drift or compromise after day one is caught, not just the state captured at enrollment.
Worked example
A new engineer joins. HR verifies her identity and provisions an account in the identity provider (step 1). IT ships her a laptop pre-enrolled in the MDM system before it reaches her, which issues it a device certificate tied to her employee record during first boot (steps 2 and 3). Before she can access anything beyond an onboarding portal, an automated posture check confirms disk encryption is enabled and the operating system is current (step 4). Based on her role, backend engineer on the payments team, she is granted read access to the team's non-production systems by default, with production access left out entirely until she requests it through the normal access flow (step 5). From that point on, her device's posture and access patterns are checked continuously; if she later disables disk encryption or her laptop's operating system falls out of date, that policy assignment is automatically reduced until the issue is fixed (step 6).
Trade-offs and pitfalls
A common shortcut is granting broad access at onboarding "to make sure she can do her job on day one," planning to narrow it later. That narrowing almost never happens in practice, standing broad access granted from day one is one of the most common sources of unnecessary blast radius, precisely because it is granted before there is any concrete evidence of what is actually needed.
How should an API gateway enforce zero-trust controls at the edge of a system: token validation, scope/claim-based authorization integrated with a policy decision point, input validation, and rate limiting? What must still be enforced by the backend services themselves?
Sample Answer
Direct answer
An API gateway should handle the checks that make sense to do once, at the edge, before a request reaches any backend service: validating the request's token, checking coarse-grained scopes or claims against a policy decision point, and applying input validation and rate limiting. It cannot be the only enforcement point, though; backend services still need to independently authorize the specific action being requested, because a gateway can't reason about business-logic-specific authorization that only the service itself understands.
Structured elaboration
- Token validation: the gateway verifies the request carries a valid, unexpired, correctly signed identity token before doing anything else, rejecting malformed or expired tokens immediately and cheaply at the edge, rather than every backend service redundantly re-implementing that same check.
- Scope or claim-based authorization integrated with a policy decision point (PDP): beyond confirming a token is valid, the gateway checks whether its claims and scopes are sufficient for the requested endpoint, in some designs by consulting the PDP directly, so coarse-grained access decisions, whether this identity can call this API at all, happen once at the gateway rather than being reimplemented per service.
- Input validation: the gateway rejects malformed requests, wrong types, oversized payloads, invalid characters, before they reach a backend service's own parsing logic, reducing the attack surface each service has to defend on its own.
- Rate limiting: the gateway throttles request volume per identity or client, protecting backend services from a misbehaving client or a deliberate abuse pattern, again more efficient to enforce once at a shared edge than duplicated everywhere.
What must still be enforced by the backend services themselves: the gateway can confirm identity and coarse access, that a token is allowed to call the orders API, for example, but it generally cannot know fine-grained, resource-specific, business-logic-dependent rules: whether this specific user may view this specific order they did not create, whether an account's current state permits a specific action, or anything that depends on data only the service has. Those checks have to happen in the service itself, at the point where it actually holds the relevant data. Otherwise you get a well-known class of bug where the gateway correctly confirms a request is allowed to call an endpoint, but the service forgets to check whether the specific resource in that request actually belongs to the caller, sometimes called broken object-level authorization, precisely because it's easy to assume the gateway already handled "authorization" when it only handled the coarser layer.
Worked example
A request arrives for a specific order's details, with a valid token belonging to user A. The gateway validates the token, confirms it is unexpired, checks that its scope includes reading orders, confirms the request is well-formed, and checks that user A hasn't exceeded their rate limit, then forwards the request to the orders service. All of that is legitimate and correctly enforced at the gateway. But the requested order actually belongs to user B, not user A. If the orders service assumes the gateway already handled authorization and simply returns whatever order matches the identifier in the request, user A can read user B's order despite every gateway-level check passing correctly, because the gateway had no way to know which specific order belongs to which specific user, only the orders service, with access to that data, can make that check.
Trade-offs and pitfalls
The most common and serious mistake is exactly the example above: treating gateway-level scope checks as equivalent to full authorization and skipping the service-level ownership check, which produces vulnerabilities that pass every gateway-level test because the gateway was never the layer that could have caught them.
You're designing a multi-tenant microservices platform where tenants share infrastructure but must be isolated well enough for PCI-DSS or HIPAA compliance. Compare tenancy models (fully physical, per-namespace, or logical tenant-ID isolation), and describe network isolation, data separation, and audit logging for each, with the cost and complexity trade-offs.
Sample Answer
No tenancy model is compliant by itself; PCI-DSS (Payment Card Industry Data Security Standard) and HIPAA (the US Health Insurance Portability and Accountability Act) both care about where regulated data actually flows and how well it's controlled, not which architecture label you chose. The model you pick mostly determines how hard that control is to implement and how big the blast radius of a mistake is.
Comparing the three tenancy models
| Model | Network isolation | Data separation | Audit logging | Cost and complexity |
|---|---|---|---|---|
| Fully physical (dedicated infrastructure per tenant) | Real, hardware or VPC-level; no shared network path at all | Separate database instances per tenant, no shared schema | Nearly free to separate: each tenant's logs are physically distinct | Highest: infrastructure and patching cost scale with tenant count, config drift risk grows as tenants multiply |
| Per-namespace (shared cluster, dedicated namespace per tenant) | Strong if backed by enforced default-deny network policy; still shares the underlying node and control plane | Typically a dedicated database or schema per tenant | Manageable with disciplined per-namespace log tagging | Moderate: shared control plane amortizes cost, but a kernel or container-escape vulnerability is a shared-fate risk across tenants on the same node |
| Logical tenant-ID isolation (shared everything, isolation enforced in application logic) | Effectively none at the infrastructure layer; all tenants share the same network path | Shared tables with a tenant_id column, ideally backed by database row-level security as well | Cheapest to build (one log stream tagged by tenant_id), but draws the heaviest audit scrutiny | Lowest infrastructure cost, but the isolation guarantee is only as strong as the weakest query in the codebase |
Recommendation for PCI-DSS or HIPAA
Keep any component that actually touches cardholder data or protected health information on physical or namespace-level isolation at minimum, since mingling regulated data in a shared logical store tends to pull the entire shared database into audit scope for every tenant using it, not just the one being audited. Logical tenant-ID isolation is acceptable for everything else, provided it's backed by database row-level security as a backstop rather than relying solely on application code to remember the WHERE tenant_id = ? clause every time.
Worked example
A billing platform with 500 tenants running one fully physical instance per tenant means patching 500 separate database instances every time a CVE (Common Vulnerabilities and Exposures entry, a published record of a known security flaw) is disclosed. A shared cluster with per-namespace isolation needs one patch cycle for the shared control plane instead, which is why namespace isolation is the practical middle ground at that scale, while a small number of tenants with individual regulatory or contractual requirements for full dedication stay on the physical model.
Trade-offs and pitfalls
The physical model is the safest but the most expensive to operate at scale; the logical model is the cheapest but puts the entire isolation guarantee on code correctness, which is exactly the kind of thing a single missed filter defeats. The pitfall to watch for is treating the isolation model as the compliance answer by itself: an auditor is going to ask where cardholder data or protected health data actually lives and flows, and a shared logical store holding that data for multiple tenants typically brings the whole store into scope, regardless of how carefully the tenant_id column is enforced, unless the sensitive fields are tokenized out of the shared store entirely.
Design a Zero Trust Network Access architecture for a multinational organization with data centers and cloud regions spread across the globe. Identify enforcement points at the edge, in transit, and at the host; describe identity and device-posture verification; and explain how you'd limit lateral movement between regional workloads while still allowing the cross-region traffic the business needs.
Sample Answer
Treat each region as its own default-deny trust zone, put identity-and-posture evaluation at edge points close to where users and services actually are, and only open the specific cross-region paths the business genuinely needs, rather than open regional peering.
Enforcement points
- Edge: regional ZTNA (Zero Trust Network Access) points of presence, placed close to users and services in each geography, terminate the initial access request, evaluate identity and posture, and issue a short-lived, scoped session rather than opening a raw network tunnel to the target.
- In transit: cross-region and cross-datacenter traffic travels over mutually authenticated, encrypted channels (workload mTLS, or a private interconnect between the organization's own regions where one exists) instead of being trusted just because it's internal WAN traffic.
- Host: an agent on the endpoint or workload continuously attests posture (patch level, disk encryption, endpoint detection status for user devices; configuration drift checks for server workloads), feeding the access decision and re-checked periodically rather than only at initial login.
Identity and device-posture verification
Identity comes from the organization's central identity provider issuing short-lived tokens (for example, OIDC, OpenID Connect, tokens for users, and workload identities for services). Posture comes from the host agent's signed assertion. The policy engine combines both, "who is this, and is their device or workload currently healthy," before granting a session, and re-evaluates on a schedule rather than trusting the decision for the life of a long session, which is what makes this continuous authorization rather than a one-time login check.
Limiting lateral movement between regions
flowchart TB
subgraph US[us-east trust zone]
SUP[support-tool]
end
subgraph EU[eu-west trust zone]
CUST[customer-record-service]
end
subgraph AP[ap-south trust zone]
OTHER[other services]
end
SUP -- mTLS, read-only, explicit allow --> CUST
US -. default deny .-> AP
EU -. default deny .-> AP
AP -. default deny .-> US
Each region defaults to deny toward every other region, at both the network layer (segmented VPCs or datacenters, only specific interconnect paths open) and the identity layer (mesh authorization policy scoped to the specific allowed pair). A compromised host in one region cannot reach anything in another region just because a network path physically exists between the two.
Worked example
A support tool in the us-east region legitimately needs read-only access to a customer-record service in eu-west, for EU customers, a documented business need. The design grants only the support tool's workload identity a read-scoped path to that one service's read endpoint, over mTLS through a designated interconnect. Nothing else in us-east can reach anything in eu-west. If an unrelated us-east service is compromised, it has no path to eu-west at all, containing the compromise to the region it started in; ap-south, having no business relationship to either service, has zero default paths to or from either region.
Trade-offs and pitfalls
Evaluating identity and posture per request at global scale means the broker itself needs regional replicas for latency, since a user in one part of the world shouldn't round-trip every request to a single distant broker; that pushes you toward a synchronized global policy and identity store, which introduces its own consistency-lag problem, a just-revoked identity needs to propagate to every region promptly. The most common pitfall is applying default-deny thoroughly to user-initiated access while forgetting service-to-service traffic like backups, replication, or monitoring, which often ends up on a broad legacy allow because "someone will tighten it later." That traffic needs the same explicit allow-list discipline as everything else, or it becomes the quiet exception that undoes the whole design.
Unlock Full Question Bank
Get access to all Zero Trust, Segmentation, and Service-to-Service Security interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.