@xdev-asia/xdev-knowledge-mcp 1.0.39 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/01-phan-1-kien-truc-nen-tang/lessons/04-bai-4-threat-modeling-stride-dread.md +41 -52
  2. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/02-phan-2-iam-keycloak/lessons/01-bai-5-setup-keycloak-realm-benh-vien.md +33 -84
  3. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/02-phan-2-iam-keycloak/lessons/02-bai-6-phan-quyen-rbac-abac.md +6 -23
  4. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/02-phan-2-iam-keycloak/lessons/03-bai-7-smart-on-fhir-oauth2-oidc.md +25 -36
  5. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/02-phan-2-iam-keycloak/lessons/04-bai-8-mfa-passkeys-emergency-access.md +7 -23
  6. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/03-phan-3-data-layer-postgresql/lessons/01-bai-9-postgresql-security-hardening.md +23 -69
  7. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/03-phan-3-data-layer-postgresql/lessons/02-bai-10-ma-hoa-du-lieu-postgresql.md +25 -80
  8. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/03-phan-3-data-layer-postgresql/lessons/03-bai-11-row-level-security-column-encryption.md +26 -55
  9. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/03-phan-3-data-layer-postgresql/lessons/04-bai-12-audit-logging-cdc-pgaudit.md +51 -87
  10. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/04-phan-4-microservices-quarkus/lessons/03-bai-15-ma-hoa-end-to-end-microservices.md +18 -63
  11. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/04-phan-4-microservices-quarkus/lessons/04-bai-16-mtls-service-mesh.md +26 -88
  12. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/05-phan-5-compliance-audit/lessons/01-bai-17-hipaa-technical-safeguards.md +50 -61
  13. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/05-phan-5-compliance-audit/lessons/02-bai-18-audit-trail-opentelemetry-elk.md +11 -34
  14. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/05-phan-5-compliance-audit/lessons/03-bai-19-data-masking-anonymization.md +113 -223
  15. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/05-phan-5-compliance-audit/lessons/04-bai-20-backup-disaster-recovery.md +92 -149
  16. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/06-phan-6-production-van-hanh/lessons/01-bai-21-zero-trust-architecture.md +126 -271
  17. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/06-phan-6-production-van-hanh/lessons/02-bai-22-container-kubernetes-security.md +10 -52
  18. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/06-phan-6-production-van-hanh/lessons/03-bai-23-penetration-testing.md +51 -90
  19. package/content/series/architecture/xay-dung-he-thong-y-te-microservices/chapters/06-phan-6-production-van-hanh/lessons/04-bai-24-capstone-deploy-production.md +137 -232
  20. package/package.json +1 -1
@@ -23,73 +23,48 @@ course:
23
23
 
24
24
  ![Disaster Recovery & Business Continuity — RPO/RTO cho hệ thống y tế](/storage/uploads/2026/04/healthcare-disaster-recovery.png)
25
25
 
26
-
27
26
  HIPAA Security Rule §164.308(a)(7) yêu cầu mọi tổ chức xử lý ePHI phải có **Contingency Plan** — kế hoạch dự phòng cho các tình huống khẩn cấp (thiên tai, tấn công ransomware, sự cố phần cứng, lỗi con người). Trong healthcare, **downtime có thể ảnh hưởng trực tiếp đến tính mạng bệnh nhân**.
28
27
 
29
28
  ### 1.1. HIPAA Contingency Plan Requirements
30
29
 
