yinzerflow 0.2.7 → 0.2.9
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/docs/{advanced-configuration-options.md → configuration/advanced-configuration-options.md} +2 -0
- package/docs/configuration/configuration-patterns.md +500 -0
- package/docs/core/context.md +92 -0
- package/docs/core/error-handling.md +293 -0
- package/docs/core/examples.md +195 -0
- package/docs/{request.md → core/request.md} +3 -36
- package/docs/{response.md → core/response.md} +1 -40
- package/docs/{routes.md → core/routes.md} +17 -116
- package/docs/quick-reference.md +346 -0
- package/docs/{body-parsing.md → security/body-parsing.md} +3 -1
- package/docs/{cors.md → security/cors.md} +3 -1
- package/docs/{ip-security.md → security/ip-security.md} +3 -1
- package/docs/security/security-overview.md +282 -0
- package/docs/start-here.md +14 -8
- package/example/app/handlers/example.ts +1 -4
- package/example/app/index.ts +10 -15
- package/example/docker-compose.yml +1 -1
- package/index.d.ts +1 -1
- package/index.js +11 -11
- package/index.js.map +10 -10
- package/package.json +1 -1
- /package/docs/{logging.md → security/logging.md} +0 -0
|
@@ -30,54 +30,9 @@ YinzerFlow's routing system includes built-in security and performance optimizat
|
|
|
30
30
|
| **Hook System** | Optional | Before/after hooks for middleware |
|
|
31
31
|
| **Route Groups** | Optional | Organized route prefixes and shared hooks |
|
|
32
32
|
|
|
33
|
-
## Basic
|
|
33
|
+
## Basic Examples
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
import { YinzerFlow } from 'yinzerflow';
|
|
37
|
-
|
|
38
|
-
const app = new YinzerFlow({ port: 3000 });
|
|
39
|
-
|
|
40
|
-
// Simple GET route
|
|
41
|
-
app.get('/api/health', ({ response }) => {
|
|
42
|
-
return { status: 'healthy', timestamp: new Date().toISOString() };
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// POST route with body parsing
|
|
46
|
-
app.post('/api/users', ({ request }) => {
|
|
47
|
-
const userData = request.body;
|
|
48
|
-
const clientIp = request.ipAddress;
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
message: 'User created',
|
|
52
|
-
data: userData,
|
|
53
|
-
clientIp
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Route with parameters
|
|
58
|
-
app.get('/api/users/:id', ({ request }) => {
|
|
59
|
-
const userId = request.params.id;
|
|
60
|
-
const includeProfile = request.query.include_profile;
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
userId,
|
|
64
|
-
includeProfile,
|
|
65
|
-
message: 'User details retrieved'
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
For detailed information about the request and response objects, see [Request Documentation](./request.md) and [Response Documentation](./response.md).
|
|
71
|
-
|
|
72
|
-
## Common Use Cases
|
|
73
|
-
|
|
74
|
-
- **API Endpoints**: Create RESTful APIs with proper HTTP methods and status codes
|
|
75
|
-
- **File Uploads**: Handle multipart form data with automatic parsing and validation
|
|
76
|
-
- **Authentication**: Implement middleware hooks for token validation and user sessions
|
|
77
|
-
- **Rate Limiting**: Add before hooks to limit request frequency and prevent abuse
|
|
78
|
-
- **Logging**: Use after hooks to log request/response data for monitoring
|
|
79
|
-
- **CORS Handling**: Configure cross-origin requests with proper headers and preflight handling
|
|
80
|
-
- **Route Organization**: Group related routes with shared prefixes and middleware
|
|
35
|
+
For common routing patterns and examples, see [Shared Examples](./examples.md).
|
|
81
36
|
|
|
82
37
|
## HTTP Methods
|
|
83
38
|
|
|
@@ -524,46 +479,9 @@ await app.listen();
|
|
|
524
479
|
|
|
525
480
|
## Error Handling
|
|
526
481
|
|
|
527
|
-
YinzerFlow provides comprehensive error handling
|
|
528
|
-
|
|
529
|
-
### Custom Error Handlers
|
|
530
|
-
```typescript
|
|
531
|
-
// Global error handler
|
|
532
|
-
app.onError(({ request, response }) => {
|
|
533
|
-
console.error('Unhandled error:', request.path);
|
|
534
|
-
response.setStatusCode(500);
|
|
535
|
-
return { error: 'Internal server error' };
|
|
536
|
-
});
|
|
482
|
+
YinzerFlow provides comprehensive error handling with automatic error catching and custom error handlers. The framework automatically catches all errors thrown in route handlers, hooks, and middleware.
|
|
537
483
|
|
|
538
|
-
|
|
539
|
-
app.onNotFound(({ request, response }) => {
|
|
540
|
-
response.setStatusCode(404);
|
|
541
|
-
return {
|
|
542
|
-
error: 'Route not found',
|
|
543
|
-
path: request.path,
|
|
544
|
-
method: request.method
|
|
545
|
-
};
|
|
546
|
-
});
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
### Route-Specific Error Handling
|
|
550
|
-
```typescript
|
|
551
|
-
app.get('/api/users/:id', ({ request, response }) => {
|
|
552
|
-
try {
|
|
553
|
-
const userId = request.params.id;
|
|
554
|
-
|
|
555
|
-
// Simulate database lookup
|
|
556
|
-
if (userId === '999') {
|
|
557
|
-
throw new Error('User not found');
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
return { userId, name: 'John Doe' };
|
|
561
|
-
} catch (error) {
|
|
562
|
-
response.setStatusCode(404);
|
|
563
|
-
return { error: 'User not found' };
|
|
564
|
-
}
|
|
565
|
-
});
|
|
566
|
-
```
|
|
484
|
+
For detailed error handling documentation including advanced patterns, security considerations, and best practices, see [Error Handling Documentation](./error-handling.md).
|
|
567
485
|
|
|
568
486
|
## HandlerCallback Interface
|
|
569
487
|
|
|
@@ -619,38 +537,21 @@ Using the interface is optional but encouraged for better type safety and develo
|
|
|
619
537
|
|
|
620
538
|
## Security Considerations
|
|
621
539
|
|
|
622
|
-
YinzerFlow implements several security measures to prevent common routing vulnerabilities:
|
|
623
|
-
|
|
624
|
-
### 🛡️ Route Parameter Validation
|
|
625
|
-
- **Problem**: Malicious route parameters can cause injection attacks or bypass security controls
|
|
626
|
-
- **YinzerFlow Solution**: Automatic parameter validation and sanitization prevents injection attacks
|
|
627
|
-
|
|
628
|
-
### 🛡️ Path Traversal Protection
|
|
629
|
-
- **Problem**: Directory traversal attacks through URL paths can access unauthorized files
|
|
630
|
-
- **YinzerFlow Solution**: Comprehensive path normalization and validation prevents traversal attempts
|
|
631
|
-
|
|
632
|
-
### 🛡️ Query Parameter Sanitization
|
|
633
|
-
- **Problem**: Malicious query parameters can cause injection attacks or bypass validation
|
|
634
|
-
- **YinzerFlow Solution**: Automatic query parameter parsing with built-in sanitization
|
|
635
|
-
|
|
636
|
-
### 🛡️ Request Body Validation
|
|
637
|
-
- **Problem**: Malformed request bodies can cause parsing errors or security vulnerabilities
|
|
638
|
-
- **YinzerFlow Solution**: Comprehensive body parsing with size limits and validation - see [Body Parsing Documentation](./body-parsing.md)
|
|
639
|
-
|
|
640
|
-
### 🛡️ Hook Execution Security
|
|
641
|
-
- **Problem**: Malicious hooks can modify responses or bypass security controls
|
|
642
|
-
- **YinzerFlow Solution**: Hook execution is isolated and errors are handled gracefully
|
|
540
|
+
YinzerFlow implements several security measures to prevent common routing vulnerabilities. For detailed security documentation, see:
|
|
643
541
|
|
|
644
|
-
|
|
645
|
-
- **
|
|
646
|
-
- **
|
|
542
|
+
- **[Body Parsing Security](../security/body-parsing.md)** - Protection against DoS attacks and malicious payloads
|
|
543
|
+
- **[CORS Security](../security/cors.md)** - Cross-origin request validation and protection
|
|
544
|
+
- **[IP Security](../security/ip-security.md)** - Client IP validation and spoofing protection
|
|
647
545
|
|
|
648
|
-
###
|
|
649
|
-
- **Problem**: Invalid HTTP methods can cause parsing errors or security issues
|
|
650
|
-
- **YinzerFlow Solution**: Strict validation of HTTP methods against RFC specifications
|
|
546
|
+
### Key Security Features
|
|
651
547
|
|
|
652
|
-
|
|
653
|
-
- **
|
|
654
|
-
- **
|
|
548
|
+
- **Route Parameter Validation**: Automatic validation and sanitization prevents injection attacks
|
|
549
|
+
- **Path Traversal Protection**: Comprehensive path normalization prevents directory traversal
|
|
550
|
+
- **Query Parameter Sanitization**: Built-in sanitization with configurable limits
|
|
551
|
+
- **Request Body Validation**: Size limits and content validation prevent DoS attacks
|
|
552
|
+
- **Hook Execution Security**: Isolated hook execution with graceful error handling
|
|
553
|
+
- **Route Collision Prevention**: Automatic detection and prevention of route conflicts
|
|
554
|
+
- **Method Validation**: Strict HTTP method validation against RFC specifications
|
|
555
|
+
- **Response Header Security**: Automatic security headers and validation
|
|
655
556
|
|
|
656
557
|
These security measures ensure YinzerFlow's routing implementation follows security best practices and prevents common attack vectors while maintaining HTTP compliance and performance.
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Quick Reference
|
|
2
|
+
|
|
3
|
+
This quick reference contains the most common patterns and examples for YinzerFlow. For detailed documentation, see the full documentation sections.
|
|
4
|
+
|
|
5
|
+
## Installation & Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install
|
|
9
|
+
npm install yinzerflow
|
|
10
|
+
|
|
11
|
+
# Basic setup
|
|
12
|
+
import { YinzerFlow } from 'yinzerflow';
|
|
13
|
+
const app = new YinzerFlow({ port: 3000 });
|
|
14
|
+
await app.listen();
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Basic Routes
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// GET route
|
|
21
|
+
app.get('/api/users', (ctx) => {
|
|
22
|
+
return { users: ['John', 'Jane'] };
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// POST route with body
|
|
26
|
+
app.post('/api/users', (ctx) => {
|
|
27
|
+
const userData = ctx.request.body;
|
|
28
|
+
return { message: 'User created', data: userData };
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Route with parameters
|
|
32
|
+
app.get('/api/users/:id', (ctx) => {
|
|
33
|
+
const userId = ctx.request.params.id;
|
|
34
|
+
return { userId, name: 'John Doe' };
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Route with query parameters
|
|
38
|
+
app.get('/api/search', (ctx) => {
|
|
39
|
+
const { q, limit } = ctx.request.query;
|
|
40
|
+
return { search: q, limit: parseInt(limit || '10') };
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## HTTP Methods
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
app.get('/api/users', handler); // GET
|
|
48
|
+
app.post('/api/users', handler); // POST
|
|
49
|
+
app.put('/api/users/:id', handler); // PUT
|
|
50
|
+
app.patch('/api/users/:id', handler); // PATCH
|
|
51
|
+
app.delete('/api/users/:id', handler); // DELETE
|
|
52
|
+
app.options('/api/users', handler); // OPTIONS
|
|
53
|
+
app.head('/api/users', handler); // HEAD (or auto-registered with GET)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Route Groups
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
app.group('/api/v1', (group) => {
|
|
60
|
+
group.get('/users', handler);
|
|
61
|
+
group.post('/users', handler);
|
|
62
|
+
group.get('/users/:id', handler);
|
|
63
|
+
}, {
|
|
64
|
+
beforeHooks: [authHook]
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Hooks
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// Route-specific hooks
|
|
72
|
+
app.post('/api/users', handler, {
|
|
73
|
+
beforeHooks: [authHook, logHook],
|
|
74
|
+
afterHooks: [responseHook]
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Global hooks
|
|
78
|
+
app.beforeAll([globalAuthHook]);
|
|
79
|
+
app.afterAll([globalLogHook]);
|
|
80
|
+
app.onError(errorHandler);
|
|
81
|
+
app.onNotFound(notFoundHandler);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Request Data
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
app.post('/api/users', ({ request }) => {
|
|
88
|
+
// Body data
|
|
89
|
+
const userData = request.body;
|
|
90
|
+
|
|
91
|
+
// URL parameters
|
|
92
|
+
const userId = request.params.id;
|
|
93
|
+
|
|
94
|
+
// Query parameters
|
|
95
|
+
const { page, limit } = request.query;
|
|
96
|
+
|
|
97
|
+
// Headers
|
|
98
|
+
const token = request.headers['authorization'];
|
|
99
|
+
|
|
100
|
+
// Client IP
|
|
101
|
+
const clientIp = request.ipAddress;
|
|
102
|
+
|
|
103
|
+
// Request info
|
|
104
|
+
const { method, path, url } = request;
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Response Control
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
app.post('/api/users', ({ response }) => {
|
|
112
|
+
// Set status code
|
|
113
|
+
response.setStatusCode(201);
|
|
114
|
+
|
|
115
|
+
// Add headers
|
|
116
|
+
response.addHeaders({
|
|
117
|
+
'X-User-ID': '123',
|
|
118
|
+
'Content-Type': 'application/json'
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Return data
|
|
122
|
+
return { message: 'User created' };
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Error Handling
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Global error handler
|
|
130
|
+
app.onError(({ response }, error) => {
|
|
131
|
+
response.setStatusCode(500);
|
|
132
|
+
return { error: 'Internal server error' };
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Route error handling
|
|
136
|
+
app.get('/api/users/:id', ({ request }) => {
|
|
137
|
+
const userId = request.params.id;
|
|
138
|
+
if (!userId) {
|
|
139
|
+
throw new Error('User ID required');
|
|
140
|
+
}
|
|
141
|
+
return { userId };
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Common Configurations
|
|
146
|
+
|
|
147
|
+
### Basic API
|
|
148
|
+
```typescript
|
|
149
|
+
const app = new YinzerFlow({
|
|
150
|
+
port: 3000,
|
|
151
|
+
cors: {
|
|
152
|
+
enabled: true,
|
|
153
|
+
origin: ['https://yourdomain.com']
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Production API
|
|
159
|
+
```typescript
|
|
160
|
+
const app = new YinzerFlow({
|
|
161
|
+
port: 443,
|
|
162
|
+
cors: {
|
|
163
|
+
enabled: true,
|
|
164
|
+
origin: ['https://yourdomain.com'],
|
|
165
|
+
credentials: true
|
|
166
|
+
},
|
|
167
|
+
bodyParser: {
|
|
168
|
+
json: {
|
|
169
|
+
maxSize: 262144, // 256KB
|
|
170
|
+
allowPrototypeProperties: false
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
ipSecurity: {
|
|
174
|
+
trustedProxies: ['127.0.0.1'],
|
|
175
|
+
detectSpoofing: true
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### File Upload Service
|
|
181
|
+
```typescript
|
|
182
|
+
const app = new YinzerFlow({
|
|
183
|
+
port: 3000,
|
|
184
|
+
bodyParser: {
|
|
185
|
+
fileUploads: {
|
|
186
|
+
maxFileSize: 10485760, // 10MB
|
|
187
|
+
maxFiles: 10,
|
|
188
|
+
allowedExtensions: ['.jpg', '.png', '.pdf']
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## TypeScript Support
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
interface UserBody {
|
|
198
|
+
name: string;
|
|
199
|
+
email: string;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interface UserResponse {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
email: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const createUser: HandlerCallback<{
|
|
209
|
+
body: UserBody;
|
|
210
|
+
response: UserResponse;
|
|
211
|
+
}> = ({ request }) => {
|
|
212
|
+
const userData = request.body; // Typed as UserBody
|
|
213
|
+
return {
|
|
214
|
+
id: 'user-123',
|
|
215
|
+
name: userData.name,
|
|
216
|
+
email: userData.email
|
|
217
|
+
}; // Typed as UserResponse
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
app.post('/api/users', createUser);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Common Patterns
|
|
224
|
+
|
|
225
|
+
### Authentication Hook
|
|
226
|
+
```typescript
|
|
227
|
+
const authHook = ({ request, response }) => {
|
|
228
|
+
const token = request.headers['authorization'];
|
|
229
|
+
if (!token) {
|
|
230
|
+
response.setStatusCode(401);
|
|
231
|
+
return { error: 'Unauthorized' };
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Logging Hook
|
|
237
|
+
```typescript
|
|
238
|
+
const logHook = ({ request }) => {
|
|
239
|
+
console.log(`${request.method} ${request.path} - ${request.ipAddress}`);
|
|
240
|
+
};
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Rate Limiting Hook
|
|
244
|
+
```typescript
|
|
245
|
+
const rateLimitHook = ({ request, response }) => {
|
|
246
|
+
const clientIp = request.ipAddress;
|
|
247
|
+
const requests = getRequestCount(clientIp);
|
|
248
|
+
|
|
249
|
+
if (requests > 100) {
|
|
250
|
+
response.setStatusCode(429);
|
|
251
|
+
return { error: 'Too many requests' };
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Validation Hook
|
|
257
|
+
```typescript
|
|
258
|
+
const validateUserData = ({ request, response }) => {
|
|
259
|
+
const userData = request.body;
|
|
260
|
+
|
|
261
|
+
if (!userData.name || !userData.email) {
|
|
262
|
+
response.setStatusCode(400);
|
|
263
|
+
return { error: 'Name and email required' };
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## File Organization
|
|
269
|
+
|
|
270
|
+
### routes/users.ts
|
|
271
|
+
```typescript
|
|
272
|
+
import type { YinzerFlow } from 'yinzerflow';
|
|
273
|
+
|
|
274
|
+
export const registerUserRoutes = (app: YinzerFlow) => {
|
|
275
|
+
app.get('/api/users', getAllUsers);
|
|
276
|
+
app.post('/api/users', createUser);
|
|
277
|
+
app.get('/api/users/:id', getUserById);
|
|
278
|
+
app.put('/api/users/:id', updateUser);
|
|
279
|
+
app.delete('/api/users/:id', deleteUser);
|
|
280
|
+
};
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Main app
|
|
284
|
+
```typescript
|
|
285
|
+
import { YinzerFlow } from 'yinzerflow';
|
|
286
|
+
import { registerUserRoutes } from './routes/users';
|
|
287
|
+
|
|
288
|
+
const app = new YinzerFlow({ port: 3000 });
|
|
289
|
+
registerUserRoutes(app);
|
|
290
|
+
await app.listen();
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Security Checklist
|
|
294
|
+
|
|
295
|
+
- [ ] CORS configured with specific origins
|
|
296
|
+
- [ ] Body parsing limits set appropriately
|
|
297
|
+
- [ ] File upload restrictions in place
|
|
298
|
+
- [ ] IP security configured for infrastructure
|
|
299
|
+
- [ ] Error handling prevents information leakage
|
|
300
|
+
- [ ] Authentication hooks implemented
|
|
301
|
+
- [ ] Rate limiting configured
|
|
302
|
+
- [ ] HTTPS enabled (production)
|
|
303
|
+
- [ ] Security headers configured
|
|
304
|
+
- [ ] Logging configured to avoid sensitive data
|
|
305
|
+
|
|
306
|
+
## Common Issues
|
|
307
|
+
|
|
308
|
+
### CORS Errors
|
|
309
|
+
```typescript
|
|
310
|
+
cors: {
|
|
311
|
+
enabled: true,
|
|
312
|
+
origin: ['https://yourdomain.com'], // Specific origin
|
|
313
|
+
credentials: true // If using cookies
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### File Upload Issues
|
|
318
|
+
```typescript
|
|
319
|
+
bodyParser: {
|
|
320
|
+
fileUploads: {
|
|
321
|
+
maxFileSize: 10485760, // 10MB
|
|
322
|
+
allowedExtensions: ['.jpg', '.png', '.pdf']
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### IP Address Issues
|
|
328
|
+
```typescript
|
|
329
|
+
ipSecurity: {
|
|
330
|
+
trustedProxies: ['127.0.0.1', '192.168.1.10'],
|
|
331
|
+
headerPreference: ['x-forwarded-for', 'x-real-ip']
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Documentation Sections
|
|
336
|
+
|
|
337
|
+
- **[Getting Started](./start-here.md)** - Installation and basic setup
|
|
338
|
+
- **[Routes](./core/routes.md)** - Complete routing system
|
|
339
|
+
- **[Context Object](./core/context.md)** - Request/response interface
|
|
340
|
+
- **[Request Object](./core/request.md)** - Request data access
|
|
341
|
+
- **[Response Object](./core/response.md)** - Response control
|
|
342
|
+
- **[Error Handling](./core/error-handling.md)** - Error management
|
|
343
|
+
- **[Examples](./core/examples.md)** - Common patterns and examples
|
|
344
|
+
- **[Security Overview](./security/security-overview.md)** - Security features
|
|
345
|
+
- **[Configuration Patterns](./configuration/configuration-patterns.md)** - Configuration examples
|
|
346
|
+
- **[Advanced Configuration](./configuration/advanced-configuration-options.md)** - Complete configuration reference
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
# Body Parsing
|
|
1
|
+
# Body Parsing Security
|
|
2
2
|
|
|
3
3
|
YinzerFlow provides comprehensive body parsing with built-in security protections against DoS attacks, prototype pollution, and memory exhaustion vulnerabilities. The body parser automatically handles JSON, file uploads, and URL-encoded form data with configurable security limits.
|
|
4
4
|
|
|
5
|
+
For an overview of all security features, see [Security Overview](./security-overview.md).
|
|
6
|
+
|
|
5
7
|
## Configuration
|
|
6
8
|
|
|
7
9
|
Body parsing is automatically enabled with secure defaults that protect against common attack vectors:
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
# CORS
|
|
1
|
+
# CORS Security
|
|
2
2
|
|
|
3
3
|
YinzerFlow provides built-in CORS support to handle cross-origin requests securely and efficiently.
|
|
4
4
|
|
|
5
|
+
For an overview of all security features, see [Security Overview](./security-overview.md).
|
|
6
|
+
|
|
5
7
|
## Configuration
|
|
6
8
|
|
|
7
9
|
Configure CORS in your YinzerFlow setup:
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
# IP
|
|
1
|
+
# IP Security
|
|
2
2
|
|
|
3
3
|
YinzerFlow provides comprehensive IP address validation and security protection against IP spoofing attacks, supporting multiple header formats with trusted proxy validation.
|
|
4
4
|
|
|
5
|
+
For an overview of all security features, see [Security Overview](./security-overview.md).
|
|
6
|
+
|
|
5
7
|
## Configuration
|
|
6
8
|
|
|
7
9
|
Configure IP security settings in your YinzerFlow application:
|