ArchitectMind
  1. Home
  2. Java Ecosystem
  3. Book 9 · Cloud, Containers, DevOps & Production Architecture
  4. Volume VI
  5. Security
Book 9 · Volume VI — Production Architecture & Reliability Engineering · Topic 1.4

Security

Security readiness for launching and operating production services

11 min readStage 4 · Production & architecture10 interview questions
Chapter
Chapter 1 — Production Readiness
Prerequisites
Volume V Chapter 6; Topic 1.1
You will be able to
Assess security readiness for a service launch, run threat modelling, verify identity, data, network and secret controls, confirm vulnerability and detection coverage, prepare incident response, map compliance obligations and document residual risk
Covers
Security (production readiness)
On this page
  1. 1. Concept / Definition
  2. 2. Why It Exists
  3. 3. Core Concepts — Security Readiness
  4. 4. How It Works Internally — Threat Modelling a New Service
  5. 4A. Deep Dive — Authorisation Readiness
  6. 4B. Deep Dive — Data Protection
  7. 4C. Deep Dive — Detection and Response Readiness
  8. 4D. Deep Dive — Compliance Mapping
  9. 5. APIs / Features / Syntax
  10. 6. Practical Examples
  11. 7. Common Problems & Mistakes
  12. 8. Performance & Production Considerations
  13. 9. Architecture & Design Considerations
  14. 10. Interview Questions & Answers

1Concept / Definition

Security readiness confirms, before and after launch, that a service's design, code, dependencies, data handling, identity, network exposure and monitoring meet security requirements for its risk level — and that the organisation can detect and respond if something goes wrong. It turns DevSecOps pipeline controls and architecture decisions into launch evidence.

Security readiness checklist
Figure 1 — Security readiness checklist
Security review in the launch path
Figure 2 — Security review in the launch path
VocabularyMeaning
Threat modelStructured analysis of threats and mitigations
STRIDESpoofing, Tampering, Repudiation, Information disclosure, DoS, Elevation
Residual riskRisk remaining after controls, formally accepted
Security use caseDetection rule for a specific attack
Table 1 — Terms

2Why It Exists

Launch security gapReal consequence
Missing object-level authorisationCustomers read others' orders
PII in logsData protection breach
No rate limitingCredential stuffing, scraping
No detection rulesBreach unnoticed for months
Table 2 — Why
Findings caught before launch (last 12 launches)
Figure 3 — Findings caught before launch (last 12 launches)

3Core Concepts — Security Readiness

AreaEvidence for tier-0/1
Threat modelSTRIDE per data flow, reviewed by AppSec
IdentityOIDC for users; mTLS + authorisation policies between services; least-privilege IAM
AuthorisationObject-level tests (two-user), role matrix tests
DataClassification, KMS encryption, TLS 1.2+, masking/tokenisation, retention
SecretsSecrets Manager/External Secrets, rotation, none in code/images
NetworkWAF rules, rate limits, private subnets, egress allowlist, NetworkPolicies
VulnerabilitiesSAST/SCA/container/DAST clean for high; pen test for tier-0
DetectionSecurity logs to SIEM; use cases for the service
ResponsePlaybooks, contacts, forensic readiness
Table 3 — Readiness areas

4How It Works Internally — Threat Modelling a New Service

StepShopNow merchant-webhooks example
Diagram data flowsMerchant config → service → outbound HTTP to merchant URLs
Identify trust boundariesInternet ↔ VPC; service ↔ merchant endpoints
Apply STRIDE per flowSSRF (tampering/info disclosure), replay (spoofing), DoS via slow endpoints
MitigationsURL allowlist + egress proxy, HMAC signatures with timestamps, timeouts + circuit breakers
VerifyCustom SAST rule, DAST tests, chaos test for slow endpoints
Record residual riskMerchants misconfiguring secrets → documented
Table 4 — From diagram to evidence

4ADeep Dive — Authorisation Readiness

LayerControlTest
EdgeJWT validation (issuer, audience, expiry)Expired/forged token tests
Service method@PreAuthorize with ownership checksTwo-user BOLA tests
Service-to-serviceIstio AuthorizationPolicy (principal allowlist)Denied call from unauthorised SA
DataRow-level filters by tenantCross-tenant query test
Table 5 — Defence in depth for access control

