Skip to content

Commit 1b2b81b

Browse files
committed
test new migrations
1 parent cf9d39a commit 1b2b81b

File tree

12 files changed

+58
-13
lines changed

12 files changed

+58
-13
lines changed

csrf-with-session/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func main() {
129129
CookieName: "__Host-csrf", // Recommended to use the __Host- prefix when serving the app over TLS
130130
CookieSameSite: "Lax", // Recommended to set this to Lax or Strict
131131
CookieSecure: true, // Recommended to set to true when serving the app over TLS
132-
CookieHTTPOnly: true, // Recommended, otherwise if using JS framework recomend: false and KeyLookup: "header:X-CSRF-Token"
132+
CookieHTTPOnly: true, // Recommended, otherwise if using JS framework recomend: false and Extractor: extractors.FromHeader("X-CSRF-Token")
133133
ErrorHandler: csrfErrorHandler,
134134
IdleTimeout: 30 * time.Minute,
135135
}
@@ -190,6 +190,7 @@ func main() {
190190
if err != nil {
191191
return c.SendStatus(fiber.StatusInternalServerError)
192192
}
193+
defer session.Release() // Important: Manual cleanup required
193194
if err := session.Reset(); err != nil {
194195
return c.SendStatus(fiber.StatusInternalServerError)
195196
}
@@ -209,6 +210,7 @@ func main() {
209210
if err != nil {
210211
return c.SendStatus(fiber.StatusInternalServerError)
211212
}
213+
defer session.Release() // Important: Manual cleanup required
212214

213215
// Revoke users authentication
214216
if err := session.Destroy(); err != nil {
@@ -226,6 +228,7 @@ func main() {
226228
if err != nil {
227229
return c.SendStatus(fiber.StatusInternalServerError)
228230
}
231+
defer session.Release() // Important: Manual cleanup required
229232
loggedIn, _ := session.Get("loggedIn").(bool)
230233

231234
if !loggedIn {
@@ -251,6 +254,7 @@ func main() {
251254
if err != nil {
252255
return c.SendStatus(fiber.StatusInternalServerError)
253256
}
257+
defer session.Release() // Important: Manual cleanup required
254258
loggedIn, _ := session.Get("loggedIn").(bool)
255259

256260
if !loggedIn {

csrf/routes/mainServer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func RegisterRoutes(app *fiber.App) {
7676
if err != nil {
7777
return err
7878
}
79+
defer currSession.Release() // Important: Manual cleanup required
7980
sessionUser := currSession.Get("User").(fiber.Map)
8081
// release the currSession
8182
err = currSession.Save()
@@ -150,6 +151,7 @@ func RegisterRoutes(app *fiber.App) {
150151
if err != nil {
151152
return err
152153
}
154+
defer currSession.Release() // Important: Manual cleanup required
153155
sessionUser := currSession.Get("User").(fiber.Map)
154156
// release the currSession
155157
err = currSession.Save()
@@ -192,6 +194,7 @@ func requireLogin(c fiber.Ctx) error {
192194
if err != nil {
193195
return err
194196
}
197+
defer currSession.Release() // Important: Manual cleanup required
195198
user := currSession.Get("User")
196199
defer currSession.Save()
197200

docker-mariadb-clean-arch/internal/auth/middleware.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"os"
55
"strconv"
66

7+
"github.com/gofiber/fiber/v3/extractors"
8+
79
jwtware "github.com/gofiber/contrib/v3/jwt"
810
"github.com/gofiber/fiber/v3"
911
"github.com/golang-jwt/jwt/v5"
@@ -29,7 +31,7 @@ func JWTMiddleware() fiber.Handler {
2931
return jwtware.New(jwtware.Config{
3032
ErrorHandler: jwtError,
3133
SigningKey: jwtware.SigningKey{Key: []byte(os.Getenv("JWT_SECRET"))},
32-
TokenLookup: "cookie:jwt",
34+
Extractor: extractors.FromCookie("jwt"),
3335
})
3436
}
3537

dummyjson/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func main() {
2424
"error": err.Error(),
2525
})
2626
}
27+
defer resp.Release() // Important: Manual cleanup required
2728

2829
defer resp.Body.Close()
2930
if resp.StatusCode != http.StatusOK {

ent-mysql/ent/client.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

entgo-sveltekit/entity/client.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sessions-sqlite3/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.25.0
44

55
require (
66
github.com/gofiber/fiber/v3 v3.0.0-rc.3
7-
github.com/gofiber/storage/sqlite3 v1.3.8
7+
github.com/gofiber/storage/sqlite3/v2 v2.2.2
88
github.com/gofiber/template/html/v2 v2.1.3
99
github.com/mattn/go-sqlite3 v1.14.32
1010
)

sessions-sqlite3/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ github.com/gofiber/fiber/v3 v3.0.0-rc.3 h1:h0KXuRHbivSslIpoHD1R/XjUsjcGwt+2vK0av
88
github.com/gofiber/fiber/v3 v3.0.0-rc.3/go.mod h1:LNBPuS/rGoUFlOyy03fXsWAeWfdGoT1QytwjRVNSVWo=
99
github.com/gofiber/schema v1.6.0 h1:rAgVDFwhndtC+hgV7Vu5ItQCn7eC2mBA4Eu1/ZTiEYY=
1010
github.com/gofiber/schema v1.6.0/go.mod h1:WNZWpQx8LlPSK7ZaX0OqOh+nQo/eW2OevsXs1VZfs/s=
11-
github.com/gofiber/storage/sqlite3 v1.3.8 h1:ywicq0MvlO4H+IbxwvSq3GvTv25fmhEZ1LpEkd8b078=
12-
github.com/gofiber/storage/sqlite3 v1.3.8/go.mod h1:G4A9R3Ac2G9Wpb76F62oEqXUTb0ywjTIr5P7obiZmYc=
11+
github.com/gofiber/storage/sqlite3/v2 v2.2.2 h1:NYSu41xXQ4Pje4DFebVd5uBMAoqGYTOURXxA39aRMtU=
12+
github.com/gofiber/storage/sqlite3/v2 v2.2.2/go.mod h1:8bR15LT1pGBb/DQL/vq9yUFNb0CEIl37aNw/cBwrH/8=
1313
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
1414
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
1515
github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o=

sessions-sqlite3/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/gofiber/fiber/v3"
1313
"github.com/gofiber/fiber/v3/middleware/session"
14-
"github.com/gofiber/storage/sqlite3"
14+
"github.com/gofiber/storage/sqlite3/v2"
1515
"github.com/gofiber/template/html/v2"
1616

1717
_ "github.com/mattn/go-sqlite3"

swagger/go.mod

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.25.0
44

55
require (
66
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
7-
github.com/gofiber/contrib/v3/swaggo v1.0.0-rc.1
7+
github.com/gofiber/contrib/v3/swaggerui v1.0.0-rc.1
88
github.com/gofiber/fiber/v3 v3.0.0-rc.3
99
github.com/swaggo/swag v1.16.6
1010
gorm.io/driver/postgres v1.6.0
@@ -14,16 +14,25 @@ require (
1414
require (
1515
github.com/KyleBanks/depth v1.2.1 // indirect
1616
github.com/andybalholm/brotli v1.2.0 // indirect
17+
github.com/go-openapi/analysis v0.24.1 // indirect
18+
github.com/go-openapi/errors v0.22.4 // indirect
1719
github.com/go-openapi/jsonpointer v0.22.3 // indirect
1820
github.com/go-openapi/jsonreference v0.21.3 // indirect
21+
github.com/go-openapi/loads v0.23.2 // indirect
22+
github.com/go-openapi/runtime v0.29.2 // indirect
1923
github.com/go-openapi/spec v0.22.1 // indirect
24+
github.com/go-openapi/strfmt v0.25.0 // indirect
2025
github.com/go-openapi/swag/conv v0.25.4 // indirect
26+
github.com/go-openapi/swag/fileutils v0.25.4 // indirect
2127
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
2228
github.com/go-openapi/swag/jsonutils v0.25.4 // indirect
2329
github.com/go-openapi/swag/loading v0.25.4 // indirect
30+
github.com/go-openapi/swag/mangling v0.25.4 // indirect
2431
github.com/go-openapi/swag/stringutils v0.25.4 // indirect
2532
github.com/go-openapi/swag/typeutils v0.25.4 // indirect
2633
github.com/go-openapi/swag/yamlutils v0.25.4 // indirect
34+
github.com/go-openapi/validate v0.25.1 // indirect
35+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
2736
github.com/gofiber/schema v1.6.0 // indirect
2837
github.com/gofiber/utils/v2 v2.0.0-rc.2 // indirect
2938
github.com/google/uuid v1.6.0 // indirect
@@ -37,11 +46,12 @@ require (
3746
github.com/kr/text v0.2.0 // indirect
3847
github.com/mattn/go-colorable v0.1.14 // indirect
3948
github.com/mattn/go-isatty v0.0.20 // indirect
49+
github.com/oklog/ulid v1.3.1 // indirect
4050
github.com/philhofer/fwd v1.2.0 // indirect
41-
github.com/swaggo/files/v2 v2.0.2 // indirect
4251
github.com/tinylib/msgp v1.5.0 // indirect
4352
github.com/valyala/bytebufferpool v1.0.0 // indirect
4453
github.com/valyala/fasthttp v1.68.0 // indirect
54+
go.mongodb.org/mongo-driver v1.17.6 // indirect
4555
go.yaml.in/yaml/v3 v3.0.4 // indirect
4656
golang.org/x/crypto v0.45.0 // indirect
4757
golang.org/x/mod v0.30.0 // indirect
@@ -50,4 +60,5 @@ require (
5060
golang.org/x/sys v0.38.0 // indirect
5161
golang.org/x/text v0.31.0 // indirect
5262
golang.org/x/tools v0.39.0 // indirect
63+
gopkg.in/yaml.v2 v2.4.0 // indirect
5364
)

0 commit comments

Comments
 (0)