specweave 0.23.8 → 0.23.12

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 (130) hide show
  1. package/.claude-plugin/marketplace.json +7 -7
  2. package/CLAUDE.md +391 -1338
  3. package/dist/src/cli/commands/cleanup-cache.d.ts +14 -0
  4. package/dist/src/cli/commands/cleanup-cache.d.ts.map +1 -0
  5. package/dist/src/cli/commands/cleanup-cache.js +63 -0
  6. package/dist/src/cli/commands/cleanup-cache.js.map +1 -0
  7. package/dist/src/cli/commands/init.js +40 -0
  8. package/dist/src/cli/commands/init.js.map +1 -1
  9. package/dist/src/cli/commands/migrate-config.d.ts +22 -0
  10. package/dist/src/cli/commands/migrate-config.d.ts.map +1 -0
  11. package/dist/src/cli/commands/migrate-config.js +149 -0
  12. package/dist/src/cli/commands/migrate-config.js.map +1 -0
  13. package/dist/src/cli/helpers/async-project-loader.d.ts +148 -0
  14. package/dist/src/cli/helpers/async-project-loader.d.ts.map +1 -0
  15. package/dist/src/cli/helpers/async-project-loader.js +351 -0
  16. package/dist/src/cli/helpers/async-project-loader.js.map +1 -0
  17. package/dist/src/cli/helpers/cancelation-handler.d.ts +123 -0
  18. package/dist/src/cli/helpers/cancelation-handler.d.ts.map +1 -0
  19. package/dist/src/cli/helpers/cancelation-handler.js +187 -0
  20. package/dist/src/cli/helpers/cancelation-handler.js.map +1 -0
  21. package/dist/src/cli/helpers/import-strategy-prompter.d.ts +43 -0
  22. package/dist/src/cli/helpers/import-strategy-prompter.d.ts.map +1 -0
  23. package/dist/src/cli/helpers/import-strategy-prompter.js +136 -0
  24. package/dist/src/cli/helpers/import-strategy-prompter.js.map +1 -0
  25. package/dist/src/cli/helpers/issue-tracker/ado.d.ts +5 -2
  26. package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
  27. package/dist/src/cli/helpers/issue-tracker/ado.js +90 -40
  28. package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
  29. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  30. package/dist/src/cli/helpers/issue-tracker/index.js +112 -60
  31. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  32. package/dist/src/cli/helpers/issue-tracker/jira.d.ts +26 -2
  33. package/dist/src/cli/helpers/issue-tracker/jira.d.ts.map +1 -1
  34. package/dist/src/cli/helpers/issue-tracker/jira.js +197 -132
  35. package/dist/src/cli/helpers/issue-tracker/jira.js.map +1 -1
  36. package/dist/src/cli/helpers/progress-tracker.d.ts +121 -0
  37. package/dist/src/cli/helpers/progress-tracker.d.ts.map +1 -0
  38. package/dist/src/cli/helpers/progress-tracker.js +202 -0
  39. package/dist/src/cli/helpers/progress-tracker.js.map +1 -0
  40. package/dist/src/cli/helpers/project-count-fetcher.d.ts +69 -0
  41. package/dist/src/cli/helpers/project-count-fetcher.d.ts.map +1 -0
  42. package/dist/src/cli/helpers/project-count-fetcher.js +173 -0
  43. package/dist/src/cli/helpers/project-count-fetcher.js.map +1 -0
  44. package/dist/src/config/types.d.ts +14 -14
  45. package/dist/src/core/cache/cache-manager.d.ts +119 -0
  46. package/dist/src/core/cache/cache-manager.d.ts.map +1 -0
  47. package/dist/src/core/cache/cache-manager.js +304 -0
  48. package/dist/src/core/cache/cache-manager.js.map +1 -0
  49. package/dist/src/core/cache/rate-limit-checker.d.ts +92 -0
  50. package/dist/src/core/cache/rate-limit-checker.d.ts.map +1 -0
  51. package/dist/src/core/cache/rate-limit-checker.js +160 -0
  52. package/dist/src/core/cache/rate-limit-checker.js.map +1 -0
  53. package/dist/src/core/config/config-manager.d.ts +135 -0
  54. package/dist/src/core/config/config-manager.d.ts.map +1 -0
  55. package/dist/src/core/config/config-manager.js +341 -0
  56. package/dist/src/core/config/config-manager.js.map +1 -0
  57. package/dist/src/core/config/config-migrator.d.ts +102 -0
  58. package/dist/src/core/config/config-migrator.d.ts.map +1 -0
  59. package/dist/src/core/config/config-migrator.js +367 -0
  60. package/dist/src/core/config/config-migrator.js.map +1 -0
  61. package/dist/src/core/config/index.d.ts +10 -0
  62. package/dist/src/core/config/index.d.ts.map +1 -0
  63. package/dist/src/core/config/index.js +10 -0
  64. package/dist/src/core/config/index.js.map +1 -0
  65. package/dist/src/core/config/types.d.ts +216 -0
  66. package/dist/src/core/config/types.d.ts.map +1 -0
  67. package/dist/src/core/config/types.js +32 -0
  68. package/dist/src/core/config/types.js.map +1 -0
  69. package/dist/src/core/progress/cancelation-handler.d.ts +79 -0
  70. package/dist/src/core/progress/cancelation-handler.d.ts.map +1 -0
  71. package/dist/src/core/progress/cancelation-handler.js +111 -0
  72. package/dist/src/core/progress/cancelation-handler.js.map +1 -0
  73. package/dist/src/core/progress/import-state.d.ts +71 -0
  74. package/dist/src/core/progress/import-state.d.ts.map +1 -0
  75. package/dist/src/core/progress/import-state.js +96 -0
  76. package/dist/src/core/progress/import-state.js.map +1 -0
  77. package/dist/src/core/progress/progress-tracker.d.ts +139 -0
  78. package/dist/src/core/progress/progress-tracker.d.ts.map +1 -0
  79. package/dist/src/core/progress/progress-tracker.js +223 -0
  80. package/dist/src/core/progress/progress-tracker.js.map +1 -0
  81. package/dist/src/init/architecture/types.d.ts +6 -6
  82. package/dist/src/integrations/ado/ado-client.d.ts +25 -0
  83. package/dist/src/integrations/ado/ado-client.d.ts.map +1 -1
  84. package/dist/src/integrations/ado/ado-client.js +67 -0
  85. package/dist/src/integrations/ado/ado-client.js.map +1 -1
  86. package/dist/src/integrations/ado/ado-dependency-loader.d.ts +99 -0
  87. package/dist/src/integrations/ado/ado-dependency-loader.d.ts.map +1 -0
  88. package/dist/src/integrations/ado/ado-dependency-loader.js +207 -0
  89. package/dist/src/integrations/ado/ado-dependency-loader.js.map +1 -0
  90. package/dist/src/integrations/jira/jira-client.d.ts +32 -0
  91. package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
  92. package/dist/src/integrations/jira/jira-client.js +81 -0
  93. package/dist/src/integrations/jira/jira-client.js.map +1 -1
  94. package/dist/src/integrations/jira/jira-dependency-loader.d.ts +101 -0
  95. package/dist/src/integrations/jira/jira-dependency-loader.d.ts.map +1 -0
  96. package/dist/src/integrations/jira/jira-dependency-loader.js +200 -0
  97. package/dist/src/integrations/jira/jira-dependency-loader.js.map +1 -0
  98. package/dist/src/integrations/jira/jira-hierarchy-mapper.d.ts +104 -0
  99. package/dist/src/integrations/jira/jira-hierarchy-mapper.d.ts.map +1 -0
  100. package/dist/src/integrations/jira/jira-hierarchy-mapper.js +178 -0
  101. package/dist/src/integrations/jira/jira-hierarchy-mapper.js.map +1 -0
  102. package/package.json +1 -1
  103. package/plugins/specweave/.claude-plugin/plugin.json +20 -0
  104. package/plugins/specweave/agents/architect/AGENT.md +100 -602
  105. package/plugins/specweave/agents/pm/AGENT.md +96 -597
  106. package/plugins/specweave/agents/pm/AGENT.md.bak +1893 -0
  107. package/plugins/specweave/agents/pm/AGENT.md.bak2 +1754 -0
  108. package/plugins/specweave/commands/check-hooks.md +257 -0
  109. package/plugins/specweave/commands/migrate-config.md +104 -0
  110. package/plugins/specweave/hooks/post-edit-spec.sh +202 -31
  111. package/plugins/specweave/hooks/post-task-completion.sh +225 -228
  112. package/plugins/specweave/hooks/post-write-spec.sh +207 -31
  113. package/plugins/specweave/hooks/pre-edit-spec.sh +151 -0
  114. package/plugins/specweave/hooks/pre-task-completion.sh +5 -7
  115. package/plugins/specweave/hooks/pre-write-spec.sh +151 -0
  116. package/plugins/specweave/hooks/test-pretooluse-env.sh +72 -0
  117. package/plugins/specweave/skills/compliance-architecture/SKILL.md +374 -0
  118. package/plugins/specweave/skills/external-sync-wizard/SKILL.md +610 -0
  119. package/plugins/specweave/skills/pm-closure-validation/SKILL.md +541 -0
  120. package/plugins/specweave/skills/roadmap-planner/SKILL.md +473 -0
  121. package/plugins/specweave-ado/commands/refresh-cache.js +25 -0
  122. package/plugins/specweave-ado/commands/refresh-cache.ts +40 -0
  123. package/plugins/specweave-ado/hooks/post-task-completion.sh +1 -1
  124. package/plugins/specweave-github/hooks/post-task-completion.sh +1 -1
  125. package/plugins/specweave-jira/commands/refresh-cache.js +25 -0
  126. package/plugins/specweave-jira/commands/refresh-cache.ts +40 -0
  127. package/plugins/specweave-jira/hooks/post-task-completion.sh +1 -1
  128. package/plugins/specweave-kafka-streams/commands/topology.md +437 -0
  129. package/plugins/specweave-n8n/commands/workflow-template.md +262 -0
  130. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +228 -6333