4BDeep Dive — Data Protection

Data classControls
Card data (PayGrid)Tokenisation at edge; PAN never in ShopNow systems
PII (name, phone, address)Encryption at rest (KMS CMK), masked in logs, access audited
CredentialsHashed (Argon2/bcrypt), never logged
Order historyRetention 7 years, archive to Glacier with Object Lock
DPDP Act 2023Consent records, purpose limitation, deletion workflows
Table 6 — Classify, then protect

4CDeep Dive — Detection and Response Readiness

Use caseSignalResponse
Credential stuffingLogin failure spikes per IP/ASNWAF rate rules, CAPTCHA, alert
Data exfiltrationUnusual export volumesPage security on-call
Privilege escalationIAM policy changes in prodGuardDuty/Config alert
Container compromiseGuardDuty runtime findingsIsolate pod, rotate creds
Secret leakSecret scanning alertsRotate within 1 h
Table 7 — Service-specific detection

4DDeep Dive — Compliance Mapping

ObligationService control
PCI DSS 4.0 (PayGrid CDE)Segmentation, encryption, logging, quarterly scans, annual pen test
RBI cyber security framework (NovaBank)SOC monitoring, incident reporting within 6 h
DPDP Act 2023 (all)Data minimisation, breach notification, consent
ISO 27001 (org)Access reviews, change management
Table 8 — Launch evidence doubles as compliance evidence

5APIs / Features / Syntax

JAVA
// Object-level authorisation with a reusable ownership check
@GetMapping("/orders/{id}")
@PreAuthorize("hasRole('CUSTOMER')")
OrderView get(@PathVariable UUID id, @AuthenticationPrincipal Jwt user) {
    var order = orders.findById(id).orElseThrow(NotFoundException::new);
    ownership.requireOwner(order.customerId(), user.getSubject());   // 404 if not owner
    return OrderView.from(order);
}
YAML
# Istio: only the checkout service account may call payments
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata: { name: payments-allow-checkout, namespace: payments }
spec:
  action: ALLOW
  rules:
    - from:
        - source: { principals: ["cluster.local/ns/checkout/sa/checkout"] }
      to:
        - operation: { methods: ["POST"], paths: ["/payments/*"] }
HCL
# WAF rate-based rule protecting login
resource "aws_wafv2_web_acl" "edge" {
  name  = "shopnow-edge"
  scope = "CLOUDFRONT"
  default_action { allow {} }
  rule {
    name     = "login-rate-limit"
    priority = 1
    action { block {} }
    statement {
      rate_based_statement {
        limit              = 300
        aggregate_key_type = "IP"
        scope_down_statement {
          byte_match_statement {
            search_string         = "/auth/login"
            positional_constraint = "STARTS_WITH"
            field_to_match { uri_path {} }
            text_transformation { priority = 0, type = "NONE" }
          }
        }
      }
    }
    visibility_config {
      sampled_requests_enabled   = true
      cloudwatch_metrics_enabled = true
      metric_name                = "login-rate"
    }
  }
  visibility_config { sampled_requests_enabled = true, cloudwatch_metrics_enabled = true,
                      metric_name = "edge" }
}

6Practical Examples

6.1 BOLA caught pre-launch

The order-history API checked authentication but not ownership. The two-user DAST test in the PRR found it; the ownership helper and a SAST rule now prevent recurrence.

6.2 Credential stuffing on launch day

A new login API saw 40k attempts/min from botnets hours after launch. WAF rate rules and bot control, prepared during readiness review, blocked 98% automatically.

6.3 PII in logs

Readiness review sampled logs and found full addresses in debug logs. Log masking for annotated fields was added to the golden-path logging library.

6.4 Worked example — STRIDE table

ThreatFlowMitigation
SpoofingWebhook to merchantHMAC signature + timestamp
TamperingMerchant URL inputAllowlist + validation
DoSSlow merchant endpointTimeouts, bulkhead
Table 9 — Structured threats

