fiber/middleware
Jason McNeil 4ab8629706 fix(middleware/cors): Validation of multiple Origins (#2883)
* fix: allow origins check

Refactor CORS origin validation and normalization to trim leading or trailing whitespace in the cfg.AllowOrigins string [list]. URLs with whitespace inside the URL are invalid, so the normalizeOrigin will return false because url.Parse will fail, and the middleware will panic.

fixes #2882

* test: AllowOrigins with whitespace

* test(middleware/cors): add benchmarks

* chore: fix linter errors

* test(middleware/cors): use h() instead of app.Test()

* test(middleware/cors): add miltiple origins in Test_CORS_AllowOriginScheme

* chore: refactor validate and normalize

* test(cors/middleware): add more benchmarks

(cherry picked from commit d456e7d82e)
2024-03-01 13:30:40 +01:00
..
adaptor V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
basicauth ♻️ v3: fix!: ContextKey collisions (#2781) 2024-01-04 09:44:45 +01:00
cache ci: address multiple lint rules (#2869) 2024-02-19 14:33:10 +01:00
compress Bump golangci-lint to v1.56.1 (#2842) 2024-02-13 08:23:15 +01:00
cors fix(middleware/cors): Validation of multiple Origins (#2883) 2024-03-01 13:30:40 +01:00
csrf V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
earlydata V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
encryptcookie V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
envvar V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
etag Bump golangci-lint to v1.56.1 (#2842) 2024-02-13 08:23:15 +01:00
expvar Merge remote-tracking branch 'origin/master' into v3-beta 2023-08-05 22:02:01 +03:00
favicon V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
filesystem V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
healthcheck ♻️ refactor: Migrate HealthChecker to v3 (#2884) 2024-02-29 08:50:13 +01:00
helmet ci: address multiple lint rules (#2869) 2024-02-19 14:33:10 +01:00
idempotency V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
keyauth V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
limiter 🎨 Style!: Update CSRF and Limiter to remove repetitive names (#2846) 2024-02-10 19:50:29 +01:00
logger V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
pprof chore: Fix testifylint errors in middleware (#2805) 2024-01-21 08:32:23 +01:00
proxy V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
recover Bump golangci-lint to v1.56.1 (#2842) 2024-02-13 08:23:15 +01:00
redirect V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
requestid chore: Fix testifylint errors in middleware (#2805) 2024-01-21 08:32:23 +01:00
rewrite V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
session V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00
skip Merge remote-tracking branch 'origin/master' into v3-beta 2023-08-05 22:02:01 +03:00
timeout V2 to v3 merge (#2864) 2024-02-29 08:29:59 +01:00