@@ -0,0 +1,72 @@
1
+ #!/bin/bash
2
+ #
3
+ # PreToolUse Environment Variable Validation Test
4
+ #
5
+ # Purpose: Validate that PreToolUse hooks receive tool arguments via env vars
6
+ # This tests the core assumption of Tier 2 implementation
7
+ #
8
+ # Usage:
9
+ # 1. Register this hook in plugin.json under PreToolUse:Edit
10
+ # 2. Make 10 test edits to any file
11
+ # 3. Review /tmp/pretooluse-test.log
12
+ # 4. Check if TOOL_USE_ARGS is populated
13
+ #
14
+ # Success Criteria:
15
+ # - TOOL_USE_ARGS contains file_path
16
+ # - At least 80% of invocations have non-empty TOOL_USE_ARGS
17
+ #
18
+ # If this test fails, Tier 2 PreToolUse coordination cannot work
19
+ # and we must rely on Tier 1 (mtime fallback) or proceed to Tier 3
20
+ #
21
+ # Version: v0.24.2 (Tier 2 Validation)
22
+ # Date: 2025-11-22
23
+
24
+ set +e # Don't fail on errors (this is a diagnostic tool)
25
+
26
+ TEST_LOG="/tmp/pretooluse-test.log"
27
+ TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
28
+
29
+ # Initialize log on first run
30
+ if [[ ! -f "$TEST_LOG" ]]; then
31
+ echo "==================================" > "$TEST_LOG"
32
+ echo "PreToolUse Environment Variable Test" >> "$TEST_LOG"
33
+ echo "Started: $TIMESTAMP" >> "$TEST_LOG"
34
+ echo "==================================" >> "$TEST_LOG"
35
+ echo "" >> "$TEST_LOG"
36
+ fi
37
+
38
+ # Record this invocation
39
+ echo "[$TIMESTAMP] PreToolUse:Edit invocation #$(wc -l < "$TEST_LOG")" >> "$TEST_LOG"
40
+
41
+ # Check ALL tool-related environment variables
42
+ echo " TOOL_USE_ARGS: ${TOOL_USE_ARGS:-<EMPTY>}" >> "$TEST_LOG"
43
+ echo " TOOL_USE_CONTENT: ${TOOL_USE_CONTENT:-<EMPTY>}" >> "$TEST_LOG"
44
+ echo " TOOL_RESULT: ${TOOL_RESULT:-<EMPTY>}" >> "$TEST_LOG"
45
+ echo " PWD: $PWD" >> "$TEST_LOG"
46
+
47
+ # Try to extract file_path if TOOL_USE_ARGS exists
48
+ if [[ -n "${TOOL_USE_ARGS:-}" ]]; then
49
+ if command -v jq &> /dev/null; then
50
+ FILE_PATH=$(echo "$TOOL_USE_ARGS" | jq -r '.file_path // "<NOT_FOUND>"' 2>/dev/null)
51
+ echo " Extracted file_path: $FILE_PATH" >> "$TEST_LOG"
52
+ else
53
+ FILE_PATH=$(echo "$TOOL_USE_ARGS" | grep -o '"file_path"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"\([^"]*\)".*/\1/' || echo "<PARSE_FAILED>")
54
+ echo " Extracted file_path (no jq): $FILE_PATH" >> "$TEST_LOG"
55
+ fi
56
+ fi
57
+
58
+ # Dump all TOOL* env vars
59
+ echo " All TOOL* environment variables:" >> "$TEST_LOG"
60
+ env | grep -E "^TOOL" | while read line; do
61
+ echo " $line" >> "$TEST_LOG"
62
+ done
63
+
64
+ echo "" >> "$TEST_LOG"
65
+
66
+ # Log rotation: Keep last 100 invocations
67
+ if [[ $(wc -l < "$TEST_LOG") -gt 500 ]]; then
68
+ tail -400 "$TEST_LOG" > "$TEST_LOG.tmp"
69
+ mv "$TEST_LOG.tmp" "$TEST_LOG"
70
+ fi
71
+
72
+ exit 0 # Always succeed (diagnostic tool)
@@ -0,0 +1,374 @@
1
+ ---
2
+ name: compliance-architecture
3
+ description: Enterprise-grade compliance architecture for SOC 2, HIPAA, GDPR, PCI-DSS. Provides compliance checklists, security controls, audit guidance, and regulatory requirements for serverless and cloud architectures. Activates for compliance, HIPAA, SOC2, SOC 2, GDPR, PCI-DSS, PCI DSS, regulatory, healthcare data, payment card, data protection, audit, security standards, regulated industry, BAA, business associate agreement, DPIA, data protection impact assessment.
4
+ ---
5
+
6
+ # Compliance Architecture Expert
7
+
8
+ I'm a specialist in enterprise compliance architecture across regulated industries. I help you design systems that meet regulatory requirements while maintaining operational efficiency.
9
+
10
+ ## When to Use This Skill
11
+
12
+ Ask me when you need help with:
13
+ - **SOC 2 Type II compliance** for SaaS applications
14
+ - **HIPAA compliance** for healthcare data systems
15
+ - **GDPR compliance** for European data protection
16
+ - **PCI-DSS compliance** for payment card processing
17
+ - **Security architecture** for regulated industries
18
+ - **Audit preparation** and evidence collection
19
+ - **Compliance validation** for serverless/cloud deployments
20
+
21
+ ## My Expertise
22
+
23
+ ### SOC 2 Type II Compliance
24
+
25
+ **Core Requirements for Serverless**:
26
+
27
+ 1. **Encryption Standards**
28
+ - Encryption at rest: All data in databases, S3, DynamoDB encrypted
29
+ - Encryption in transit: TLS 1.2+ for all API communications
30
+ - Key management: Customer-managed keys (KMS, Key Vault, GCP KMS)
31
+ - Regular key rotation: Annual minimum or per compliance policy
32
+
33
+ 2. **Access Logging and Retention**
34
+ - CloudTrail (AWS), Activity Log (Azure), Cloud Audit Logs (GCP)
35
+ - Minimum retention: 90 days (24 months recommended)
36
+ - Centralized log aggregation: ELK Stack, Splunk, or cloud-native
37
+ - Immutable audit logs: Write-once storage for compliance evidence
38
+ - Real-time alerting on unauthorized access attempts
39
+
40
+ 3. **Access Controls**
41
+ - Least privilege IAM roles and policies
42
+ - No wildcard (*) permissions on sensitive resources
43
+ - Role-based access control (RBAC) by team/department
44
+ - Multi-factor authentication (MFA) for humans
45
+ - Service-to-service authentication via temporary credentials
46
+
47
+ 4. **Change Management**
48
+ - Documented change procedures with approval workflow
49
+ - Separation of duties: Developers, reviewers, approval authority
50
+ - Automated testing in CI/CD before production deployment
51
+ - Change logs with timestamps, author, and justification
52
+ - Rollback procedures documented and tested
53
+
54
+ ### HIPAA Compliance
55
+
56
+ **Healthcare Data Protection Requirements**:
57
+
58
+ 1. **Business Associate Agreement (BAA)**
59
+ - Mandatory: Cloud provider must sign BAA before deployment
60
+ - Covers: AWS, Azure, GCP, managed services
61
+ - Do not use: Generic SaaS platforms without BAA
62
+
63
+ 2. **Encryption Requirements**
64
+ - Encryption at rest: AWS KMS, Azure Key Vault, or GCP KMS
65
+ - Customer-managed keys (CMK): Not provider-managed default keys
66
+ - Encryption in transit: TLS 1.2+ for all PHI transfers
67
+ - Database encryption: All databases holding PHI (RDS, DynamoDB)
68
+ - S3/Blob encryption: All healthcare data storage
69
+
70
+ 3. **Audit Logging**
71
+ - CloudTrail/Activity Log: All access to PHI systems
72
+ - Application logging: Access, modification, deletion events
73
+ - Retention: Minimum 6 years (state laws may require longer)
74
+ - Immutable storage: Prevent audit log tampering
75
+
76
+ 4. **Network Isolation**
77
+ - VPC for database and processing: No public endpoints
78
+ - Security groups: Whitelist only necessary ports
79
+ - NACLs: Network ACLs for additional layer
80
+ - Private subnets: Database and sensitive compute resources
81
+ - VPN/Bastion for administrative access
82
+
83
+ 5. **No Public Endpoints**
84
+ - API Gateway: Private endpoints, not public
85
+ - Lambda: Invoke only from VPC or authenticated clients
86
+ - Databases: Private subnets only
87
+ - S3: Block public access, bucket policies deny public
88
+
89
+ ### GDPR Compliance
90
+
91
+ **European Data Protection Regulations**:
92
+
93
+ 1. **Data Residency Controls**
94
+ - EU data: Must reside in EU regions (eu-west-1, eu-central-1)
95
+ - Data localization: No automatic replication outside EU
96
+ - Backup regions: Only EU-based backup locations
97
+ - Processing: Ensure data processors operate in EU
98
+ - Documentation: Mapping of data to region/controller
99
+
100
+ 2. **Right to Erasure (Data Deletion)**
101
+ - Deletion capabilities: Systems must support complete data removal
102
+ - Orphaned data: Periodic scans for disconnected/abandoned data
103
+ - Backup deletion: Timely deletion from backup systems
104
+ - Third-party deletion: Data deletion from all processors
105
+ - Compliance evidence: Document deletion execution and timing
106
+ - Foreign keys: Cascade deletes or documented orphaned records
107
+
108
+ 3. **Consent Management**
109
+ - Consent records: Timestamp and version of every consent
110
+ - Granular consent: Separate for marketing, analytics, processing
111
+ - Easy withdrawal: Simple mechanisms to withdraw consent
112
+ - Documentation: Proof of consent for audits
113
+ - Cookie management: Consent before non-essential tracking
114
+
115
+ 4. **Data Portability**
116
+ - Export formats: JSON, CSV, or standard formats
117
+ - Completeness: All data subject to export request
118
+ - Machine-readable: Structured data in machine-readable format
119
+ - Timing: Provide within 30 days of request
120
+ - No fees: Free data export (no extraction charges)
121
+
122
+ 5. **Privacy by Design**
123
+ - Data minimization: Collect only necessary data
124
+ - Purpose limitation: Use data only for stated purposes
125
+ - Retention policies: Delete when no longer needed
126
+ - Default privacy: Private by default, not opt-in later
127
+ - Impact assessments: DPIA for new processing activities
128
+
129
+ ### PCI-DSS Compliance
130
+
131
+ **Payment Card Data Protection (v3.2.1 or later)**:
132
+
133
+ 1. **Tokenization Requirements**
134
+ - Never store raw card data: PAN, CVV, expiration
135
+ - Tokenization service: Stripe, Square, or PCI-compliant provider
136
+ - Token storage only: Systems never handle raw card data
137
+ - Scope reduction: Tokenization dramatically reduces PCI scope
138
+
139
+ 2. **Encryption Requirements**
140
+ - Encryption at rest: All card data and keys in secure storage
141
+ - Encryption in transit: TLS 1.2+ minimum for all payments
142
+ - Key management: HSM (Hardware Security Module) recommended
143
+ - Key rotation: Annual minimum or per compliance policy
144
+ - Test keys: Separate test environment keys
145
+
146
+ 3. **Network Segmentation**
147
+ - Cardholder data environment (CDE): Isolated network segment
148
+ - Firewalls: Between CDE and non-CDE systems
149
+ - Intrusion detection: IDS monitoring for CDE
150
+ - Testing: Regular penetration testing (quarterly minimum)
151
+
152
+ 4. **Regular Security Audits**
153
+ - Quarterly vulnerability scans: External scanning service
154
+ - Annual penetration testing: By approved assessor
155
+ - Compliance validation: Annual SAQ or audit
156
+ - Incident response testing: Test breach response procedures
157
+
158
+ 5. **Secure Card Data Handling**
159
+ - No storage of sensitive authentication data: CVC/CVV, PIN
160
+ - No storage of magnetic stripe data after auth
161
+ - Transaction logging: All card interactions logged
162
+ - Access controls: Minimize people accessing card data
163
+
164
+ ## Security Misconfiguration Warnings
165
+
166
+ **Common Serverless Security Issues**:
167
+
168
+ ### ❌ Public S3 Buckets
169
+ ```
170
+ WRONG:
171
+ - S3 bucket with public read access
172
+ - "Block public access" disabled
173
+ - Bucket policy allows s3:GetObject to "*"
174
+
175
+ CORRECT:
176
+ - Block public access: enabled
177
+ - Bucket policy: Only CloudFront, VPC endpoints, specific IAM roles
178
+ - Encryption: enabled with customer-managed keys
179
+ ```
180
+
181
+ ### ❌ Overly Permissive IAM Policies
182
+ ```
183
+ WRONG:
184
+ {
185
+ "Effect": "Allow",
186
+ "Action": "s3:*", # WILDCARD ACTION
187
+ "Resource": "*" # WILDCARD RESOURCE
188
+ }
189
+
190
+ CORRECT:
191
+ {
192
+ "Effect": "Allow",
193
+ "Action": ["s3:GetObject", "s3:PutObject"],
194
+ "Resource": "arn:aws:s3:::specific-bucket/specific-prefix/*",
195
+ "Condition": {
196
+ "IpAddress": {"aws:SourceIp": "10.0.0.0/8"}
197
+ }
198
+ }
199
+ ```
200
+
201
+ ### ❌ Hardcoded Secrets
202
+ ```
203
+ WRONG:
204
+ const apiKey = "sk_test_123456789abcdef"; // In code or env vars
205
+
206
+ CORRECT:
207
+ // AWS
208
+ const secret = await secretsManager.getSecretValue('api-key');
209
+
210
+ // Azure
211
+ const credential = new DefaultAzureCredential();
212
+ const client = new SecretClient(vaultUrl, credential);
213
+
214
+ // GCP
215
+ const [version] = await client.accessSecretVersion({name: secretName});
216
+ ```
217
+
218
+ ### ❌ Unencrypted Databases
219
+ ```
220
+ WRONG:
221
+ - RDS without encryption
222
+ - DynamoDB without encryption
223
+ - DocumentDB without encryption
224
+
225
+ CORRECT:
226
+ - All databases encrypted at rest
227
+ - Customer-managed keys in KMS
228
+ - Encryption enabled during creation
229
+ - Cannot be disabled after creation
230
+ ```
231
+
232
+ ### ❌ Missing HTTPS Enforcement
233
+ ```
234
+ WRONG:
235
+ - API Gateway accepting HTTP traffic
236
+ - No redirect from HTTP to HTTPS
237
+ - Clients can connect via unencrypted channel
238
+
239
+ CORRECT:
240
+ - API Gateway: minimum TLS 1.2
241
+ - Redirect HTTP → HTTPS (301)
242
+ - Client certificates for additional security
243
+ - HSTS header: Strict-Transport-Security
244
+ ```
245
+
246
+ ### ❌ Exposed Environment Variables
247
+ ```
248
+ WRONG:
249
+ export DATABASE_PASSWORD="MyPassword123"
250
+ console.log(process.env.DATABASE_PASSWORD) # In logs
251
+
252
+ CORRECT:
253
+ - Use AWS Secrets Manager, Azure Key Vault, GCP Secret Manager
254
+ - Inject as secret environment variables (redacted in logs)
255
+ - Never log secrets or sensitive configuration
256
+ - Rotate secrets annually
257
+ ```
258
+
259
+ ### ❌ Missing Network Isolation
260
+ ```
261
+ WRONG:
262
+ - Lambda in public subnet with NAT
263
+ - Database accessible from internet
264
+ - No security groups restricting access
265
+
266
+ CORRECT:
267
+ - Lambda in private subnet
268
+ - Database in private subnet
269
+ - Security groups: Lambda → Database only
270
+ - No route to Internet Gateway from database subnet
271
+ ```
272
+
273
+ ## Production Security Checklist
274
+
275
+ **Before deploying to production, verify all items**:
276
+
277
+ ### Identity & Access
278
+ - [ ] IAM roles: Least privilege principle applied
279
+ - [ ] No wildcard permissions: All permissions specific to resource/action
280
+ - [ ] Cross-account access: No trusting wildcard principals
281
+ - [ ] API keys: Rotated annually (or per policy)
282
+ - [ ] MFA: Enabled for all human users
283
+ - [ ] Service accounts: Using temporary credentials (STS)
284
+ - [ ] Resource-based policies: Scoped to specific principals
285
+
286
+ ### Secrets Management
287
+ - [ ] Database passwords: In Secrets Manager, not code
288
+ - [ ] API keys: In Secrets Manager, not environment variables
289
+ - [ ] Keys rotated: Annually or per compliance requirement
290
+ - [ ] Audit logging: All secret access logged and monitored
291
+ - [ ] Access restricted: Only authorized applications/users
292
+ - [ ] Old versions: Deleted or marked deprecated
293
+
294
+ ### Encryption
295
+ - [ ] Encryption at rest: Enabled for all databases and storage
296
+ - [ ] Customer-managed keys: Using KMS, Key Vault, or equivalent
297
+ - [ ] Encryption in transit: TLS 1.2+ for all APIs
298
+ - [ ] Certificate validation: Proper SSL/TLS certificate chains
299
+ - [ ] Key rotation: Automatic or scheduled rotation configured
300
+ - [ ] Backward compatibility: Can decrypt older encrypted data
301
+
302
+ ### Network Security
303
+ - [ ] VPC: Sensitive resources in private subnets
304
+ - [ ] Security groups: Whitelisting only necessary ports
305
+ - [ ] NACLs: Network ACLs for additional layer
306
+ - [ ] NAT Gateway: For private subnet outbound traffic
307
+ - [ ] No public endpoints: Databases, caches in private subnets
308
+ - [ ] VPN/Bastion: For administrative access
309
+ - [ ] HTTPS enforcement: Redirect HTTP to HTTPS
310
+
311
+ ### Data Protection
312
+ - [ ] PII classification: Data tagged and tracked
313
+ - [ ] Backup encryption: Backups encrypted with KMS keys
314
+ - [ ] Backup testing: Regular restore tests from backups
315
+ - [ ] Data retention: Policies documented and enforced
316
+ - [ ] Data deletion: Procedures tested for GDPR/compliance
317
+ - [ ] Sensitive data: No logs, error messages, or metrics
318
+ - [ ] Database activity monitoring: Enabled for compliance
319
+
320
+ ### Logging & Monitoring
321
+ - [ ] CloudTrail/Activity Logs: Enabled and retained 90+ days
322
+ - [ ] Application logging: Access, modification, deletion events
323
+ - [ ] Log aggregation: Centralized in ELK, Splunk, or cloud solution
324
+ - [ ] Immutable logs: Write-once storage for audit trails
325
+ - [ ] Alerting: Real-time alerts for security events
326
+ - [ ] Log retention: Per compliance requirement (90 days minimum)
327
+ - [ ] Log analysis: Regular review for anomalies
328
+
329
+ ### Deployment & CI/CD
330
+ - [ ] Code scanning: SAST tools in CI/CD pipeline
331
+ - [ ] Dependency scanning: SCA for vulnerable dependencies
332
+ - [ ] Container scanning: Image scanning before deployment
333
+ - [ ] Secrets scanning: Detect hardcoded secrets
334
+ - [ ] Approval workflow: Required before production deployment
335
+ - [ ] Automated testing: Security tests in pipeline
336
+ - [ ] Change logs: All changes documented with justification
337
+
338
+ ### Compliance & Auditing
339
+ - [ ] Compliance framework: Selected (SOC 2, HIPAA, GDPR, PCI-DSS)
340
+ - [ ] BAA signed: If healthcare data (HIPAA required)
341
+ - [ ] Security policy: Documented and communicated
342
+ - [ ] Incident response: Plan documented and tested
343
+ - [ ] Vulnerability disclosure: Process for reporting issues
344
+ - [ ] Regular assessments: Penetration testing scheduled
345
+ - [ ] Documentation: All security controls documented
346
+
347
+ ### Testing
348
+ - [ ] Security tests: Unit and integration security tests
349
+ - [ ] Penetration testing: Quarterly or annually
350
+ - [ ] Chaos engineering: Test recovery from security incidents
351
+ - [ ] Compliance validation: Annual audit or SAQ
352
+ - [ ] Incident simulations: Quarterly breach response drills
353
+
354
+ ## When to Request Compliance Architecture
355
+
356
+ Request my help when:
357
+ 1. User mentions regulated industry (healthcare, finance, payment processing)
358
+ 2. Project involves customer data, personal information, or sensitive records
359
+ 3. Requirements specify SOC 2, HIPAA, GDPR, PCI-DSS, or other compliance
360
+ 4. User asks about security best practices or data protection
361
+ 5. Deployment involves cross-border data transfer
362
+
363
+ ## Integration with Security Agent
364
+
365
+ **Coordinate with Security Agent for**:
366
+ - Detailed threat modeling and risk assessment
367
+ - Security architecture review and hardening
368
+ - Incident response planning and testing
369
+ - Penetration testing coordination
370
+ - Vulnerability management processes
371
+
372
+ ---
373
+
374
+ **Remember**: Compliance is not a checkbox exercise - it's about building secure, trustworthy systems that protect user data and meet legal obligations.