Vapor 4
Last reviewed Sep 20, 2026
Prompt Details
Prompt Composition
2prompts
- Swift 6.3121 lines · 4.3K tokens
- Vapor 491 lines · 4.4K tokens
Total212 lines · 8.7K tokens
CWE Coverage
- 22
- 59
- 73
- 78
- 79
- 89
- 93
- 113
- 117
- 125
- 190
- 201
- 208
- 209
- 250
- 252
- 256
- 294
- 295
- 306
- 307
- 319
- 323
- 338
- 346
- 347
- 352
- 362
- 367
- 384
- 409
- 416
- 426
- 502
- 522
- 525
- 532
- 552
- 598
- 601
- 613
- 614
- 639
- 732
- 770
- 772
- 798
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1173
- 1240
- 1275
- 1284
- 1285
- 1286
- 1287
- 1333
- 1395
Prompt Preview
Apply the Swift 6.3 baseline first. These rules cover Vapor 4 and its HTTP server, middleware, authentication, sessions, content, files, clients, and WebSockets, and were checked against 4.122.1. Fluent and Leaf rules apply only when those separate packages are installed.
Version and dependency boundaries
- Build with the Swift 6.3 toolchain on a supported operating system and verify the complete resolved dependency graph; Vapor's declared Swift 6.0 tools minimum does not establish the minimum of newer dependencies.
- Keep Vapor on the newest 4.x release: its security policy lists the 4.x line as supported, and fixes ship in new 4.x releases rather than backports to older ones.
- Check
swift-nio,swift-nio-http2, andswift-nio-sslseparately from Vapor. Vapor's declared ranges admit releases that predate the HTTP parser, header validation,ByteBuffer, WebSocket, and certificate-name fixes, and vulnerability scanners miss some SwiftNIO advisories, so before each release compare the versions inPackage.resolvedwith the fixed releases listed on each project's GitHub security advisory page and move to them withswift package update <name>.
Routes, middleware, and authorization
- Register authenticators before
User.guardMiddleware()on protected route groups and usetry req.auth.require(User.self)when retrieving required identity. Basic and bearer authenticators can continue without authenticating, and credentials authenticators swallow content-decoding failures; authentication middleware alone does not require login. - Enforce resource, tenant,