31
- ```
32
- ┌─────────────────────────────────────────────────────────────┐
33
- │ HIPAA Contingency Plan — §164.308(a)(7) │
34
- │ │
35
- │ (i) Data Backup Plan [Required] │
36
- │ └── Create and maintain exact copies of ePHI │
37
- │ └── Regular backup schedule │
38
- │ └── Backup verification │
39
- │ │
40
- │ (ii) Disaster Recovery Plan [Required] │
41
- │ └── Procedures to restore lost data │
42
- │ └── Restore from backups │
43
- │ └── Test recovery procedures │
44
- │ │
45
- │ (iii) Emergency Mode Operation Plan [Required]
46
- │ └── Continue critical operations during emergency │
47
- │ └── Protect ePHI during emergency │
48
- │ └── Prioritize patient safety systems │
49
- │ │
50
- │ (iv) Testing and Revision Procedures [Addressable] │
51
- │ └── Periodic testing of contingency plans │
52
- │ └── Update plans based on test results │
53
- │ │
54
- │ (v) Applications and Data Criticality Analysis [Addr.] │
55
- │ └── Identify critical applications │
56
- │ └── Prioritize recovery order │
57
- └─────────────────────────────────────────────────────────────┘
58
- ```
30
+ **HIPAA Contingency Plan — §164.308(a)(7):**
31
+
32
+ 1. **Data Backup Plan** [Required]
33
+ - Create and maintain exact copies of ePHI
34
+ - Regular backup schedule
35
+ - Backup verification
36
+ 2. **Disaster Recovery Plan** [Required]
37
+ - Procedures to restore lost data
38
+ - Restore from backups
39
+ - Test recovery procedures
40
+ 3. **Emergency Mode Operation Plan** [Required]
41
+ - Continue critical operations during emergency
42
+ - Protect ePHI during emergency
43
+ - Prioritize patient safety systems
44
+ 4. **Testing and Revision Procedures** [Addressable]
45
+ - Periodic testing of contingency plans
46
+ - Update plans based on test results
47
+ 5. **Applications and Data Criticality Analysis** [Addressable]
48
+ - Identify critical applications
49
+ - Prioritize recovery order
59
50
 
60
51
  ### 1.2. RTO/RPO Requirements cho Healthcare
61
52
 
62
- ```
63
- ┌─────────────────────────────────────────────────────────────┐
64
- │ RTO / RPO cho Healthcare Systems │
65
- │ │
66
- │ RPO (Recovery Point Objective): │
67
- │ "Bao nhiêu dữ liệu thể mất?" │
68
- │ │
69
- │ RTO (Recovery Time Objective): │
70
- │ "Bao lâu để hệ thống hoạt động trở lại?" │
71
- │ │
72
- │ ┌────────────────┬────────┬────────┬───────────────────┐ │
73
- │ │ System │ RPO │ RTO │ Criticality │ │
74
- │ ├────────────────┼────────┼────────┼───────────────────┤ │
75
- │ │ EHR (Bệnh án) │ 0-1min │ <15min │ Critical │ │
76
- │ │ Lab Results │ <5min │ <30min Critical │ │
77
- │ │ Pharmacy │ <5min │ <30min │ Critical │ │
78
- │ │ Patient Portal │ <1hr │ <4hr │ Important │ │
79
- │ │ Billing │ <4hr │ <8hr │ Standard │ │
80
- │ │ Analytics │ <24hr │ <24hr │ Low │ │
81
- │ │ Audit Logs │ 0 │ <1hr │ Critical (HIPAA) │ │
82
- │ └────────────────┴────────┴────────┴───────────────────┘ │
83
- │ │
84
- │ Timeline: │
85
- │ ◄───── RPO ─────┤ Disaster ├───── RTO ─────► │
86
- │ Data loss window │ occurs │ Downtime window │
87
- │ │
88
- │ Target cho Critical Healthcare: │
89
- │ RPO ≈ 0 (synchronous replication) │
90
- │ RTO < 15 minutes (automated failover) │
91
- └─────────────────────────────────────────────────────────────┘
92
- ```
53
+ ![RTO/RPO Timeline cho Healthcare Systems](/storage/uploads/2026/04/healthcare-rto-rpo-timeline.png)
54
+
55
+ | System | RPO | RTO | Criticality |
56
+ |--------|-----|-----|------------|
57
+ | EHR (Bệnh án) | 0-1min | <15min | Critical |
58
+ | Lab Results | <5min | <30min | Critical |
59
+ | Pharmacy | <5min | <30min | Critical |
60
+ | Patient Portal | <1hr | <4hr | Important |
61
+ | Billing | <4hr | <8hr | Standard |
62
+ | Analytics | <24hr | <24hr | Low |
63
+ | Audit Logs | 0 | <1hr | Critical (HIPAA) |
64
+
65
+ **Timeline:** ◄── RPO (Data loss window) ──┤ Disaster occurs ├── RTO (Downtime window) ──►
66
+
67
+ **Target cho Critical Healthcare:** RPO ≈ 0 (synchronous replication), RTO < 15 minutes (automated failover)
93
68
 
