Security & PCI Compliance
Relevant source files
The following files were used as context for generating this wiki page:
The BankChase application implements an enterprise-grade security framework designed to protect sensitive financial data and ensure adherence to international standards such as PCI DSS, GDPR, and CCPA. The architecture is built on a multi-layered defense strategy, integrating secure authentication, granular access control, and comprehensive data protection mechanisms.
The scope of this system covers the entire data lifecycle—from secure transmission via TLS 1.3 to at-rest protection using AES-256 encryption. Key components include a robust Role-Based Access Control (RBAC) system, real-time security monitoring, and immutable audit trails that provide transparency and accountability for all administrative and user actions.
Sources: SECURITY_COMPLETE.md, PRIVACY_SECURITY_README.md, RBAC_DELIVERY_SUMMARY.md
8-Layer Security Architecture
The system utilizes an 8-layer security architecture to ensure data isolation and protection. This defense-in-depth approach ensures that even if one layer is bypassed, subsequent layers remain in place to protect user assets and information.
This diagram represents the sequential security layers data must pass through during a request.
Sources: README_START_HERE.md, RBAC_SYSTEM_ARCHITECTURE.md, SECURITY_COMPLETE.md
Authentication and Access Control
BankChase employs a three-tier Role-Based Access Control (RBAC) system to manage permissions and ensure strict data isolation between different user types.
User Roles and Permissions
| Role | Access Level | Description |
|---|---|---|
| Customer | Restricted | Can only access their own profile, accounts, and transaction history. |
| Admin | Full | Can manage user roles, delete accounts, and access the admin dashboard and audit logs. |
| Auditor | Read-Only | Has read-only access to audit logs, login history, and transaction data for compliance purposes. |
| Compliance | Specialized | Access to sensitive reports and PII tracking for regulatory adherence. |
Sources: RBAC_DELIVERY_SUMMARY.md, SECURITY_COMPLETE.md
Secure Authentication Flow
Authentication is handled via JWT tokens and reinforced with Two-Factor Authentication (2FA). The process includes:
- Password Hashing: Passwords are never stored in plain text; they are hashed using Bcrypt with 10 rounds of salt.
- 2FA Implementation: A 6-digit verification code is generated with a 5-minute expiration window for sensitive operations.
- Session Management: JWT tokens are signed with HS256 and stored in
httpOnlycookies to prevent XSS-based token theft.
The sequence illustrates the multi-step verification process from initial login to session issuance.
Sources: RBAC_DELIVERY_SUMMARY.md, README_START_HERE.md
Data Protection and Encryption
To meet PCI DSS requirements, sensitive data is protected using both encryption and dynamic masking.
Encryption Standards
- Data in Transit: Enforced TLS 1.3/HTTPS.
- Data at Rest: Sensitive columns (SSN, card numbers, CVV, routing numbers) are encrypted using AES-256 via the
pgcryptoextension at the database level and a Pythoncryptographylibrary in the backend.
Sources: SECURITY_COMPLETE.md, PRIVACY_SECURITY_README.md
Dynamic Data Masking
The system automatically masks PII (Personally Identifiable Information) based on the user's role:
- SSN: Displayed as
XXX-XX-1234. - Card Numbers: Displayed as
XXXX-XXXX-XXXX-1234. - Emails: Masked as
u***@example.com.
Sources: SECURITY_COMPLETE.md
Compliance and Monitoring
Audit Logging
BankChase maintains immutable audit trails to track all operations. This is critical for forensic analysis and compliance audits (SOC 2, PCI DSS).
- Audit Logs: Tracks all INSERT/UPDATE/DELETE operations with "before" and "after" values.
- Data Access Logs: Records who accessed which records and when.
- Security Alerts: Real-time triggers for suspicious activity, such as large transfers (>$5000) or multiple failed login attempts.
Sources: SECURITY_COMPLETE.md, RBAC_DELIVERY_SUMMARY.md
PCI DSS Compliance Checklist
| Requirement | Status | Implementation Detail |
|---|---|---|
| Protect Cardholder Data | ✅ | AES-256 encryption for card numbers and CVV. |
| Access Control | ✅ | RBAC enforced at API and Database (RLS) layers. |
| Monitor/Test Networks | ✅ | Real-time security alerts and immutable audit logs. |
| Vulnerability Mgmt | ✅ | Rate limiting and SQL parameterized queries. |
Sources: SECURITY_COMPLETE.md, RBAC_DELIVERY_SUMMARY.md
Implementation Summary
The security system is composed of specific backend modules and database migrations:
- Database Layer: Migrations such as
011_encryption_setup.sqland010_enhanced_rls_policies.sqlestablish the foundation for data protection. - Backend Layer: Python modules like
security/encryption.pyandsecurity/access_control.pymanage the application-level security logic.
Sources: SECURITY_COMPLETE.md
Security and PCI compliance within BankChase are achieved through a rigorous integration of encryption, strict access controls, and real-time monitoring. By enforcing data isolation at the SQL level via Row-Level Security (RLS) and protecting PII with industry-standard encryption, the platform provides a secure environment for modern banking operations.