Axum 0.8

Last reviewed Sep 19, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Rust 1.98136 lines · 3.6K tokens
  2. 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::layer or Router::route_layer; routes added later do not inherit that middleware.
  • Protect sensitive fallbacks explicitly. Router::route_layer skips unmatched paths; MethodRouter::route_layer skips its method fallback, including handlers installed with any. Review fallback_service, method_not_allowed_fallback, and route_service when composing routers.
  • Review the actual request order: repeated Router::layer calls run the last added layer first, while ServiceBuilder runs 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 with Router::layer run after route selection. Account for nest stripping the matched prefix and inheriting outer fallbacks; use OriginalUri only when policy needs the original full URI.
  • Keep get handlers free of business mutations and apply their authorization to HEAD too: Axum runs the GET handler for HEAD and