94
69
  ## 2. PostgreSQL Backup Strategies
95
70
 
@@ -741,41 +716,20 @@ volumes:
741
716
 
742
717
  ### 5.1. Cross-Region Architecture
743
718
 
744
- ```
745
- ┌─────────────────────────────────────────────────────────────┐
746
- │ Cross-Region DR Architecture │
747
- │ │
748
- │ PRIMARY REGION (ap-southeast-1: Singapore)
749
- │ ┌─────────────────────────────────────────────┐ │
750
- │ │ ┌──────────┐ ┌──────────┐ │ │
751
- │ │ │ pg-primary│──►│pg-replica│ (sync) │ │
752
- │ │ │ (R/W) │ │ (R/O) │ │ │
753
- │ │ └──────────┘ └──────────┘ │ │
754
- │ │ │ │ │
755
- │ │ │ WAL streaming (async) │ │
756
- │ │ │ │ │
757
- │ └───────┼─────────────────────────────────────┘ │
758
- │ │ │
759
- │ │ Internet / VPN / Direct Connect │
760
- │ │ (encrypted TLS 1.3) │
761
- │ │ │
762
- │ DR REGION (ap-northeast-1: Tokyo) │
763
- │ ┌───────┼─────────────────────────────────────┐ │
764
- │ │ ▼ │ │
765
- │ │ ┌──────────┐ │ │
766
- │ │ │ pg-dr │ (async replica, read-only) │ │
767
- │ │ │ │ Lag: < 1 minute │ │
768
- │ │ └──────────┘ │ │
769
- │ │ │ │
770
- │ │ + pgBackRest S3 backup (encrypted) │ │
771
- │ │ + Standby microservices (cold/warm) │ │
772
- │ └──────────────────────────────────────────────┘ │
773
- │ │
774
- │ Failover: DNS switch + Patroni promote DR │
775
- │ RPO: < 1 minute (async lag) │
776
- │ RTO: < 15 minutes (automated) │
777
- └─────────────────────────────────────────────────────────────┘
778
- ```
719
+ ![Cross-Region DR Architecture — Singapore (Primary) → Tokyo (DR)](/storage/uploads/2026/04/healthcare-cross-region-dr.png)
720
+
721
+ **PRIMARY REGION** (ap-southeast-1: Singapore):
722
+
723
+ - pg-primary (R/W) → pg-replica (R/O) — sync replication
724
+ - WAL streaming (async) tới DR region
725
+
726
+ **DR REGION** (ap-northeast-1: Tokyo):
727
+
728
+ - pg-dr (async replica, read-only) — Lag: < 1 minute
729
+ - pgBackRest S3 backup (encrypted)
730
+ - Standby microservices (cold/warm)
731
+
732
+ **Failover:** DNS switch + Patroni promote DR — **RPO < 1 minute**, **RTO < 15 minutes** (automated)
779
733
 
780
734
  ### 5.2. DR Replication Setup
781
735
 
@@ -852,23 +806,17 @@ echo "=== DR Replica setup complete ==="
852
806
 
853
807
  ### 6.1. Recovery Scope
854
808
 
855
- ```
856
- ┌─────────────────────────────────────────────────────────────┐
857
- │ Microservices State Recovery │
858
- │ │
859
- │ Component │ State │ Recovery │
860
- │ ───────────────────────┼──────────────────────┼──────────── │
861
- │ PostgreSQL │ Patient data (PHI) │ PITR/Replica
862
- │ Kafka │ Consumer offsets │ Reset offset
863
- │ Kafka │ Topic data │ Replay logs │
864
- │ Keycloak │ Realm, users, roles │ Realm export
865
- │ HashiCorp Vault │ Encryption keys │ Snapshot │
866
- │ Elasticsearch │ Audit logs │ Snapshot │
867
- │ Application Config │ ConfigMaps, Secrets │ Git + Velero │
868
- │ Container Images │ Docker images │ Registry │
869
- │ Certificates │ TLS certs │ cert-manager │
870
- └─────────────────────────────────────────────────────────────┘
871
- ```
809
+ | Component | State | Recovery |
810
+ |-----------|-------|----------|
811
+ | PostgreSQL | Patient data (PHI) | PITR/Replica |
812
+ | Kafka | Consumer offsets | Reset offset |
813
+ | Kafka | Topic data | Replay logs |
814
+ | Keycloak | Realm, users, roles | Realm export |
815
+ | HashiCorp Vault | Encryption keys | Snapshot |
816
+ | Elasticsearch | Audit logs | Snapshot |
817
+ | Application Config | ConfigMaps, Secrets | Git + Velero |
818
+ | Container Images | Docker images | Registry |
819
+ | Certificates | TLS certs | cert-manager |
872
820
 
