Echo 4
Last reviewed Sep 24, 2026
Prompt Details
Prompt Composition
2prompts
- Go 1.27130 lines · 5.5K tokens
- Echo 482 lines · 3.6K tokens
Total212 lines · 9.1K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 250
- 252
- 257
- 287
- 288
- 295
- 307
- 315
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 384
- 426
- 444
- 488
- 494
- 532
- 598
- 601
- 613
- 614
- 636
- 639
- 732
- 759
- 770
- 772
- 807
- 862
- 863
- 915
- 916
- 918
- 942
- 1004
- 1021
- 1275
- 1395
Prompt Preview
Apply the Go 1.27 baseline first. These rules cover Echo 4, the github.com/labstack/echo/v4 line, and were checked against 4.15.4, whose module requires Go 1.25.0 or newer. Use v4 APIs and middleware compatible with this major version.
Routes, authentication, and context lifetime
- Supply authentication middleware when creating
e.Group, before registering routes or subgroups; laterGroup.Usecalls do not retrofit middleware onto existing routes. Register each protected handler through the protected group. - Put path rewrites and slash normalization in
e.Prebefore routing; usee.Useor route middleware for checks requiring matchedc.Path()or parameters. Finish route and Echo configuration before serving requests. - Register only required HTTP methods instead of broad
Anyhandlers. Treat every middlewareSkipperas an explicit security exception; test method variants, encoded paths, trailing slashes, and 404/405 handling through the real middleware chain. - Keep
KeyAuthConfig.KeyLookupon a reviewed header transport and makeValidatorestablish a verified principal. KeepContinueOnIgnoredErrorfalse for protected routes; an error handler that returns nil must not enable anonymous execution. - Authorize the final object, action, and tenant using the verified principal after binding;
KeyAuthand group membership do not provide object authorization. Protect operator endpoints and wrappedhttp.Handlerroutes with the same checks. - Keep pooled
echo.Context, its response writer, andParamValues()slices within the request goroutine and