856 Commits

Author SHA1 Message Date
Juan Calderon-Perez
3e0632de0d
Update proxy.go 2025-07-28 23:27:09 -04:00
Juan Calderon-Perez
914f3c77d8
Merge branch 'main' into 2025-07-25-04-55-34 2025-07-28 23:19:42 -04:00
Jason McNeil
979e7cd6b1
feat(middleware/session): Introduce Extractor pattern for session ID retrieval (#3625)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-07-28 16:48:22 +02:00
Copilot
8444880dd1
🐛 Fix limiter middleware not counting fiber.NewErrorf responses as failed requests (#3623)
Co-authored-by: ReneWerner87 <7063188+ReneWerner87@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-07-28 09:21:37 +02:00
Juan Calderon-Perez
85e91e6f21
Merge branch 'main' into 2025-07-25-04-55-34 2025-07-27 22:55:55 -04:00
Juan Calderon-Perez
fc07c795b2
Remove some of the new options 2025-07-27 22:53:21 -04:00
Copilot
c0b2617e07
Fix Cookie SameSite constants to Pascal case per RFC specification (#3608)
Co-authored-by: sixcolors <6501251+sixcolors@users.noreply.github.com>
Co-authored-by: gaby <835733+gaby@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Jason McNeil <sixcolors@mac.com>
2025-07-27 17:12:57 +02:00
Juan Calderon-Perez
b839032cf2
🔥 feat: Add HeaderLimit option to BasicAuth middleware (#3620)
Co-authored-by: RW <rene@gofiber.io>
2025-07-27 16:56:15 +02:00
Juan Calderon-Perez
96674dc591
🔥 feat: Add Fiber Context to BasicAuth Authorizer (#3621) 2025-07-27 16:25:31 +02:00
Juan Calderon-Perez
5566b59ed7
Update middleware/proxy/proxy.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-25 10:35:40 -04:00
Juan Calderon-Perez
a809afb542 Run betteralign on proxy config 2025-07-25 10:12:30 -04:00
RW
856fdf2e66
Enable govet shadow (#3617) 2025-07-25 14:43:02 +02:00
Juan Calderon-Perez
56b5e6bb76
🔥 feat: Support for disabling response headers in Limiter Middleware (#3618) 2025-07-25 14:38:41 +02:00
Juan Calderon-Perez
b533ac7792 docs: note proxy KeepConnectionHeader 2025-07-25 00:55:40 -04:00
RW
05f8ac0255
🔥 feat: Add config for Timeout middleware (#3604)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-20 15:22:08 +02:00
RW
5dffcb6d84
[Static]: Improve sanitizePath performance (#3601) 2025-07-20 13:50:44 +02:00
Juan Calderon-Perez
93be63c229
🧹 chore: Improve static middleware security (#3595) 2025-07-20 10:35:53 +02:00
Jason McNeil
e17bab7946
Refactor CSRF middleware and enhance documentation (#3598)
Co-authored-by: RW <rene@gofiber.io>
2025-07-19 20:11:33 +02:00
René
d5842860eb fix Benchmark_MemoryLock
panic: runtime error: index out of range [1] with length 1

goroutine 67 [running]:
github.com/gofiber/fiber/v3/middleware/idempotency_test.Benchmark_MemoryLock(0xc00012c2c8)
	/home/runner/work/fiber/fiber/middleware/idempotency/locker_test.go:74 +0x23d
testing.(*B).runN(0xc00012c2c8, 0x1)
	/opt/hostedtoolcache/go/1.24.4/x64/src/testing/benchmark.go:219 +0x190
testing.(*B).run1.func1()
	/opt/hostedtoolcache/go/1.24.4/x64/src/testing/benchmark.go:245 +0x48
created by testing.(*B).run1 in goroutine 1
	/opt/hostedtoolcache/go/1.24.4/x64/src/testing/benchmark.go:238 +0x90
exit status 2
2025-07-18 08:55:06 +02:00
René
16fd8edbf1 fix Benchmark_MemoryLock
panic: runtime error: index out of range [1] with length 1

goroutine 67 [running]:
github.com/gofiber/fiber/v3/middleware/idempotency_test.Benchmark_MemoryLock(0xc00012c2c8)
	/home/runner/work/fiber/fiber/middleware/idempotency/locker_test.go:74 +0x23d
testing.(*B).runN(0xc00012c2c8, 0x1)
	/opt/hostedtoolcache/go/1.24.4/x64/src/testing/benchmark.go:219 +0x190
testing.(*B).run1.func1()
	/opt/hostedtoolcache/go/1.24.4/x64/src/testing/benchmark.go:245 +0x48
created by testing.(*B).run1 in goroutine 1
	/opt/hostedtoolcache/go/1.24.4/x64/src/testing/benchmark.go:238 +0x90
exit status 2
2025-07-18 08:53:53 +02:00
M. Efe Çetin
192d1dff0d
feat: add context methods to fiber.Storage interface (#3566)
* feat: add context methods to fiber.Storage interface

* fix linter

* create new file for storage interface (storage_interface.go)

* add simple context check to internal storage

* update docs

* add fallback context for session

---------

Co-authored-by: René <rene@gofiber.io>
2025-07-18 03:19:50 +02:00
RW
2f8fdc454b
Add modernize lint (#3590) 2025-07-17 14:48:43 +02:00
Juan Calderon-Perez
c1e9ae3ff9
🐛 bug: Fix static/favicon middlewares file descriptor leaks (#3579) 2025-07-14 15:16:57 +02:00
Juan Calderon-Perez
8ef317cbae
🐛 bug: Fix missing Allow header in EnvVar middleware per RFC 9110 (#3570) 2025-07-11 08:42:57 +02:00
RW
dd739687d3
Refactor fasthttp iter calls to range loops (#3559)
refactor: replace fastHTTP iter calls with for loops
2025-07-01 14:14:56 +02:00
dependabot[bot]
eddecf22e4
build(deps): bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0 (#3557)
* build(deps): bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0

Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.62.0 to 1.63.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.62.0...v1.63.0)

---
updated-dependencies:
- dependency-name: github.com/valyala/fasthttp
  dependency-version: 1.63.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2025-07-01 11:06:50 +02:00
Juan Calderon-Perez
d79fa01f0f
🐛 bug: Fix Content-Disposition header per RFC 6266 (#3551)
* Use raw UTF-8 filenames in Content-Disposition

* Fix lint issues

* Fix issue with new funct

* Improve and fix quoteRawString

* fix issues

* Fix lint issues

* fix golangci-lint

* Update static_test.go

* Update static_test.go
2025-06-30 09:06:11 +02:00
Juan Calderon-Perez
bdd9e22bd7
🐛 bug: Fix Cache middleware handling of Age (#3547)
* Revert benchmark loop changes

* test: cover Age header parsing

* generate msgp files

* Update cache.go

* Cast result

* Update cache.go
2025-06-30 09:04:35 +02:00
Juan Calderon-Perez
b08d0bfd2f
🐛 bug: Fix Cache-Control header parsing (#3534)
* refactor: use utils.ToLower

* Improve Cache-Control directive matching

* Update middleware/cache/cache.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix lint issue

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-23 07:42:12 +02:00
Juan Calderon-Perez
e1a7c114b2
🧹 chore: Improve CSRF tests coverage (#3531)
test(csrf): cover cookie config warnings
2025-06-20 08:47:57 +02:00
Juan Calderon-Perez
6d16bf5605
🧹chore: Improve BasicAuth middleware default security (#3522)
* Refine BasicAuth middleware

* Fix lint issues

* Update basicauth.md
2025-06-20 08:47:35 +02:00
Juan Calderon-Perez
aea0fd230f
🧹 chore: Improve CORS tests coverage (#3530)
* test(cors): warn when all origins and func

* Fix linter issue
2025-06-20 08:47:05 +02:00
Juan Calderon-Perez
528462d2bd
🧹 chore: Add missing CSRF token extractor tests (#3527)
test: cover missing form error
2025-06-18 08:25:05 +02:00
Juan Calderon-Perez
a35c5d2e15
🧹 chore: Improve Helmet middleware tests coverage (#3523)
* test: add HSTS coverage

* Update middleware/helmet/helmet_test.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update helmet_test.go

* Update helmet_test.go

* Revert test changes

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-17 23:24:49 +02:00
Juan Calderon-Perez
0590709556
🧹 chore: Improve Idempotency middleware tests coverage (#3521)
* Consolidate idempotency tests

* Fix lint issues

* Fix more lint issues

* Fix lint issue
2025-06-16 17:45:40 +02:00
Juan Calderon-Perez
1ce3182951
🧹 chore: Improve EarlyData middleware tests coverage (#3520)
* test: move config tests into earlydata_test

* Fix lint issue
2025-06-16 17:44:32 +02:00
Jason McNeil
670fbd5e45
feat: Add support for Keys() in session middleware (#3517)
*  feat: Update session middleware add Keys method and update docs to match key type any

*  test: Add /keys endpoint to set and retrieve multiple session keys

*  test: Refactor /keys endpoint to trim whitespace and improve key handling in session tests
2025-06-13 11:40:17 +02:00
Juan Calderon-Perez
b29171ce40
🧹 chore: Improve CORS middleware response headers (#3505)
* Improve CORS middleware

* 🐛 fix: Remove unused 'slices' import from CORS middleware

---------

Co-authored-by: Jason McNeil <sixcolors@mac.com>
2025-06-10 08:47:34 +02:00
Juan Calderon-Perez
3a60cf7a4e
🧹 chore: Refactor EnvVar middleware (#3513)
* remove ExcludeVars option

* Simplify envvar export logic
2025-06-10 08:40:58 +02:00
Juan Calderon-Perez
80f4f99c01
🧹 chore: Fix typos in code and docs (#3507)
chore: fix spelling mistakes across codebase
2025-06-07 22:34:44 +02:00
Juan Calderon-Perez
5eb1432c81
🐛 fix: Middlewares immutable config handling (#3494)
* Respect immutable flag in middlewares

* Add unit-tests for Immutable
2025-06-01 13:53:18 +02:00
Juan Calderon-Perez
09d9e169b2
🧹 chore: Enhance config validation in EncryptCookie middleware (#3491)
* test: validate encryptcookie config key

* simplified logic and remove duplicated code

* remove extra spaces
2025-05-28 15:12:57 +02:00
Juan Calderon-Perez
a779888d44
🧹 chore: Improve cache middleware RFC compliance (#3488)
* test: cover cache enhancements

* Fix lint issues and tests names

* Fix test

* Use utils.ToLower()

* Use utils.Trim

* Add missing param
2025-05-28 13:59:06 +02:00
Oleksandr Redko
956205311b
♻️ refactor: use maps.Copy to simplify code (#3490) 2025-05-28 12:49:33 +02:00
tongjicoder
557095b094
♻️ refactor: use slices.Contains to simplify code (#3486)
refactor: use slices.Contains to simplify code

Signed-off-by: tongjicoder <tongjicoder@icloud.com>
2025-05-27 20:03:22 +02:00
Jason McNeil
7559758b02
🧪 test: Enhance CSRF tests to address unsafe header value issue (#2045) (#3485)
* 🧪 test: Enhance CSRF tests to address unsafe header value issue (#2045)

* Update middleware/csrf/csrf_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-27 19:18:25 +02:00
Juan Calderon-Perez
47f47ae2d8
🧹 chore: Enhance BasicAuth middleware to better comply with RFC 6750 (#3484)
* test(basicauth): ensure whitespace tolerant

* use utils.TrimSpace

* Update docs
2025-05-27 14:27:45 +02:00
Juan Calderon-Perez
804a2b923e
🧹 chore: Enhance KeyAuth middleware to better comply with RFC 6750 (#3482)
* docs(keyauth): add Realm option

* Add unit-test for GenericError case

* Update keyauth_test.go

* Backport fixes

* Update keyauth_test.go

* Fix spacing

* Add test for empty value

* Remove extra comma

* Add missing closing brace

* Review comments

* add missing import

* Add more unit-tests

* remove inconclusive test
2025-05-27 14:07:42 +02:00
RW
c2eee63183
🧹 chore: Update minimum go version to 1.24 (#3481)
* chore: update docs and workflows for go1.24

* Fix listen bug

* Use b.Loop() for benchmarks https://go.dev/blog/testing-b-loop

* Use b.Loop() for benchmarks https://go.dev/blog/testing-b-loop

* Revert b.Loop() for some benchmarks

* Change genericParser benchmarks (runParallel)

* Change Benchmark_Router_Github_API benchmarks (runParallel)
2025-05-27 13:23:02 +02:00
pj
9bd7a1c50d
feat: fiber.Context implement context.Context (#3382)
* Ctx implements context.Context

* fix up some linting issues

* added some tests

* no message

* fiber.Ctx implements context.Context

* no message

* implement compile-time check

* update formatting

* update compile-time checks

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-05-26 08:53:18 +02:00