6.5 Worked example — pen test scope

In scopeOut of scope
APIs, auth flows, business logicDoS, social engineering
Table 10 — Clear scope

6.6 Worked example — egress control

ControlDetail
Egress via proxy with domain allowlistBlocks exfiltration and SSRF targets
Table 11 — Outbound matters too

6.7 Worked example — interview whiteboard

PromptAnswer outline
"What security evidence do you require before launch?""Threat model (STRIDE per data flow) with verified mitigations; identity (OIDC, mTLS, least-privilege IAM) and authorisation tests including object-level; data classification with encryption, masking, retention and privacy obligations; secrets in a manager with rotation; network exposure controls (WAF, rate limits, private subnets, egress allowlist, network policies); clean SAST/SCA/container/DAST and pen test for tier-0; SIEM logging and service-specific detection use cases; incident playbooks; compliance mapping; documented residual risk accepted by owners."
Table 12 — Structured answer

6.8 Worked example — PayGrid CDE launch

Extra requirementEvidence
Segmentation testPen tester confirms CDE isolation
Key managementHSM-backed keys, dual control
Table 13 — PCI readiness

6.9 Worked example — anti-patterns

Anti-patternEffect
Security review after launchExpensive fixes
Relying only on scannersLogic flaws missed
No detection rulesBlind to attacks
Unowned residual riskSurprises
Table 14 — Common mistakes

6.10 Worked example — security headers

HeaderSource
HSTS, CSP, X-Content-Type-OptionsCloudFront response headers policy
Table 15 — Central configuration

6.11 Worked example — IAM least privilege

ToolUse
IAM Access Analyzer policy generationTighten role permissions from activity
Table 16 — Evidence-based permissions

6.12 Worked example — security logging content

EventFields
Auth success/failure, admin actions, data exportsUser, IP, resource, result, trace ID
Table 17 — Useful for investigation

6.13 Worked example — incident response readiness

ItemDetail
Playbooks for credential leak, data exposureTested
Forensics: snapshot and log retentionReady
Table 18 — Prepared to respond

6.14 Worked example — third-party risk

DependencyCheck
SMS providerData handling, breach notification terms
Table 19 — Vendors extend the attack surface

6.15 Worked example — privacy by design

PracticeDetail
Collect only needed fieldsMinimisation
Deletion APIDPDP rights
Table 20 — Privacy requirements at launch

6.16 Worked example — interview follow-ups

Follow-upAnswer
"Who accepts residual risk?"Service/product owner with security advice
"Pen test for every launch?"Tier-0 and major changes; DAST for others
Table 21 — Common probes

6.17 Worked example — checklist

Item✔
Threat model✔
Identity + authorisation tests✔
Data protection✔
Network exposure controls✔
Vulnerabilities clean✔
Detection + response✔
Table 22 — Security readiness baseline

6.18 Worked example — bot management

ControlUse
AWS WAF Bot ControlScraping and credential stuffing
Table 23 — Automated abuse

6.19 Worked example — rate limiting in services

LimitScope
Per user, per endpointIstio local rate limit / Bucket4j
Table 24 — Protect business logic

6.20 Worked example — security SLOs

MetricTarget
Critical vulns open > 7 days0
Mean time to contain security incidents< 1 h
Table 25 — Measurable security

6.21 Worked example — interview scenario

QuestionAnswer
"Launch in 2 days, pen test found high issue"Fix or mitigate (WAF, flag off feature), else no-go; document
Table 26 — Security is part of go/no-go

6.22 Worked example — secrets readiness

CheckEvidence
No static cloud keysIAM analysis
Rotation configuredSecrets Manager status
Table 27 — Proven, not assumed

7Common Problems & Mistakes

MistakeFix
Late securityThreat model at design
Scanner-only viewLogic tests, pen tests
No monitoringUse cases
Implicit riskDocumented acceptance
Table 28 — Mistakes and fixes