873
821
  ### 6.2. Kafka Consumer Offset Recovery
874
822
 
@@ -1076,43 +1024,38 @@ esac
1076
1024
 
1077
1025
  ### 8.1. DR Test Runbook
1078
1026
 
1079
- ```
1080
- ┌─────────────────────────────────────────────────────────────┐
1081
- │ Healthcare DR Test Runbook │
1082
- │ │
1083
- │ Pre-Test (T-1 week): │
1084
- │ □ Notify all stakeholders │
1085
- │ □ Verify backup integrity (pgbackrest verify) │
1086
- │ □ Confirm DR environment is ready │
1087
- │ □ Review escalation contacts │
1088
- │ □ Prepare rollback plan │
1089
- │ │
1090
- │ Test Execution: │
1091
- │ □ T+0:00 — Simulate primary failure
1092
- │ □ T+0:01 — Verify automated failover triggered
1093
- │ □ T+0:05 — Verify DR database accessible
1094
- │ □ T+0:10 — Verify application connectivity
1095
- │ □ T+0:15 — Verify PHI data integrity (record counts)
1096
- │ □ T+0:20 — Test critical operations
1097
- │ □ Patient lookup │
1098
- │ □ Lab result entry │
1099
- │ □ Prescription creation │
1100
- │ □ Audit log writing │
1101
- │ □ T+0:30 — Verify audit trail continuity │
1102
- │ □ T+0:45 Performance benchmarks │
1103
- │ │
1104
- │ Post-Test: │
1105
- │ □ Document actual RTO achieved │
1106
- │ □ Document actual RPO (data loss) │
1107
- │ □ Document any issues encountered │
1108
- │ □ Update DR plan based on findings │
1109
- │ □ Failback to primary │
1110
- │ □ Verify failback successful │
1111
- │ □ Submit test report to compliance │
1112
- │ │
1113
- │ Frequency: Quarterly (HIPAA Addressable §164.308(a)(7)(iv)) │
1114
- └─────────────────────────────────────────────────────────────┘
1115
- ```
1027
+ **Healthcare DR Test Runbook:**
1028
+
1029
+ **Pre-Test (T-1 week):**
1030
+
1031
+ - [ ] Notify all stakeholders
1032
+ - [ ] Verify backup integrity (`pgbackrest verify`)
1033
+ - [ ] Confirm DR environment is ready
1034
+ - [ ] Review escalation contacts
1035
+ - [ ] Prepare rollback plan
1036
+
1037
+ **Test Execution:**
1038
+
1039
+ - [ ] T+0:00 — Simulate primary failure
1040
+ - [ ] T+0:01 — Verify automated failover triggered
1041
+ - [ ] T+0:05 — Verify DR database accessible
1042
+ - [ ] T+0:10 — Verify application connectivity
1043
+ - [ ] T+0:15 — Verify PHI data integrity (record counts)
1044
+ - [ ] T+0:20 — Test critical operations: Patient lookup, Lab result entry, Prescription creation, Audit log writing
1045
+ - [ ] T+0:30 — Verify audit trail continuity
1046
+ - [ ] T+0:45 — Performance benchmarks
1047
+
1048
+ **Post-Test:**
1049
+
1050
+ - [ ] Document actual RTO achieved
1051
+ - [ ] Document actual RPO (data loss)
1052
+ - [ ] Document any issues encountered
1053
+ - [ ] Update DR plan based on findings
1054
+ - [ ] Failback to primary
1055
+ - [ ] Verify failback successful
1056
+ - [ ] Submit test report to compliance
1057
+
1058
+ **Frequency:** Quarterly (HIPAA Addressable §164.308(a)(7)(iv))
1116
1059
 
1117
1060
  ### 8.2. Automated DR Test Script
1118
1061