CR-SEC-009 · SECURITY, COMPLIANCE & NFR

Security, Compliance & Non-Functional Requirements

Security architecture, data protection, identity & access, audit, compliance posture, resilience and non-functional targets for Engagement & Loyalty Platform under bank-controlled deployment.

ConfidentialVersion: 1.0Date: 06 Jun 2026

Security Objectives

Protect bank and customer data with bank-controlled residency, enforce least-privilege access, guarantee the integrity of the loyalty ledger, and provide complete auditability — meeting the Bank security standards and applicable regulatory expectations.

The engagement layer inherits these guarantees end to end: inbound bank events (POST /api/v1/events) are deduplicated on a unique eventRef and scratch-card reveals post through the same immutable, exactly-once ledger — so event replay and re-scratch are safe by construction and every trigger-issued reward is fully audited.

Implementation status — target posture vs. current build. This document states the target security posture for the the Bank deployment. In the current build: request signing is HMAC-SHA256 only and feature-flagged off by default (SIGNATURE_VERIFY=off); the replay-nonce cache is in-process (a shared/Redis store is pending); and OAuth2, mTLS and admin SSO (OIDC/SAML) are the Bank-edge/deployment controls, not implemented in this repo. Encryption-at-rest, HSM/Vault, SIEM forwarding and hash-chained audit are environment-provided. Implemented today: RBAC roles & permissions, maker-checker dual control (config and campaign lifecycle), immutable append-only ledger with exactly-once idempotency, and full audit logging. Asymmetric signing (RSA/ECDSA), persistent nonce store and SSO are roadmap.

Deployment & Data Residency

Data Protection & Encryption

Encryption is layered across transport, storage and individual sensitive fields, with all key material managed centrally (Vault/KMS, optional HSM) and never embedded in code or images.

LayerControlDetail
In transit (internal)TLS 1.2+ / mTLSTLS 1.2 minimum (1.3 preferred), strong cipher suites only; mTLS between zones (DMZ↔App↔Data) and between services in the mesh; certificates issued by the Bank PKI.
In transit (partner)mTLS + signingAll egress to catalogue / fulfilment / notification partners over mTLS to allow-listed endpoints; payloads additionally signed (see Message Signing).
At restAES-256AES-256 for databases, backups, WAL/PITR archives, object storage & the secret store; transparent disk + DB-level encryption.
Field-levelpgcryptoVoucher codes and other high-sensitivity fields encrypted at column level via pgcrypto (key from Vault); stored ciphertext only, decrypted in-process on authorised reveal. See CR-DBS-013.
TokenisationPAN / PIINo raw PAN/PII stored; reversible tokens held only in the bank vault; Engagement & Loyalty Platform uses opaque customer_ref / card_ref. Voucher codes exchanged with partners as tokens, never raw in transit/logs.
MaskingUI / logs / exportsIdentifiers & voucher codes masked everywhere; full reveal gated by permission + step-up and audited.
Key managementVault / KMS / HSMCentral Vault/KMS; scheduled rotation (data keys ≤ 90d, signing keys per quarter), separation of duties for key access, dual-control for export; optional HSM for root/signing keys. Envelope encryption (DEK wrapped by KEK).
Data minimisationIngest scopeOnly fields required for rewards are ingested; retention & purge per DPDP.

Identity & Access Management

Message Signing & Verification

Beyond transport security and bearer tokens, value-bearing requests — reward redemptions, transaction reversals, ledger adjustments — and inbound fulfilment callbacks and settlement files are cryptographically signed and verified at the application layer. This binds each request to a known calling channel/partner, makes the payload tamper-evident, and (with nonce + timestamp + idempotency key) provides strong replay protection. The wire format, headers and worked examples are in CR-API-006.

AspectSpecification
AlgorithmsHMAC-SHA256 with per-client secret (default); RSASSA-PSS (RSA-2048+) or ECDSA ES256 for high-assurance partners, selected by X-Signature-KeyId.
Signed scopeCanonical string covers method, path, timestamp, nonce, idempotency key and a SHA-256 of the body — so headers and body are all bound.
Replay protectionTimestamp ±300s window + per-client unique nonce (10-min memory) + idempotency key; reuse is rejected (NONCE_REPLAYED).
Responses & webhooksServer signs responses on the redemption path; inbound webhooks verified before any side effect; mTLS + source allow-list in addition to signature.
Settlement filesDetached signature (.sig) over the file SHA-256; key id in the manifest; verified before ingest.

Key management & rotation

Verification flow

  1. Resolve KeyId → algorithm + key (reject unknown/disabled).
  2. Validate timestamp window, then nonce uniqueness.
  3. Recompute canonical string + body hash and constant-time compare the signature.
  4. Apply idempotency, then process; emit a signed response / advance the saga only after all checks pass.

Application Security

AreaControl
Input validationSchema validation, output encoding, parameterised queries (no SQL injection).
OWASP Top-10Controls for injection, broken access, SSRF, etc.; security tests in CI.
SecretsNo secrets in code/images; injected from Vault.
Dependency & image scanningSCA + container scans in pipeline; block on critical findings.
Rate limiting & WAFEdge throttling & WAF rules; bot/abuse protection.
IdempotencyPrevents replay-driven double accrual/redemption.

Integration Readiness