The most damaging security readiness gaps are usually not missing tools but missing context. Scanners run clean while the service has a broken object-level authorisation check, because no scanner knows that customer A must not read customer B's order. Threat models are written once at design time and never updated, so a later feature such as merchant-supplied webhook URLs introduces SSRF without review. Logging is enabled, but nobody has written a detection rule for the service's own abuse cases, so credential stuffing or bulk exports go unnoticed. Secrets move into Secrets Manager but rotation is never tested, and the first rotation breaks production. Residual risk is accepted implicitly by launching anyway, with no named owner or review date. A readiness review should therefore sample real evidence, such as a two-user test result, a masked log line and a fired test alert, rather than accept a ticked checklist.

8Performance & Production Considerations

ConsiderationPractice
WAF latency and false positivesCount mode first
mTLS overheadAcceptable; monitor
Log volumeSecurity-relevant events
Table 29 — Operating security controls

Security controls run in the production path, so they need the same operational care as any other component. Deploy new WAF rules in count mode first, review sampled requests for false positives against real traffic for a few days, then switch to block, and keep a fast way to disable a single rule if it starts rejecting customers. Istio mTLS adds a small CPU cost and around a millisecond per hop, which is acceptable for most services but should be measured on latency-sensitive paths such as checkout. Security logging can become expensive, so log security-relevant events in full, such as authentication, authorisation failures, admin actions and data exports, and sample the rest. Route GuardDuty, Security Hub and service-specific alerts to an owned on-call rotation with response targets, and review alert quality monthly so noisy rules are tuned before people start ignoring them.

9Architecture & Design Considerations

GuidelineDetail
Security by designThreat models
Defence in depthLayers
Detect and respondAssume breach
Table 30 — Design guidance

10Interview Questions & Answers

Q1L1 · BasicConcept

What does security readiness cover?

Security readiness covers everything that determines whether a service can be attacked successfully and whether you would notice. That means the design, verified through a threat model; code and dependencies, checked with SAST, SCA, container scanning and DAST, plus a pen test for tier-0; identity and authorisation, including object-level checks and service-to-service mTLS; data protection through classification, encryption, masking and retention; secrets management and rotation; network exposure through WAF, rate limits, private subnets and egress control; and detection and incident response, with SIEM use cases and tested playbooks. It ends with compliance mapping and documented residual risk accepted by the service owner, all backed by evidence.

Q2L1 · BasicConcept

What is STRIDE?

STRIDE is a threat modelling taxonomy from Microsoft that helps you ask structured questions about each data flow and trust boundary. Spoofing is pretending to be another user or system, countered by authentication. Tampering is modifying data or code, countered by integrity controls. Repudiation is denying an action, countered by audit logs. Information disclosure is exposing data, countered by encryption and authorisation. Denial of service is exhausting resources, countered by rate limits and timeouts. Elevation of privilege is gaining rights you should not have, countered by least privilege. For ShopNow's merchant webhooks it surfaced SSRF, replay attacks and slow-endpoint DoS, each with a mitigation.

Q3L2 · IntermediateDesign

How do you test authorisation?

Test authorisation explicitly, because most scanners cannot know your access rules. Start with a role matrix listing which roles may perform which operations, and generate tests that call every endpoint as each role, expecting allow or deny. Then add object-level tests, often called two-user tests: create a resource as user A and try to read, update or delete it as user B, expecting a 404 or 403. Do the same across tenants. Run these in the acceptance stage and as DAST in staging, and add SAST rules that flag controller methods without an ownership check. ShopNow's two-user test caught a broken object-level authorisation flaw in order history before launch.

Q4L2 · IntermediateInternals

How is service-to-service access controlled?

Service-to-service access needs both authentication of the caller and an authorisation decision. In a mesh such as Istio, every workload gets a cryptographic identity, a SPIFFE ID tied to its Kubernetes service account, and sidecars or ambient proxies establish mutual TLS automatically, so the receiver knows exactly which service is calling and traffic is encrypted. AuthorizationPolicy resources then allow only specific principals, methods and paths, such as only checkout may POST to payments. Network policies add a layer-3 and layer-4 boundary underneath, and IAM roles for service accounts control access to AWS APIs. Where there is no mesh, OAuth2 client-credentials tokens with audience checks are the alternative.

