Commit Graph

3749 Commits (v2)

Author SHA1 Message Date
Juan Calderon-Perez 42d921d353
🧹 chore: Backport ctx.String() from v3 (#3294)
* Backport ctx.String() to v2

* Fix lint issues
2025-01-27 15:00:51 +01:00
René 8b9db059d7 Doc BodyParser: Add multipart form info about the file data 2025-01-23 08:32:43 +01:00
René 3729281a1e Doc BodyParser: Add multipart form info about the file data 2025-01-22 08:35:17 +01:00
RW e04f815c43
prepare release v2.52.6 2024-12-31 18:04:19 +01:00
RW 7eb9d25548
Support Square Bracket Notation in Multipart Form data (#3268)
* Feature Request: Support Square Bracket Notation in Multipart Form Data #3224

* Feature Request: Support Square Bracket Notation in Multipart Form Data #3224
2024-12-31 16:56:18 +01:00
Juan Calderon-Perez 47be68142a
🧹 chore: Add parallel benchmark for Next() (#3259)
* Add parallel benchmark for Next()

* Create RequestCtx outside loop
2024-12-21 10:51:16 +01:00
Juan Calderon-Perez c9ff17d796
🧹 chore: Update dependencies (#3254)
* Update v2 dependencies

* Try fasthttp v1.55.0

* Try fasthttp v1.54.0

* Try fasthttp v1.53.0

* Try fasthttp v1.52.0

* Try fasthttp v1.51.0

* Add Makefile

* Bump msgp to v1.2.5
2024-12-18 15:40:07 +01:00
nickajacks1 56ff2de858
🐛 fix: Respect Immutable config for Body() (#3246)
* 🐛 fix: respect Immutable config for Body()

* ci: add go 1.22 and 1.23 to test matrix
2024-12-13 08:28:36 +01:00
Aaron Zingerle 8c84b0fd8a
🩹 fix: Middleware/CORS Remove Scheme Restriction (#3168)
🩹 Fix: Middleware/CORS Remove Scheme Restriction (gofiber#3160)

Co-authored-by: Aaron Zingerle <aaron.zingerle@vipaso.io>
2024-10-14 15:04:25 +02:00
Juan Calderon-Perez 6e7411403a
v2: Add CODEOWNERS file (#3124)
Add CODEOWNERS file
2024-09-06 21:18:20 +03:00
Vaibhav Gupta cb06bc5f4c
🩹 Fix: handle un-matched open brackets in the query params (#3121)
* Add logic for counting open brackets

* Add UTs

* update increment/decrement syntax with ++/--

* Update UT to remove duplicate
2024-09-06 08:02:02 +02:00
René bfcf91dab8 fix template markdown 2024-08-30 17:22:07 +02:00
Giovanni Rivera ca935c3f8f
📚 Doc: Add detailed documentation for the templates guide (#3113)
* Organize and reword templates guide

* Add full example to templates guide

* Add advanced templating section to template guide

* Add template repo link and fix typo in Templates guide

- Add link to https://github.com/gofiber/template in Templates Guide
- Fix typo: missing period in info block about ctx.Render()

* Update docs/guide/templates.md

* Update docs/guide/templates.md

---------

Co-authored-by: RW <rene@gofiber.io>
2024-08-28 09:01:02 +02:00
Juan Calderon-Perez 87bb93ecf0
v2: Update benchmark-action to v1.20.3 (#3084)
Update benchmark gh action
2024-07-23 08:25:25 +02:00
Juan Calderon-Perez 1c526892e7
🐛 bug: Use Content-Length for bytesReceived and bytesSent tags in Logger Middleware in v2 (#3067)
Use Content-Length for bytesSent and bytesReceived in Logger
2024-07-18 13:41:39 +02:00
René 6968d51d0d add release.yml config 2024-06-30 22:11:08 +02:00
Jason McNeil 66a881441b
fix(middleware/session): mutex for thread safety (#3050)
* chore: Remove extra release and acquire ctx calls in session_test.go

* feat: Remove unnecessary session mutex lock in decodeSessionData function

* chore: Refactor session benchmark tests

* fix(middleware/session): mutex for thread safety

* feat: Add session mutex lock for thread safety

* chore: Refactor releaseSession mutex
2024-06-30 21:16:23 +02:00
Paulus Titto 6fa0e7c9fc
Update README_id.md (#3045)
Update some word en to in
2024-06-27 12:19:35 +02:00
Jason McNeil c7bfb31bf9
test(middleware/session): Remove extra release and aquire ctx calls in session_test.go (#3043) 2024-06-26 15:46:28 +02:00
René abf8f324d6 prepare version v2.52.5 2024-06-26 11:05:26 +02:00
Jason McNeil 7926e5bf4d
Merge pull request from GHSA-98j2-3j3p-fw2v
* fix: token injection vulnerability GHSA-98j2-3j3p-fw2v

- Ensure session IDs are securely generated server-side.
- Add validation to prevent user-supplied session IDs.
- Update tests to verify correct session token use.

This update addresses the critical session middleware vulnerability identified in versions 2 and above of GoFiber.

* test(middleware/csrf): Save session after generating new session ID

This commit saves the session after generating a new session ID to ensure that the updated session ID is persisted. This change is necessary to address a critical session middleware vulnerability identified in versions 2 and above of GoFiber.

* chore: Save session ID in context for middleware chain

The code changes add functionality to save the newly generated session ID in the context, allowing it to be accessible to subsequent middlewares in the chain. This improvement ensures that the session ID is available for use throughout the middleware stack.

* test: Fix session freshness check in session_test

The code changes in `session_test.go` fix the session freshness check by updating the assertions for `sess.Fresh()` and `sess.ID()`. The previous assertions were incorrect and have been corrected to ensure the session ID remains the same and the session is not fresh.

* refactor(session.go): general clean-up

* chore: Revert session freshness behavior

The code changes in `session_test.go` fix the session freshness check by updating the assertions for `sess.Fresh()` and `sess.ID()`. The previous assertions were incorrect and have been corrected to ensure the session ID remains the same and the session is not fresh.
2024-06-26 09:17:41 +02:00
Feng 4262f5b591
fix: monitor middleware reporting of CPU usage (#2984)
monitPIDCPU should be transient, not persistent.

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-06-24 16:32:04 +02:00
Jason McNeil 232c0fac0d
docs: Improve ctx.Locals method documentation (#3033) 2024-06-12 16:23:15 +02:00
Jason McNeil 6c9510df5a
docs: Improve ctx.Locals method description and example (#3030) 2024-06-11 08:53:43 +02:00
RW 6c3eb80aa9
Update csrf.md
fix broken csrf link
2024-04-19 12:35:20 +02:00
René ef561694ba fix md syntax 2024-04-19 12:28:23 +02:00
RW ab382cdd4a
Update release-drafter.yml 2024-04-07 20:34:00 +02:00
René d0c8f8c82e Add a new benchmark that tests the ctx acquire and release flow
this will be used later to make differences with version 3 directly visible
2024-04-03 23:16:51 +02:00
René f098e2bd9c Add a new benchmark that tests the ctx acquire and release flow
this will be used later to make differences with version 3 directly visible
2024-04-03 22:44:56 +02:00
René 96330a6c05 Add a new benchmark that tests the simple flow
this will be used later to make differences with version 3 directly visible
2024-04-03 16:17:40 +02:00
RW fd811cf84a
prepare release v2.52.4 2024-03-26 22:40:09 +01:00
Jason McNeil a6f4c133bc
fix(middleware/cors): Vary header handling non-cors OPTIONS requests (#2939)
* fix(middleware/cors): Vary header handling non-cors OPTIONS requests

* chore(middleware/cors): Add Vary header for non-CORS OPTIONS requests comment
2024-03-26 22:22:42 +01:00
Jason McNeil e574c0db52
fix(middleware/cors): CORS handling (#2937)
* fix(middleware/cors): CORS handling

* fix(middleware/cors): Vary header handling

* test(middleware/cors): Ensure Vary Headers checked
2024-03-26 21:57:42 +01:00
RW 43d5091967
Prepare release v2.52.3 2024-03-25 20:26:29 +01:00
Jason McNeil ba10e68d01
test(middleware/csrf): Fix Benchmark Tests (#2932)
* test(middleware/csrf): fix Benchmark_Middleware_CSRF_*

* fix(middleware/csrf): update refererMatchesHost()
2024-03-25 15:30:20 +01:00
Jason McNeil 1607d872d9
fix(middleware/cors): Categorize requests correctly (#2921)
* fix(middleware/cors): categorise requests correctly

* test(middleware/cors): improve test coverage for request types

* test(middleware/cors): Add subdomain matching tests

* test(middleware/cors): parallel tests for CORS headers based on request type

* test(middleware/cors): Add benchmark for CORS subdomain matching

* test(middleware/cors): cover additiona test cases

* refactor(middleware/cors): origin validation and normalization
2024-03-20 14:57:29 +01:00
Jason McNeil 1aac6f618b
fix(middleware/cors): Handling and wildcard subdomain matching (#2915)
* 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

* fix(middleware/cors): handling and wildcard subdomain matching

docs(middleware/cors): add How it works and Security Considerations

* chore: grammar

* Apply suggestions from code review

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

* chore: fix misspelling

* test(middleware/cors): combine Invalid_Origins tests

* refactor(middleware/cors): headers handling

* docs(middleware/cors): Update AllowOrigins description

* chore: merge

* perf(middleware/cors): optimize handler

* perf(middleware/cors): optimize handler

* chore(middleware/cors): ipdate origin handling logic

* chore(middleware/cors): fix header capitalization

* docs(middleware/cors): improve sercuity notes

* docs(middleware/cors): Improve security notes

* docs(middleware/cors): improve CORS overview

* docs(middleware/cors): fix ordering of how it works

* docs(middleware/cors): add additional info to How to works

* docs(middleware/cors): rm space

* docs(middleware/cors): add validation for AllowOrigins origins to overview

* docs(middleware/cors): update ExposeHeaders and MaxAge descriptions

* docs(middleware/cors): Add dynamic origin validation example

* docs(middleware/cors): Improve security notes and fix header capitalization

* docs(middleware/cors): configuration examples

* docs(middleware/cors): `"*"`

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-03-17 13:43:16 +01:00
René d2b19e290d refactor(docs): deactivate docs sync for v2 2024-03-02 19:14:29 +01:00
René 68d90cd6b2 refactor(docs): deactivate docs sync for v2 2024-03-02 19:13:07 +01:00
RW 109e91a630
prepare release v2.52.2 2024-03-02 18:56:50 +01:00
Jason McNeil d456e7d82e
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
2024-03-01 10:31:11 +01:00
René Werner ddc6b231f8 fix sync-docs workflow 2024-02-21 21:54:55 +01:00
René Werner 0df0e0855d fix sync-docs workflow 2024-02-21 21:43:28 +01:00
René Werner 70f21d5f7e fix cors domain normalize 2024-02-21 21:18:56 +01:00
RW f9fcb0297c
Update app.go
prepare release v2.52.1
2024-02-21 17:03:00 +01:00
Juan Calderon-Perez f0cd3b44b0
Merge pull request from GHSA-fmg4-x8pw-hjhg
* Enforce Wildcard Origins with AllowCredentials check

* Expand unit-tests, fix issues with subdomains logic, update docs

* Update cors.md

* Added test using localhost, ipv4, and ipv6 address

* improve documentation markdown

---------

Co-authored-by: René Werner <rene@gofiber.io>
2024-02-21 14:47:33 +01:00
Lucas Lemos 5e30112d08
fix: healthcheck middleware not working with route group (#2863)
* fix: healthcheck middleware not working with route group

* perf: change verification method to improve perf

* Update healthcheck_test.go

* test: add not matching route test for strict routing

* add more test cases

* correct tests

* correct test helpers

* correct tests

* correct tests

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René Werner <rene@gofiber.io>
2024-02-19 14:28:58 +01:00
Juan Calderon-Perez cf54c257e9
Merge pull request #2867 from grivera64/v2
📚 Doc: Fix code snippet indentation in /docs/api/middleware/keyauth.md
2024-02-18 21:40:18 -05:00
Giovanni Rivera a84a7cee7e
📚 Doc: Fix code snippet indentation in /docs/api/middleware/keyauth.md
Removes an an extra level of indentation in line 51 of
`keyauth.md` [here](https://github.com/gofiber/fiber/blob/v2/docs/api/middleware/keyauth.md?plain=1#L51)
2024-02-18 18:21:23 -08:00
RW 4e0f180fe3
Update routing.md 2024-02-08 08:18:26 +01:00