Each integration is assessed for protocol, authentication, application-layer signing, encryption, retry/idempotency, delivery receipts and source allow-listing. Communication integrations emphasise signed callbacks, delivery receipts and consent; reward integrations emphasise mTLS, request signing and allow-listing. Trust boundaries are shown in CR-ARC-004, Figure 10.

IntegrationProtocolAuthSigningEncryptionRetry / idempotencyDelivery receiptsAllow-listStatus
CBS / Card systemSFTP batch + RESTmTLS + OAuth2File .sig / req signatureTLS + AES-256Control totals; idempotent reloadAck file / 2xxYesReady
Transaction switchQueue / streammTLS + tokenMessage signature (optional)mTLSAt-least-once + idempotency keyOffset commitYesReady
the Bank IdP (SSO)OIDC / SAMLOIDC + MFASigned JWT / SAML assertionTLS 1.2+N/A (interactive)N/AYesReady
Notification GW (SMS/Email/Push/WhatsApp)REST / webhookmTLS + API keySigned send + signed delivery callbackTLS 1.2+Retry w/ backoff; idempotent message_idDelivery/read receipts ingestedYesReady (consent-gated)
the Bank digital channelsRESTChannel token + mTLSSigned redemption requestsmTLSIdempotency keySigned 2xxYesReady
Reward catalogueRESTmTLS + OAuth2Signed requestsmTLSCache + retry; read-only2xxYesReady
Voucher fulfilmentREST + webhookmTLS + OAuth2Signed request + signed webhookmTLS + tokenised codesIdempotency key; saga compensationSigned fulfilment webhookYesReady (signed, allow-listed)
CBS credit postingREST / batchmTLS + OAuth2Signed instruction / fileTLS + AES-256Idempotency key; recon confirmCredit confirmationYesReady
Communication readiness: sends and delivery/read receipts are signed and idempotent on message_id; recipient consent (DPDP) is checked before dispatch and receipts feed audit. Rewards readiness: catalogue, fulfilment and CBS posting are mTLS, request-signed and restricted to allow-listed endpoints, with signed callbacks and saga-based compensation.

Audit & Logging

Logging spans operational observability and a separate tamper-evident audit trail for security/financial/config events. All logs and audit records carry a correlation id for end-to-end traceability.

AspectDetail
Centralised loggingStructured JSON to a central platform (ELK/equivalent); every record carries X-Request-Id / trace context, actor, masked identifiers; no PII/secrets/raw voucher codes in logs.
Tamper-evident auditAppend-only, immutable audit_log (see CR-DBS-013) with hash-chaining / WORM storage so records cannot be altered or deleted; periodic integrity verification.
What is loggedConfig events (rule/campaign/catalogue/template/RBAC change with before→after & approver); financial events (accrual, reversal, redemption, adjustment, settlement); security events (auth success/failure, signature failures, nonce replays, key rotation/revocation, privilege changes, reveal/export of sensitive data).
Signing-event captureSIGNATURE_INVALID / SIGNATURE_EXPIRED / NONCE_REPLAYED / UNKNOWN_KEY are logged as security events with the offending KeyId and source for alerting.
RetentionAudit & approval history retained for the programme lifetime (and per regulatory minimums); operational logs per the Bank retention policy; encrypted backups of audit store.
SIEM forwardingSecurity events forwarded to the the Bank SIEM in near-real-time for correlation, alerting and incident response.
Access-to-logs auditingRead/query/export of logs & audit records is itself logged (who, what, when); access is RBAC-restricted; reveal of masked data is step-up gated and audited.

Compliance Posture

AreaApproach
Data localisationIn-country, in-bank deployment; no PII egress.
Card data handlingTokenised; no PAN storage — minimises PCI-DSS scope; align to bank's PCI controls.
Privacy (DPDP)Consent capture for communications; purpose limitation; data minimisation; retention controls.
Regulatory (RBI guidance)Audit trail, access control, reconciliation & outsourcing-governance alignment.
Change governanceMaker-checker, versioning & segregation of duties.
Specific certification scope (PCI-DSS, ISO 27001) and regulatory interpretation are confirmed jointly with the Bank Information Security & Compliance during design authority review.

Resilience, Backup & DR

AspectTarget / approach
Availability99.9% customer-facing & redemption services.
RPO≤ 15 minutes (ledger & config).
RTO≤ 2 hours.
BackupsAutomated encrypted backups; periodic restore tests.
DRAsync replica in secondary site; documented failover runbook.
DegradationQueue redemptions if fulfilment slow; batch continues independently.

Non-Functional Targets (consolidated)

CategoryTarget
Accrual throughput≥ 1,000 txn/s (batch); API posting ≤ 2s.
Redemption latency≤ 1.5s P95.
Scale10M+ cards; 50M+ txn/month.
IntegrityExactly-once accrual; zero double-credit/debit.
ObservabilityMetrics, logs, traces, health, alerting.
AccessibilityCustomer UI WCAG 2.1 AA.

Threat Model (summary)

ThreatMitigation
Replay / double redemptionIdempotency keys, atomic ledger debit, step-up auth.
Privilege escalationRBAC, least privilege, maker-checker, audited role changes.
Data exfiltrationIn-bank residency, egress allow-list, masking, DLP-friendly logging.
Tampering with rules/ledgerImmutable ledger, versioned config, approval workflow, audit.
Partner endpoint compromisemTLS, signed webhooks, allow-listed endpoints, circuit breakers.
Reward fraud / abuseCaps, exclusions, velocity checks, anomaly reporting.