@@ -21,12 +21,32 @@ import { z } from 'zod';
2121 * @category Security
2222 */
2323
24+ /**
25+ * Shared data classification enum used across security subsystems.
26+ * Defines the canonical set of data sensitivity labels.
27+ */
28+ export const DataClassificationSchema = z . enum ( [
29+ 'pii' , 'phi' , 'pci' , 'financial' , 'confidential' , 'internal' , 'public' ,
30+ ] ) . describe ( 'Data classification level' ) ;
31+
32+ export type DataClassification = z . infer < typeof DataClassificationSchema > ;
33+
34+ /**
35+ * Shared compliance framework enum used across compliance and security schemas.
36+ * Defines the canonical set of regulatory frameworks.
37+ */
38+ export const ComplianceFrameworkSchema = z . enum ( [
39+ 'gdpr' , 'hipaa' , 'sox' , 'pci_dss' , 'ccpa' , 'iso27001' ,
40+ ] ) . describe ( 'Compliance framework identifier' ) ;
41+
42+ export type ComplianceFramework = z . infer < typeof ComplianceFrameworkSchema > ;
43+
2444/**
2545 * Compliance-driven audit requirement.
2646 * Maps specific compliance frameworks to the audit event types that MUST be captured.
2747 */
2848export const ComplianceAuditRequirementSchema = z . object ( {
29- framework : z . enum ( [ 'gdpr' , 'hipaa' , 'sox' , 'pci_dss' , 'ccpa' , 'iso27001' ] )
49+ framework : ComplianceFrameworkSchema
3050 . describe ( 'Compliance framework identifier' ) ,
3151 requiredEvents : z . array ( z . string ( ) )
3252 . describe ( 'Audit event types required by this framework (e.g., "data.delete", "auth.login")' ) ,
@@ -43,11 +63,10 @@ export type ComplianceAuditRequirement = z.infer<typeof ComplianceAuditRequireme
4363 * Maps compliance frameworks to encryption mandates for specific data classifications.
4464 */
4565export const ComplianceEncryptionRequirementSchema = z . object ( {
46- framework : z . enum ( [ 'gdpr' , 'hipaa' , 'sox' , 'pci_dss' , 'ccpa' , 'iso27001' ] )
66+ framework : ComplianceFrameworkSchema
4767 . describe ( 'Compliance framework identifier' ) ,
48- dataClassifications : z . array ( z . enum ( [
49- 'pii' , 'phi' , 'pci' , 'financial' , 'confidential' , 'internal' , 'public' ,
50- ] ) ) . describe ( 'Data classifications that must be encrypted under this framework' ) ,
68+ dataClassifications : z . array ( DataClassificationSchema )
69+ . describe ( 'Data classifications that must be encrypted under this framework' ) ,
5170 minimumAlgorithm : z . enum ( [ 'aes-256-gcm' , 'aes-256-cbc' , 'chacha20-poly1305' ] ) . default ( 'aes-256-gcm' )
5271 . describe ( 'Minimum encryption algorithm strength required' ) ,
5372 keyRotationMaxDays : z . number ( ) . min ( 1 ) . default ( 90 )
@@ -61,9 +80,8 @@ export type ComplianceEncryptionRequirement = z.infer<typeof ComplianceEncryptio
6180 * Controls which roles can view unmasked data with audit trail enforcement.
6281 */
6382export const MaskingVisibilityRuleSchema = z . object ( {
64- dataClassification : z . enum ( [
65- 'pii' , 'phi' , 'pci' , 'financial' , 'confidential' , 'internal' , 'public' ,
66- ] ) . describe ( 'Data classification this rule applies to' ) ,
83+ dataClassification : DataClassificationSchema
84+ . describe ( 'Data classification this rule applies to' ) ,
6785 defaultMasked : z . boolean ( ) . default ( true )
6886 . describe ( 'Whether data is masked by default' ) ,
6987 unmaskRoles : z . array ( z . string ( ) ) . optional ( )
@@ -102,9 +120,8 @@ export type SecurityEventCorrelation = z.infer<typeof SecurityEventCorrelationSc
102120 * Assigns classification labels to fields/objects for unified security enforcement.
103121 */
104122export const DataClassificationPolicySchema = z . object ( {
105- classification : z . enum ( [
106- 'pii' , 'phi' , 'pci' , 'financial' , 'confidential' , 'internal' , 'public' ,
107- ] ) . describe ( 'Data classification level' ) ,
123+ classification : DataClassificationSchema
124+ . describe ( 'Data classification level' ) ,
108125 requireEncryption : z . boolean ( ) . default ( false )
109126 . describe ( 'Encryption required for this classification' ) ,
110127 requireMasking : z . boolean ( ) . default ( false )
0 commit comments