Application Security and Production Readiness

Moving the security design into code: backend authorization, the role model, secret handling, safe logs, and a production readiness checklist with evidence.

  • Advanced
  • About 16 minutes
  • Includes an exercise and a knowledge check

The concept Security lives in the backend

Module 06 designed the security architecture; now the code enforces it: authentication, role- or policy-based authorization, API access restrictions, input validation, secret management, sensitive-data handling, audit and safe error handling. Security cannot depend on what the UI shows.

Top left, the React screen for a customer support user with the Approve button hidden. Bottom left, the same user calls POST /api/v1/exceptions/EXC-10022/approve directly with their token: hiding the button stopped nothing. Right, the backend checks every request: authenticate the token, load the role CUSTOMER_SUPPORT, APPROVE needs FINANCE_SUPERVISOR, refuse and record it. It answers 403 Forbidden with an error code and correlation ID and writes a security audit entry: user-310 APPROVE denied by role.
The button is hidden. The API is not.

javaAuthorization on the method, not on the screen (Spring Security sketch)

@PostMapping("/{id}/approve")
@PreAuthorize("hasRole('FINANCE_SUPERVISOR')")
ResponseEntity<CaseResponse> approve(@PathVariable String id, Authentication user) {
    return ResponseEntity.ok(cases.approve(id, user.getName()));   // maker-checker checked inside
}

Who may do what The initial role model

RoleMayMay not
Finance analystView permitted transactions, investigate assigned cases, add notes, submit resolutionsApprove resolutions
Finance supervisorReview investigations, approve or reject resolutions submitted by others, view relevant auditApprove their own submissions
Customer supportView approved transaction statusAny case action or financial operation
Platform administratorRun approved platform operationsBusiness approvals, by default

These are a starting point: Apex must approve the actual permissions. The platform administrator deliberately has no automatic business approval rights; operating the system and approving money are separate duties.

Keep them out Configuration, secrets and logs

  • Environment-specific configuration, with secrets from AWS Secrets Manager or an approved store.
  • Workload identity (IAM roles) instead of long-lived keys, and credential rotation.
  • Least-privilege database users: the application cannot drop tables or edit audit rows.
  • No real secrets in Git, ever, and a secret scanner in the pipeline to catch mistakes.
  • Structured logs with safe identifiers and correlation IDs; never passwords, tokens, full payment credentials, unnecessary personal data or raw source payloads.

Before release The production readiness checklist

On the left, a photo of a pilot working through a printed preflight checklist in a cockpit. On the right, the checklist. Configuration: application configuration, secret access, database migrations. Health: health and readiness checks, dependency behavior, request timeouts, retry settings, graceful shutdown, resource limits. Visibility: logging, metrics, tracing. Safety: security and dependency scans, backup configuration, recovery documentation. Logs never contain passwords or access tokens, full payment credentials, unneeded personal data or raw source payloads. No release until every line has evidence.
Nobody takes off without the checklist, and every line needs evidence.

Practice Run a readiness review

Practical exercise

Exercise 11: the production readiness assessment

Review the application as if it ships tomorrow.

  1. Authentication and authorization tests for every role and endpoint.
  2. Secret-management verification and a sensitive-data logging review.
  3. Dependency and vulnerability scan results.
  4. Health and readiness endpoints, and the production configuration checklist.
  5. Security findings with a remediation plan.
Show sample findings
  • High: the notes endpoint logged the full request body, including loan account data. Fix: log the case ID and correlation ID only.
  • Medium: one library had a known vulnerability. Fix: upgrade, and fail the build on high-severity findings.
  • Low: the readiness check did not include the broker. Fix: report NOT READY when the outbox publisher cannot connect.

2 questions

Check your understanding

1. Why is hiding a UI button not enough authorization?
2. Should the platform administrator approve financial resolutions by default?
Answer every question to submit.

What you can do now

  • Enforce authorization in backend code.
  • Propose a least-privilege role model.
  • Keep secrets and sensitive data out of code and logs.
  • Run a production readiness review with evidence.