Q5L3 · Senior EngineerDesign

How do you prevent PII leaks in logs?

Prevent PII leaks in logs by design rather than by policing. First classify data, so developers know which fields are personal, such as names, phone numbers and addresses. Then build masking into the shared logging library, for example annotations on DTO fields or a Logback converter that masks known patterns, so services get it by default. Log identifiers and trace IDs instead of payloads, keep debug logging off in production, and never log request bodies or credentials. Verify it during readiness reviews by sampling real logs, and add automated scanning of log streams for PII patterns. ShopNow found full addresses in debug logs this way and fixed the golden-path library.

Q6L3 · Senior EngineerDesign

What detection should a new service have?

A new service should send its security-relevant events, such as authentication outcomes, authorisation failures, admin actions and data exports, to the SIEM with user, IP, resource, result and trace ID, alongside platform signals such as CloudTrail, GuardDuty and WAF logs. Generic coverage is not enough, so define service-specific use cases from the threat model. For a login API that means alerting on failure spikes per IP or ASN for credential stuffing; for an export endpoint, unusual export volumes per user. Each use case needs a signal, a threshold, an owner and a response playbook, and should be tested by firing a synthetic event before launch to prove the alert reaches on-call.

Q7L4 · Technical ArchitectTrade-off

When is a pen test required?

Require a pen test where the risk justifies the cost and lead time: tier-0 services handling money, credentials or sensitive personal data, new externally exposed attack surfaces such as a public API or authentication flow, and major architectural changes. Regulation can make it mandatory, as PCI DSS does with annual and post-change penetration tests and segmentation testing for PayGrid's cardholder data environment. Define the scope clearly, usually APIs, authentication and business logic, excluding denial of service and social engineering. For lower-tier services, automated DAST in the pipeline and two-user authorisation tests give continuous coverage. Pen test findings must be fixed or formally accepted before go-live.

Q8L4 · Technical ArchitectScenario

How do WAF rules support readiness?

WAF rules give a service protection at the edge from launch day, before attackers find it. Rate-based rules limit requests per IP on sensitive paths such as login, password reset and OTP, blunting credential stuffing and brute force. AWS WAF Bot Control identifies automated clients for scraping and abuse, managed rule groups block common exploit patterns, and geo or IP reputation rules cut known-bad sources. In readiness review you confirm rules exist for the service's endpoints, were tested in count mode, and alert when they fire. ShopNow's new login API saw 40,000 attempts per minute hours after launch, and prepared rules blocked 98% automatically.

Q9L5 · Solution ArchitectBehavioural

Who owns residual risk?

Residual risk is owned by the accountable business owner of the service, typically the product or service owner, not by the security team. Security advises: it explains the threat, likelihood, impact and available mitigations, and may recommend against launch. But the person accountable for the outcome decides whether the business accepts the remaining risk, and that decision is documented with the risk description, compensating controls, an expiry or review date and the approver's name. For high risks the approval may need to escalate, for example to a CISO or risk committee. Unowned, implicit risk is a common failure, because nobody revisits it when circumstances change.

Q10L5 · Solution ArchitectConcept

How does readiness support compliance?

Readiness evidence and compliance evidence are largely the same artefacts, so collect them once and map them to each obligation. A threat model, encryption configuration, access tests, scan results and pen tests show the controls exist; SIEM use cases and incident playbooks show detection and response. For PayGrid that maps to PCI DSS 4.0 requirements such as segmentation, encryption, logging and testing; for NovaBank to the RBI cyber security framework, including six-hour incident reporting; and for all services to DPDP Act 2023 obligations such as minimisation, consent and breach notification. Storing evidence per launch makes audits a retrieval exercise rather than a scramble to reconstruct.

Test your knowledge on this topic →Flashcards from this topic's 10 questions, filtered by level and type.

Free question pack

Get 100 free Core Java interview questions

Subscribe for the Book 1 question pack (PDF, every answer explained) and new tutorials once a week. No spam, unsubscribe anytime. What is in the pack?

Almost done! Check your inbox and click the confirmation link. Your download link arrives as soon as you confirm.