Axum 0.8
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- Rust 1.98136 lines · 3.6K tokens
- Axum 0.873 lines · 4.3K tokens
Total209 lines · 7.9K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 89
- 90
- 93
- 117
- 125
- 190
- 197
- 208
- 209
- 250
- 288
- 295
- 306
- 319
- 338
- 347
- 352
- 362
- 367
- 378
- 384
- 407
- 409
- 416
- 434
- 502
- 532
- 552
- 601
- 613
- 614
- 639
- 643
- 674
- 770
- 772
- 787
- 807
- 829
- 862
- 863
- 918
- 942
- 1004
- 1275
- 1286
- 1295
- 1336
- 1385
- 1395
Prompt Preview
Apply the Rust 1.98 baseline first, including its toolchain and dependency rules. These rules cover Axum 0.8 with Tokio 1.x, Hyper 1.x, and Tower 0.5, and were checked against 0.8.9. Tower HTTP controls below apply to tower-http 0.6.11 and 0.7.1, both compatible with Axum 0.8.9. Axum declares Rust 1.80 as its minimum; verify the compiler requirements of the complete locked dependency graph.
Routing and middleware
- Register all routes, nested or merged routers, and fallbacks intended for a security boundary before calling
Router::layerorRouter::route_layer; routes added later do not inherit that middleware. - Protect sensitive fallbacks explicitly.
Router::route_layerskips unmatched paths;MethodRouter::route_layerskips its method fallback, including handlers installed withany. Reviewfallback_service,method_not_allowed_fallback, androute_servicewhen composing routers. - Review the actual request order: repeated
Router::layercalls run the last added layer first, whileServiceBuilderruns layers in declaration order. Place response headers and diagnostics so authentication failures, extractor rejections, and limit responses receive them too. - Wrap URI normalization or rewriting around the whole
Router; layers installed withRouter::layerrun after route selection. Account forneststripping the matched prefix and inheriting outer fallbacks; useOriginalUrionly when policy needs the original full URI. - Keep
gethandlers free of business mutations and apply their authorization toHEADtoo: Axum runs the GET handler for HEAD and