ai-flow-dev 2.1.9 → 2.2.1
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.
- package/README.md +26 -29
- package/dist/cli.js +10 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/prompts/backend/flow-build-phase-0.md +278 -1738
- package/prompts/backend/flow-build-phase-1.md +19 -0
- package/prompts/backend/flow-build-phase-10.md +1 -0
- package/prompts/backend/flow-build-phase-2.md +19 -0
- package/prompts/backend/flow-build-phase-3.md +19 -0
- package/prompts/backend/flow-build-phase-4.md +19 -0
- package/prompts/backend/flow-build-phase-5.md +19 -0
- package/prompts/backend/flow-build-phase-6.md +19 -0
- package/prompts/backend/flow-build-phase-7.md +19 -0
- package/prompts/backend/flow-build-phase-8.md +6 -7
- package/prompts/backend/flow-build-phase-9.md +15 -0
- package/prompts/backend/flow-build.md +59 -836
- package/prompts/backend/flow-check-review.md +20 -0
- package/prompts/backend/flow-check-test.md +14 -0
- package/prompts/backend/flow-check.md +65 -0
- package/prompts/backend/flow-commit.md +51 -0
- package/prompts/backend/flow-docs-sync.md +53 -53
- package/prompts/backend/flow-work-feature.md +42 -0
- package/prompts/backend/flow-work-fix.md +33 -0
- package/prompts/backend/flow-work-refactor.md +32 -0
- package/prompts/backend/flow-work-resume.md +32 -0
- package/prompts/backend/flow-work.md +127 -0
- package/prompts/frontend/flow-build-phase-0.md +323 -426
- package/prompts/frontend/flow-build-phase-1.md +433 -404
- package/prompts/frontend/flow-build-phase-10.md +33 -0
- package/prompts/frontend/flow-build-phase-2.md +508 -872
- package/prompts/frontend/flow-build-phase-3.md +629 -562
- package/prompts/frontend/flow-build-phase-4.md +438 -382
- package/prompts/frontend/flow-build-phase-5.md +559 -362
- package/prompts/frontend/flow-build-phase-6.md +383 -452
- package/prompts/frontend/flow-build-phase-7.md +818 -392
- package/prompts/frontend/flow-build-phase-8.md +27 -16
- package/prompts/frontend/flow-build-phase-9.md +94 -0
- package/prompts/frontend/flow-build.md +68 -414
- package/prompts/frontend/flow-check-review.md +20 -0
- package/prompts/frontend/flow-check-test.md +14 -0
- package/prompts/frontend/flow-check.md +65 -0
- package/prompts/frontend/flow-commit.md +51 -0
- package/prompts/frontend/flow-docs-sync.md +36 -34
- package/prompts/frontend/flow-work-feature.md +42 -0
- package/prompts/frontend/flow-work-fix.md +33 -0
- package/prompts/frontend/flow-work-refactor.md +32 -0
- package/prompts/frontend/flow-work-resume.md +32 -0
- package/prompts/frontend/flow-work.md +127 -0
- package/prompts/mobile/flow-build-phase-0.md +335 -319
- package/prompts/mobile/flow-build-phase-1.md +438 -493
- package/prompts/mobile/flow-build-phase-10.md +32 -0
- package/prompts/mobile/flow-build-phase-2.md +458 -464
- package/prompts/mobile/flow-build-phase-3.md +613 -487
- package/prompts/mobile/flow-build-phase-4.md +439 -258
- package/prompts/mobile/flow-build-phase-5.md +582 -250
- package/prompts/mobile/flow-build-phase-6.md +389 -359
- package/prompts/mobile/flow-build-phase-7.md +871 -285
- package/prompts/mobile/flow-build-phase-8.md +27 -16
- package/prompts/mobile/flow-build-phase-9.md +90 -0
- package/prompts/mobile/flow-build.md +67 -426
- package/prompts/mobile/flow-check-review.md +20 -0
- package/prompts/mobile/flow-check-test.md +14 -0
- package/prompts/mobile/flow-check.md +65 -0
- package/prompts/mobile/flow-commit.md +51 -0
- package/prompts/mobile/flow-docs-sync.md +37 -40
- package/prompts/mobile/flow-work-feature.md +42 -0
- package/prompts/mobile/flow-work-fix.md +33 -0
- package/prompts/mobile/flow-work-refactor.md +32 -0
- package/prompts/mobile/flow-work-resume.md +32 -0
- package/prompts/mobile/flow-work.md +127 -0
- package/prompts/shared/smart-skip-preflight.md +214 -0
- package/prompts/backend/flow-dev-commit.md +0 -829
- package/prompts/backend/flow-dev-feature.md +0 -1948
- package/prompts/backend/flow-dev-fix.md +0 -952
- package/prompts/backend/flow-dev-refactor.md +0 -690
- package/prompts/backend/flow-dev-review.md +0 -372
- package/prompts/backend/flow-dev-work.md +0 -1081
|
@@ -1,372 +1,553 @@
|
|
|
1
|
-
|
|
1
|
+
## PHASE 4: Security & Authentication (15-20 min)
|
|
2
2
|
|
|
3
|
-
**
|
|
4
|
-
**Questions:** ~10 questions
|
|
5
|
-
**Output:** docs/permissions.md, docs/native-features.md, parts of ai-instructions.md
|
|
6
|
-
---
|
|
7
|
-
## 🎯 Objective
|
|
3
|
+
> **Order for this phase:** 4.1 → 4.2 → 4.3 → 4.4 → 4.5 → 4.6 → 4.7 → 4.8 → 4.9 → 4.10 → 4.11
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
> **📌 Scope-based behavior:**
|
|
6
|
+
>
|
|
7
|
+
> - **MVP:** Ask 4.1-4.5 only (auth basics + CORS), skip 4.6-4.11 (advanced security), mark as "TBD"
|
|
8
|
+
> - **Production-Ready:** Ask 4.1-4.8 and 4.11, skip or simplify 4.9 (compliance) and 4.10 (audit logging)
|
|
9
|
+
> - **Enterprise:** Ask all questions 4.1-4.11 with emphasis on compliance and audit trails
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
2. What native features will you integrate?
|
|
13
|
-
3. How will you handle permission requests?
|
|
14
|
-
4. What third-party SDKs will you use?
|
|
15
|
-
---
|
|
16
|
-
## 📋 Questions
|
|
11
|
+
### Objective
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
Define security policies, authentication, authorization, and compliance requirements.
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
---
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
## 🔍 Pre-Flight Check (Smart Skip Logic)
|
|
23
18
|
|
|
24
|
-
-
|
|
25
|
-
- Requires: Camera permission
|
|
26
|
-
- Best for: Social apps, productivity apps
|
|
19
|
+
> 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../shared/smart-skip-preflight.md) for the complete smart skip logic.
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
**Execute Pre-Flight Check for Phase 4:**
|
|
29
22
|
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
23
|
+
- **Target File**: `specs/security.md`
|
|
24
|
+
- **Phase Name**: "SECURITY & AUTHENTICATION"
|
|
25
|
+
- **Key Items**: Auth strategy, encryption, security patterns, compliance
|
|
26
|
+
- **Typical Gaps**: Compliance requirements, audit logging, security policies
|
|
33
27
|
|
|
34
|
-
|
|
28
|
+
**Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
- Requires: Camera permission
|
|
38
|
-
- Best for: Payment apps, utilities
|
|
30
|
+
---
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
## Phase 4 Questions (Full Mode)
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
- Best for: Most apps
|
|
34
|
+
**4.1 Authentication Method**
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
**If camera selected, ask:**
|
|
48
|
-
|
|
49
|
-
- What library will you use?
|
|
50
|
-
- React Native: react-native-camera, react-native-vision-camera
|
|
51
|
-
- Flutter: camera, image_picker
|
|
52
|
-
- Native: AVFoundation (iOS), Camera2 (Android)
|
|
53
|
-
---
|
|
54
|
-
### Question 4.2: Location Permission
|
|
55
|
-
|
|
56
|
-
**Will your app use location services?**
|
|
57
|
-
|
|
58
|
-
A) ⭐ **Yes - When In Use** (Recommended)
|
|
59
|
-
|
|
60
|
-
- Location only when app is active
|
|
61
|
-
- Requires: Location When In Use permission
|
|
62
|
-
- Best for: Most location-based apps
|
|
63
|
-
|
|
64
|
-
B) **Yes - Always**
|
|
36
|
+
```
|
|
37
|
+
How will users authenticate?
|
|
65
38
|
|
|
66
|
-
|
|
67
|
-
- Requires: Always permission (harder to get approved)
|
|
68
|
-
- Best for: Navigation, fitness tracking
|
|
39
|
+
A) ⭐ JWT (JSON Web Tokens) - Recommended for APIs
|
|
69
40
|
|
|
70
|
-
|
|
41
|
+
- Stateless, scalable
|
|
42
|
+
- Access + Refresh token pattern
|
|
71
43
|
|
|
72
|
-
-
|
|
73
|
-
- Best for: Location-based content
|
|
44
|
+
B) 🔥 Session-based - Traditional web apps
|
|
74
45
|
|
|
75
|
-
|
|
46
|
+
- Server-side sessions
|
|
47
|
+
- Cookie-based
|
|
76
48
|
|
|
77
|
-
-
|
|
78
|
-
- Best for: Most apps
|
|
49
|
+
C) ⚡ OAuth 2.0 / OpenID Connect - External providers
|
|
79
50
|
|
|
80
|
-
|
|
51
|
+
- "Sign in with Google/GitHub/etc."
|
|
52
|
+
- Delegated authentication
|
|
81
53
|
|
|
82
|
-
|
|
54
|
+
D) 🏆 Multi-factor (MFA) - Enterprise security
|
|
83
55
|
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
- Flutter: geolocator, google_maps_flutter
|
|
87
|
-
- Native: CoreLocation (iOS), Location Services (Android)
|
|
88
|
-
---
|
|
89
|
-
### Question 4.3: Push Notifications
|
|
56
|
+
- OTP, SMS, authenticator app
|
|
57
|
+
- Required or optional?
|
|
90
58
|
|
|
91
|
-
|
|
59
|
+
E) API Keys - Service-to-service
|
|
92
60
|
|
|
93
|
-
|
|
61
|
+
- Simple, stateless
|
|
62
|
+
- Limited use cases
|
|
94
63
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
64
|
+
Your choice: __
|
|
65
|
+
Why?
|
|
66
|
+
```
|
|
98
67
|
|
|
99
|
-
|
|
68
|
+
**4.2 JWT Configuration (if using JWT)**
|
|
100
69
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
70
|
+
```
|
|
71
|
+
JWT token configuration:
|
|
72
|
+
|
|
73
|
+
Access Token:
|
|
74
|
+
- Lifetime: __ (recommended: 15min - 1hour)
|
|
75
|
+
- Algorithm: __ (recommended: RS256 or HS256)
|
|
76
|
+
|
|
77
|
+
Refresh Token:
|
|
78
|
+
- Lifetime: __ (recommended: 7-30 days)
|
|
79
|
+
- Storage: [httpOnly cookie / localStorage / database]
|
|
80
|
+
- Rotation strategy: [rotate on use / rotate periodically / no rotation]
|
|
81
|
+
|
|
82
|
+
Token claims to include:
|
|
83
|
+
- userId ✅
|
|
84
|
+
- email ✅
|
|
85
|
+
- roles ✅
|
|
86
|
+
- Custom: __
|
|
87
|
+
```
|
|
104
88
|
|
|
105
|
-
|
|
89
|
+
**4.3 Authorization Model**
|
|
106
90
|
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
```
|
|
92
|
+
How will you manage permissions?
|
|
109
93
|
|
|
110
|
-
|
|
94
|
+
A) ⭐ Role-Based Access Control (RBAC)
|
|
95
|
+
- Users have roles (admin, user, moderator, etc.)
|
|
96
|
+
- Roles have permissions
|
|
97
|
+
- Simple and common
|
|
111
98
|
|
|
112
|
-
|
|
99
|
+
B) 🏆 Attribute-Based Access Control (ABAC)
|
|
100
|
+
- Fine-grained based on attributes
|
|
101
|
+
- Complex rules
|
|
102
|
+
- Enterprise use cases
|
|
113
103
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- Pusher
|
|
118
|
-
- Custom backend
|
|
119
|
-
---
|
|
120
|
-
### Question 4.4: Photo Library Access
|
|
104
|
+
C) 🔒 Resource-based (Ownership)
|
|
105
|
+
- Users can only access their own resources
|
|
106
|
+
- Simple projects
|
|
121
107
|
|
|
122
|
-
|
|
108
|
+
D) 🌐 Multi-tenant with role hierarchy
|
|
109
|
+
- Organization → Teams → Users
|
|
110
|
+
- Complex enterprise systems
|
|
123
111
|
|
|
124
|
-
|
|
112
|
+
Your choice: __
|
|
125
113
|
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
114
|
+
List the roles you'll need:
|
|
115
|
+
-
|
|
116
|
+
-
|
|
129
117
|
|
|
130
|
-
|
|
118
|
+
List key permissions:
|
|
119
|
+
-
|
|
120
|
+
-
|
|
121
|
+
```
|
|
131
122
|
|
|
132
|
-
|
|
133
|
-
- Requires: Photo Library Write permission
|
|
134
|
-
- Best for: Photo editing apps
|
|
123
|
+
**4.4 Password Policy**
|
|
135
124
|
|
|
136
|
-
|
|
125
|
+
```
|
|
126
|
+
Password requirements:
|
|
127
|
+
|
|
128
|
+
A) ⭐ Recommended Policy
|
|
129
|
+
- Minimum 8 characters
|
|
130
|
+
- At least 1 uppercase, 1 lowercase, 1 number
|
|
131
|
+
- Special characters encouraged but not required
|
|
132
|
+
- No maximum length limit
|
|
133
|
+
- Hash with bcrypt (12 rounds) or argon2
|
|
134
|
+
|
|
135
|
+
B) 🏆 Strong Policy (Enterprise)
|
|
136
|
+
- Minimum 12 characters
|
|
137
|
+
- Uppercase, lowercase, number, special char required
|
|
138
|
+
- Password expiration every 90 days
|
|
139
|
+
- Password history (can't reuse last 5)
|
|
140
|
+
|
|
141
|
+
C) 🔓 Simple Policy
|
|
142
|
+
- Minimum 6 characters
|
|
143
|
+
- No complexity requirements
|
|
144
|
+
- Good for low-risk apps
|
|
145
|
+
|
|
146
|
+
Your choice: __
|
|
147
|
+
|
|
148
|
+
Hashing algorithm:
|
|
149
|
+
A) ⭐ bcrypt (rounds: 10-12) - Recommended
|
|
150
|
+
B) argon2 - More secure, newer
|
|
151
|
+
C) scrypt - Good alternative
|
|
152
|
+
```
|
|
137
153
|
|
|
138
|
-
|
|
139
|
-
- Best for: Apps that don't need photos
|
|
154
|
+
**4.5 Rate Limiting**
|
|
140
155
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
### Question 4.5: Contacts Access
|
|
156
|
+
```
|
|
157
|
+
Will you implement rate limiting?
|
|
144
158
|
|
|
145
|
-
|
|
159
|
+
A) ⭐ Yes - Recommended for all public APIs
|
|
146
160
|
|
|
147
|
-
|
|
161
|
+
Rate limits by endpoint type:
|
|
162
|
+
- Authentication endpoints: ** requests per ** (e.g., 5 per 15 min)
|
|
163
|
+
- Public read endpoints: ** requests per ** (e.g., 100 per minute)
|
|
164
|
+
- Write endpoints: ** requests per ** (e.g., 30 per minute)
|
|
165
|
+
- Admin endpoints: ** requests per ** (e.g., 1000 per minute)
|
|
148
166
|
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
167
|
+
Rate limiting strategy:
|
|
168
|
+
A) IP-based
|
|
169
|
+
B) User/API key-based
|
|
170
|
+
C) Both
|
|
152
171
|
|
|
153
|
-
|
|
172
|
+
Tool:
|
|
173
|
+
A) express-rate-limit / @nestjs/throttler
|
|
174
|
+
B) Redis-based rate limiting
|
|
175
|
+
C) API Gateway (AWS, Kong, etc.)
|
|
176
|
+
```
|
|
154
177
|
|
|
155
|
-
|
|
156
|
-
- Requires: Contacts Write permission
|
|
157
|
-
- Best for: Contact management apps
|
|
178
|
+
**4.6 CORS Policy**
|
|
158
179
|
|
|
159
|
-
|
|
180
|
+
```
|
|
181
|
+
CORS (Cross-Origin Resource Sharing) configuration:
|
|
160
182
|
|
|
161
|
-
|
|
162
|
-
|
|
183
|
+
Allowed origins:
|
|
184
|
+
A) ⭐ Specific domains - https://myapp.com, https://admin.myapp.com
|
|
185
|
+
B) 🔧 Development only - localhost:3000, localhost:5173
|
|
186
|
+
C) ⚠️ Wildcard (*) - Allow all (NOT recommended for production)
|
|
163
187
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
### Question 4.6: Biometric Authentication
|
|
188
|
+
Your allowed origins:
|
|
189
|
+
-
|
|
167
190
|
|
|
168
|
-
|
|
191
|
+
Allowed methods: [GET, POST, PUT, PATCH, DELETE, OPTIONS]
|
|
192
|
+
Credentials: [true/false] - Allow cookies/auth headers
|
|
193
|
+
Max age: __ seconds (cache preflight)
|
|
194
|
+
```
|
|
169
195
|
|
|
170
|
-
|
|
196
|
+
**4.7 Data Encryption**
|
|
171
197
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
198
|
+
```
|
|
199
|
+
Encryption requirements:
|
|
200
|
+
|
|
201
|
+
In Transit (HTTPS/TLS):
|
|
202
|
+
A) ✅ Yes, always - TLS 1.2+ required ⭐
|
|
203
|
+
B) Development only HTTP, production HTTPS
|
|
204
|
+
C) Optional
|
|
205
|
+
|
|
206
|
+
At Rest (Database/Files):
|
|
207
|
+
A) ⭐ Yes, encrypt sensitive fields - PII, payment info, secrets
|
|
208
|
+
B) 🏆 Yes, full database encryption - Enterprise requirement
|
|
209
|
+
C) No encryption - Low-risk data only
|
|
210
|
+
|
|
211
|
+
Fields to encrypt:
|
|
212
|
+
-
|
|
213
|
+
-
|
|
214
|
+
|
|
215
|
+
Encryption method:
|
|
216
|
+
A) AES-256-GCM (symmetric)
|
|
217
|
+
B) Database-level encryption
|
|
218
|
+
C) Application-level encryption
|
|
219
|
+
```
|
|
175
220
|
|
|
176
|
-
|
|
221
|
+
**4.8 Security Headers**
|
|
177
222
|
|
|
178
|
-
|
|
179
|
-
|
|
223
|
+
```
|
|
224
|
+
Which security headers will you implement?
|
|
180
225
|
|
|
181
|
-
|
|
226
|
+
A) ✅ All recommended headers (use helmet.js or equivalent)
|
|
227
|
+
- Content-Security-Policy
|
|
228
|
+
- X-Frame-Options: DENY
|
|
229
|
+
- X-Content-Type-Options: nosniff
|
|
230
|
+
- Strict-Transport-Security (HSTS)
|
|
231
|
+
- X-XSS-Protection
|
|
182
232
|
|
|
183
|
-
|
|
233
|
+
B) Basic headers only
|
|
234
|
+
C) None (not recommended)
|
|
235
|
+
```
|
|
184
236
|
|
|
185
|
-
|
|
186
|
-
- React Native: react-native-biometrics, react-native-touch-id
|
|
187
|
-
- Flutter: local_auth
|
|
188
|
-
- Native: LocalAuthentication (iOS), BiometricPrompt (Android)
|
|
189
|
-
---
|
|
190
|
-
### Question 4.7: File System Access
|
|
237
|
+
**4.9 Compliance Requirements**
|
|
191
238
|
|
|
192
|
-
|
|
239
|
+
```
|
|
240
|
+
Does your project need to comply with specific regulations or standards?
|
|
241
|
+
|
|
242
|
+
Some projects must follow legal requirements or industry standards. If you're not sure, you can select "None" and add compliance requirements later.
|
|
243
|
+
|
|
244
|
+
Select all that apply:
|
|
245
|
+
|
|
246
|
+
A) 🌍 GDPR (General Data Protection Regulation)
|
|
247
|
+
What it is: EU data privacy regulation
|
|
248
|
+
When it applies: If you process personal data of users in the European Union
|
|
249
|
+
What it means: Users have rights to access, delete, and export their data
|
|
250
|
+
Key requirements:
|
|
251
|
+
- Right to access data (users can request their data)
|
|
252
|
+
- Right to deletion (users can request data removal)
|
|
253
|
+
- Data portability (users can export their data)
|
|
254
|
+
- Consent management (explicit consent for data processing)
|
|
255
|
+
Example: "We serve users in Germany, so we need GDPR compliance"
|
|
256
|
+
|
|
257
|
+
B) 🏥 HIPAA (Health Insurance Portability and Accountability Act)
|
|
258
|
+
What it is: US healthcare data protection law
|
|
259
|
+
When it applies: If you handle Protected Health Information (PHI) - medical records, health data
|
|
260
|
+
What it means: Strict rules for protecting patient health information
|
|
261
|
+
Key requirements:
|
|
262
|
+
- PHI protection (encryption, access controls)
|
|
263
|
+
- Audit logs (track who accessed what health data)
|
|
264
|
+
- Encryption requirements (data must be encrypted)
|
|
265
|
+
Example: "We're building a telemedicine platform that stores patient records"
|
|
266
|
+
|
|
267
|
+
C) 💳 PCI-DSS (Payment Card Industry Data Security Standard)
|
|
268
|
+
What it is: Security standard for credit card processing
|
|
269
|
+
When it applies: If you process, store, or transmit credit card information
|
|
270
|
+
What it means: Strict security rules to protect cardholder data
|
|
271
|
+
Key requirements:
|
|
272
|
+
- Never store CVV (security code on card)
|
|
273
|
+
- Tokenize card numbers (use tokens instead of real numbers)
|
|
274
|
+
- Secure transmission (encrypted connections required)
|
|
275
|
+
Example: "We process credit card payments directly (not using Stripe/PayPal)"
|
|
276
|
+
|
|
277
|
+
D) 🏢 SOC 2 (System and Organization Controls 2)
|
|
278
|
+
What it is: Security and compliance standard for SaaS companies
|
|
279
|
+
When it applies: If you're selling B2B SaaS and need to prove security to enterprise customers
|
|
280
|
+
What it means: Documented security controls and processes
|
|
281
|
+
Key requirements:
|
|
282
|
+
- Security controls (documented security measures)
|
|
283
|
+
- Audit trails (logs of all security-relevant actions)
|
|
284
|
+
- Access controls (who can access what)
|
|
285
|
+
Example: "We're selling to Fortune 500 companies who require SOC 2 certification"
|
|
286
|
+
|
|
287
|
+
E) 🇺🇸 CCPA (California Consumer Privacy Act)
|
|
288
|
+
What it is: California state privacy law
|
|
289
|
+
When it applies: If you have California users and meet certain thresholds (revenue/users)
|
|
290
|
+
What it means: California users have privacy rights
|
|
291
|
+
Key requirements:
|
|
292
|
+
- Right to know what data is collected
|
|
293
|
+
- Right to delete data
|
|
294
|
+
- Right to opt-out of data sales
|
|
295
|
+
Example: "We have users in California and meet the revenue threshold"
|
|
296
|
+
|
|
297
|
+
F) None - No specific compliance requirements
|
|
298
|
+
Select this if you're not sure or don't need compliance yet
|
|
299
|
+
|
|
300
|
+
Selected: __
|
|
301
|
+
|
|
302
|
+
For each selected, list specific requirements that apply to your project:
|
|
303
|
+
|
|
304
|
+
Example for GDPR:
|
|
305
|
+
- Must allow users to download all their data in JSON format
|
|
306
|
+
- Must completely delete user data when requested (not just soft delete)
|
|
307
|
+
- Need cookie consent banner for EU users
|
|
308
|
+
- Privacy policy must be accessible and up-to-date
|
|
309
|
+
|
|
310
|
+
Example for SOC 2:
|
|
311
|
+
- Need 90-day audit log retention
|
|
312
|
+
- Quarterly access control reviews required
|
|
313
|
+
- Security incident response procedures documented
|
|
314
|
+
- Continuous monitoring of administrative actions
|
|
315
|
+
```
|
|
193
316
|
|
|
194
|
-
|
|
317
|
+
**4.10 Logging & Audit Trail**
|
|
195
318
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
- Best for: Document apps, file managers
|
|
319
|
+
```
|
|
320
|
+
What security events will you log?
|
|
199
321
|
|
|
200
|
-
|
|
322
|
+
A) ✅ Authentication events
|
|
323
|
+
- Login success/failure
|
|
324
|
+
- Password changes
|
|
325
|
+
- Account creation
|
|
201
326
|
|
|
202
|
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
327
|
+
B) ✅ Authorization events
|
|
328
|
+
- Permission denied
|
|
329
|
+
- Role changes
|
|
205
330
|
|
|
206
|
-
C)
|
|
331
|
+
C) ✅ Data access
|
|
332
|
+
- Sensitive data views
|
|
333
|
+
- Exports/downloads
|
|
207
334
|
|
|
208
|
-
|
|
209
|
-
-
|
|
335
|
+
D) ✅ Data modifications
|
|
336
|
+
- Create/Update/Delete operations
|
|
337
|
+
- Who, what, when
|
|
210
338
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
339
|
+
Log retention: __ days (recommended: 90+ days)
|
|
340
|
+
Log storage: [Database / File system / External service (CloudWatch, Datadog)]
|
|
341
|
+
```
|
|
214
342
|
|
|
215
|
-
**
|
|
343
|
+
**4.11 API Keys Management**
|
|
216
344
|
|
|
217
|
-
|
|
345
|
+
```
|
|
346
|
+
Will you use API keys for service-to-service authentication?
|
|
347
|
+
|
|
348
|
+
A) ⭐ Yes - API keys for programmatic access
|
|
349
|
+
B) No - JWT/Sessions only
|
|
350
|
+
|
|
351
|
+
If yes:
|
|
352
|
+
- Key format: [Prefix + random string, UUID, etc.]
|
|
353
|
+
- Key length: __ characters
|
|
354
|
+
- Storage: [Hashed in database, Plain text (not recommended)]
|
|
355
|
+
- Hashing algorithm: [bcrypt, SHA-256, etc.]
|
|
356
|
+
|
|
357
|
+
Key rotation:
|
|
358
|
+
A) ⭐ Manual rotation - Rotate on demand
|
|
359
|
+
B) Automatic rotation - Rotate every __ days
|
|
360
|
+
C) No rotation
|
|
361
|
+
|
|
362
|
+
Key revocation:
|
|
363
|
+
- Process: __
|
|
364
|
+
- Reasons: [Compromised, Expired, User request, Security incident]
|
|
365
|
+
|
|
366
|
+
Rate limiting by API key tier:
|
|
367
|
+
- Free tier: __ requests per __
|
|
368
|
+
- Paid tier: __ requests per __
|
|
369
|
+
- Enterprise: __ requests per __
|
|
370
|
+
```
|
|
218
371
|
|
|
219
|
-
|
|
220
|
-
- Requires: Microphone permission
|
|
221
|
-
- Best for: Voice notes, recording apps
|
|
372
|
+
**4.12 Dependency Security**
|
|
222
373
|
|
|
223
|
-
|
|
374
|
+
```
|
|
375
|
+
How will you manage dependency security?
|
|
376
|
+
|
|
377
|
+
A) ⭐ Automated scanning - Regular security audits (npm audit, Snyk, Dependabot)
|
|
378
|
+
B) Manual scanning - Check vulnerabilities manually
|
|
379
|
+
C) No scanning - Not recommended
|
|
380
|
+
|
|
381
|
+
Scanning frequency:
|
|
382
|
+
A) ⭐ On every install/update
|
|
383
|
+
B) Daily automated scans
|
|
384
|
+
C) Weekly scans
|
|
385
|
+
D) Monthly scans
|
|
386
|
+
|
|
387
|
+
Vulnerability response:
|
|
388
|
+
- Critical: Fix within __ hours
|
|
389
|
+
- High: Fix within __ days
|
|
390
|
+
- Medium: Fix within __ days
|
|
391
|
+
- Low: Fix in next release
|
|
392
|
+
|
|
393
|
+
Tools:
|
|
394
|
+
- Dependency scanner: __
|
|
395
|
+
- Security alerts: [GitHub Dependabot, Snyk, npm audit, etc.]
|
|
396
|
+
```
|
|
224
397
|
|
|
225
|
-
|
|
226
|
-
- Requires: Microphone permission
|
|
227
|
-
- Best for: Communication apps
|
|
398
|
+
**4.13 Input Validation & Sanitization**
|
|
228
399
|
|
|
229
|
-
|
|
400
|
+
```
|
|
401
|
+
Input validation strategy:
|
|
230
402
|
|
|
231
|
-
|
|
232
|
-
-
|
|
403
|
+
A) ⭐ Strict validation with DTOs/Schemas (Recommended)
|
|
404
|
+
- Use validation library: [class-validator/Zod/Pydantic/Joi from Phase 3.6]
|
|
405
|
+
- Reject unknown fields: [yes/no]
|
|
406
|
+
- Type coercion: [strict/lenient]
|
|
233
407
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
408
|
+
B) Manual validation in services
|
|
409
|
+
- Custom validation logic
|
|
410
|
+
- More flexible but error-prone
|
|
237
411
|
|
|
238
|
-
|
|
412
|
+
Sanitization rules:
|
|
239
413
|
|
|
240
|
-
|
|
414
|
+
A) ✅ Sanitize all string inputs (XSS prevention)
|
|
415
|
+
- Strip HTML tags: [yes/no]
|
|
416
|
+
- Escape special characters: [yes/no]
|
|
417
|
+
- Library: [DOMPurify/validator.js/bleach]
|
|
241
418
|
|
|
242
|
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
- D) None
|
|
419
|
+
B) ✅ SQL Injection prevention
|
|
420
|
+
- Use parameterized queries (ORM handles this automatically)
|
|
421
|
+
- Never concatenate user input in queries
|
|
246
422
|
|
|
247
|
-
|
|
423
|
+
Request size limits:
|
|
248
424
|
|
|
249
|
-
-
|
|
250
|
-
-
|
|
251
|
-
-
|
|
252
|
-
- D) None
|
|
425
|
+
- Max JSON body size: __ MB (recommended: 1-10 MB)
|
|
426
|
+
- Max file upload size: __ MB (recommended: 10-50 MB)
|
|
427
|
+
- Max URL length: __ characters (recommended: 2048)
|
|
253
428
|
|
|
254
|
-
|
|
429
|
+
File upload validation (if applicable from Phase 3.9):
|
|
255
430
|
|
|
256
|
-
-
|
|
257
|
-
-
|
|
258
|
-
-
|
|
259
|
-
-
|
|
431
|
+
- Allowed file types: [jpg, png, pdf, etc.]
|
|
432
|
+
- MIME type validation: [yes/no - verify actual content matches extension]
|
|
433
|
+
- File content validation: [yes/no - check file headers]
|
|
434
|
+
- Virus scanning: [yes/no - ClamAV, VirusTotal API]
|
|
435
|
+
- Filename sanitization: [yes/no - remove special characters, limit length]
|
|
260
436
|
|
|
261
|
-
|
|
437
|
+
Content-Type enforcement:
|
|
262
438
|
|
|
263
|
-
|
|
264
|
-
-
|
|
265
|
-
|
|
266
|
-
- D) None
|
|
439
|
+
A) ⭐ Strict - Reject if Content-Type doesn't match body (recommended)
|
|
440
|
+
B) Lenient - Accept common mismatches (application/json vs text/plain)
|
|
441
|
+
C) No validation
|
|
267
442
|
|
|
268
|
-
|
|
443
|
+
Validation approach:
|
|
269
444
|
|
|
270
|
-
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
- D) None
|
|
445
|
+
A) ⭐ Whitelist - Only allow known good inputs (recommended)
|
|
446
|
+
- Define allowed values explicitly
|
|
447
|
+
- Reject everything else
|
|
274
448
|
|
|
275
|
-
|
|
449
|
+
B) Blacklist - Block known bad inputs (not recommended)
|
|
450
|
+
- Easy to bypass
|
|
451
|
+
- Incomplete protection
|
|
276
452
|
|
|
277
|
-
|
|
278
|
-
- B) Auth0 Social Connections
|
|
279
|
-
- C) Custom OAuth
|
|
280
|
-
- D) None
|
|
453
|
+
Special character handling:
|
|
281
454
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
455
|
+
- Allow special characters in: [names, descriptions, etc.]
|
|
456
|
+
- Escape/encode for: [HTML output, SQL queries, shell commands]
|
|
457
|
+
- Reject in: [IDs, slugs, filenames]
|
|
458
|
+
```
|
|
285
459
|
|
|
286
|
-
|
|
460
|
+
### Phase 4 Output
|
|
287
461
|
|
|
288
|
-
|
|
462
|
+
```
|
|
463
|
+
📋 PHASE 4 SUMMARY:
|
|
464
|
+
|
|
465
|
+
Authentication: [method]
|
|
466
|
+
JWT Config: [if applicable - access/refresh token lifetimes, algorithm, storage]
|
|
467
|
+
Authorization: [RBAC/ABAC/etc.]
|
|
468
|
+
Roles: [list]
|
|
469
|
+
Permissions: [key permissions defined]
|
|
470
|
+
Password Policy: [requirements and hashing algorithm]
|
|
471
|
+
Rate Limiting: [yes/no + limits by endpoint type]
|
|
472
|
+
CORS: [origins, methods, credentials, max-age]
|
|
473
|
+
Encryption: [in-transit + at-rest + fields to encrypt]
|
|
474
|
+
Security Headers: [list]
|
|
475
|
+
Compliance: [requirements with specific controls]
|
|
476
|
+
Audit Logging: [events logged + retention + storage]
|
|
477
|
+
API Keys Management: [yes/no + format + rotation + revocation + rate limiting]
|
|
478
|
+
Dependency Security: [scanning tool + frequency + vulnerability response]
|
|
479
|
+
Input Validation: [strategy + sanitization rules + size limits + file upload validation + whitelist/blacklist approach]
|
|
480
|
+
|
|
481
|
+
Is this correct? (Yes/No)
|
|
482
|
+
```
|
|
483
|
+
---
|
|
484
|
+
### 📄 Generate Phase 4 Documents
|
|
289
485
|
|
|
290
|
-
|
|
291
|
-
- Explain why permission is needed
|
|
292
|
-
- Best for: Better user experience
|
|
486
|
+
**Before starting generation:**
|
|
293
487
|
|
|
294
|
-
|
|
488
|
+
```
|
|
489
|
+
📖 Loading context from previous phases...
|
|
490
|
+
✅ Re-reading project-brief.md
|
|
491
|
+
✅ Re-reading docs/data-model.md
|
|
492
|
+
✅ Re-reading docs/architecture.md
|
|
493
|
+
✅ Re-reading ai-instructions.md
|
|
494
|
+
```
|
|
295
495
|
|
|
296
|
-
|
|
297
|
-
- Less ideal (can overwhelm users)
|
|
298
|
-
- Best for: Apps that need all permissions
|
|
496
|
+
**Generate documents automatically:**
|
|
299
497
|
|
|
300
|
-
|
|
498
|
+
**1. `specs/security.md`**
|
|
301
499
|
|
|
302
|
-
-
|
|
303
|
-
-
|
|
500
|
+
- Use template: `.ai-flow/templates/specs/security.template.md`
|
|
501
|
+
- Fill with all security policies, authentication, authorization
|
|
502
|
+
- Write to: `specs/security.md`
|
|
304
503
|
|
|
305
|
-
**
|
|
306
|
-
---
|
|
307
|
-
### Question 4.11: Permission Denial Handling
|
|
504
|
+
**2. Update `ai-instructions.md`**
|
|
308
505
|
|
|
309
|
-
|
|
506
|
+
- Add security rules to NEVER/ALWAYS sections
|
|
507
|
+
- Add authentication/authorization patterns
|
|
310
508
|
|
|
311
|
-
|
|
509
|
+
```
|
|
510
|
+
✅ Generated: specs/security.md
|
|
511
|
+
✅ Updated: ai-instructions.md (security rules added)
|
|
312
512
|
|
|
313
|
-
|
|
314
|
-
- Show alternative options
|
|
315
|
-
- Best for: Better UX
|
|
513
|
+
Documents have been created with all Phase 4 information.
|
|
316
514
|
|
|
317
|
-
|
|
515
|
+
📝 Would you like to make any corrections before continuing?
|
|
318
516
|
|
|
319
|
-
|
|
320
|
-
|
|
517
|
+
→ If yes: Edit the files and type "ready" when done. I'll re-read them.
|
|
518
|
+
→ If no: Type "continue" to proceed to Phase 5.
|
|
519
|
+
```
|
|
321
520
|
|
|
322
|
-
|
|
521
|
+
**If user edits files:**
|
|
522
|
+
Re-read files to refresh context before continuing.
|
|
523
|
+
---
|
|
524
|
+
**Proceed to Phase 5 only after documents are validated.**
|
|
323
525
|
|
|
324
|
-
|
|
325
|
-
|
|
526
|
+
> ⚠️ **CRITICAL:** DO NOT generate README.md in this phase. README.md is ONLY generated in Phase 8 (step 8.5) after framework initialization.
|
|
527
|
+
---
|
|
528
|
+
---
|
|
326
529
|
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
## ✅ Phase 4 Completion
|
|
530
|
+
---
|
|
330
531
|
|
|
331
|
-
|
|
532
|
+
## 📝 Generated Documents
|
|
332
533
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
✅ Phase 4 Complete: Permissions & Native Features
|
|
336
|
-
---
|
|
337
|
-
Selected Permissions:
|
|
338
|
-
- Camera: Photo capture (react-native-vision-camera)
|
|
339
|
-
- Location: When in use (@react-native-community/geolocation)
|
|
340
|
-
- Push Notifications: Yes (Firebase Cloud Messaging)
|
|
341
|
-
- Photo Library: Read only
|
|
342
|
-
- Biometric Auth: Face ID / Touch ID
|
|
534
|
+
After Phase 4, generate/update:
|
|
535
|
+
- `specs/security.md` - Security policies and authentication details
|
|
343
536
|
|
|
344
|
-
|
|
345
|
-
- Analytics: Firebase Analytics
|
|
346
|
-
- Crash Reporting: Firebase Crashlytics
|
|
347
|
-
- Maps: Google Maps
|
|
348
|
-
- Authentication: Firebase Auth
|
|
537
|
+
---
|
|
349
538
|
|
|
350
|
-
|
|
539
|
+
**Next Phase:** Phase 5 - Development Standards (15-20 min)
|
|
351
540
|
|
|
352
|
-
|
|
353
|
-
```
|
|
354
|
-
---
|
|
355
|
-
## 📝 Generated Documents
|
|
541
|
+
Read: `.ai-flow/prompts/backend/flow-build-phase-5.md`
|
|
356
542
|
|
|
357
|
-
|
|
543
|
+
---
|
|
358
544
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
- `ai-instructions.md` - Add permission and native feature rules
|
|
362
|
-
---
|
|
363
|
-
**Next Phase:** Phase 5 - Code Standards
|
|
545
|
+
**Last Updated:** 2025-12-20
|
|
546
|
+
**Version:** 2.1.8
|
|
364
547
|
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
**Last Updated:** 2025-01-XX
|
|
548
|
+
---
|
|
368
549
|
|
|
369
|
-
|
|
550
|
+
## PHASE 5: Development Standards (15-20 min)
|
|
370
551
|
|
|
371
552
|
|
|
372
553
|
|