Skip to content

Releases

GoLaravel v1.17.2 - TOTP clock-drift tolerance default

Choose a tag to compare

@hmmdlthf hmmdlthf released this 17 Nov 20:37
aead684

Fixed

  • TOTP clock-drift tolerance was off by default: NewTOTPManager(TOTPOptions{...}) with SkewWindow left out (as WorkflowController and gofilament do) accepted only the current 30-second code. SkewWindow: 0 now keeps the default of one step either side; use the new auth.NoSkew to accept only the current step.

GoLaravel v1.17.1 - StartSession default manager, constant-time session CSRF

Choose a tag to compare

@hmmdlthf hmmdlthf released this 17 Nov 20:19
0fd5b60

Fixed

  • session.StartSession(mgr) built the default manager: apps passing their own manager still built the unused default and logged its "no SecretKey" warning. The default is now resolved on the first request, only when no manager is given.
  • Session CSRF check timing (session.VerifyCSRFToken): tokens are compared in constant time, and an empty session token is refused.

GoLaravel v1.17.0 - session login, user-linked sessions, SQL reset tokens

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 21:42
d7b001f

Added

  • Session login (pkg/auth): auth.Login, auth.Logout, auth.LogoutOtherDevices, auth.SessionGuard / SessionGuardFunc and auth.UserProviderFunc, so server-rendered sites can log in with the session cookie instead of a JWT. Login regenerates the session id and deletes the old one, and renews the CSRF token. Logout destroys the session and issues a new CSRF token.
  • Sessions linked to users (pkg/session): the SQL driver has a nullable, indexed user_id column (Migrate adds it to existing tables). Manager.DestroyUserSessions(userID, except...) ends a user's sessions on the memory, file, SQL and Redis drivers. The cookie driver returns ErrUserSessionsUnsupported. New Manager.Regenerate, Manager.Invalidate, session.ManagerFrom(c) and the UserSessionDriver interface.
  • auth.SQLResetTokenStore: password reset tokens in a password_reset_tokens table (SQLite, including modernc.org/sqlite, MySQL and Postgres), with Migrate and PruneExpired.

Changed

  • No warnings at import: the default session manager and disk manager are built on first use instead of at package load. The default session manager takes its key from APP_KEY. The "no SecretKey" warning is logged only when a manager is built without a key, and the storage "no signing secret" warning only when a URL is first signed with the random key.

GoLaravel v1.16.0 - 128-bit support ticket IDs

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 13:29
4182d14

Security

  • Support ticket IDs (pkg/support): GenerateTicketID produced only 32 bits of randomness (TKT- plus 8 hex characters), which can be brute-forced. For visitors who aren't signed in, the ticket ID is their only access to the ticket, so IDs now carry 128 bits (TKT- plus 32 hex characters).

Full changelog: v1.15.0...v1.16.0

GoLaravel v1.15.0 - 2FA bypass fix and auth hardening

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 12:49

Security

  • 2FA bypass (pkg/auth): the two_factor_token returned after a correct password (before the second factor) was signed with the same secret as access tokens, so BearerGuard / CookieGuard accepted it as a full login. Two-factor authentication could be skipped entirely. Challenge tokens now use a derived key and their own audience, and the guards refuse them.
  • Auth workflows (WorkflowController):
    • Throttling: logins and 2FA codes are throttled through the ratelimit store (LoginAttempts / LoginWindow, TwoFactorAttempts / TwoFactorWindow). A 6-digit code can no longer be brute-forced.
    • Account enumeration: unknown emails take as long to reject as wrong passwords.
    • Codes: TOTP codes are single-use (TOTPManager.VerifyCodeStep). Recovery codes are refused when UpdateRecoveryCodes is not configured (they would never be used up), and no token is issued without a verified factor.
    • Password resets: only existing accounts get reset mail, the reply is the same either way, mails are throttled per address, and the reset link is URL-encoded.
    • Disabling 2FA requires the current password or a 2FA code.
    • Errors: callback errors are no longer sent to the client. Passwords over 72 bytes (the bcrypt limit) get a validation error instead of a 500.
  • OAuth: the state and PKCE cookies are Secure on HTTPS.

Fixed

  • Panics in scheduled tasks (including RunInBackground), async event listeners and queue jobs crashed the process. They are now recovered: tasks report an error, and jobs are retried or sent to the dead-letter queue.
  • schedule: Exec keeps only the last 64 KiB of command output. OnOneServer logs a warning when the default cache is the in-memory store, since it then only prevents duplicates within one process.

Breaking

  • POST /auth/two-factor/disable needs password or code in the body.
  • Recovery codes are refused unless WorkflowCallbacks.UpdateRecoveryCodes is set.
  • Forgot-password sends no mail when FindByEmail finds no user (the response is unchanged).
  • Existing 2FA challenge tokens stop working (they expire within 5 minutes anyway).

Full changelog: v1.14.0...v1.15.0

GoLaravel v1.14.0 - Security pass

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 11:51

Security

  • Broadcast channels (pkg/broadcast):
    • Anyone could listen on any channel. The SSE handler took ?channel=, and the WebSocket handler subscribed to whatever channel the client named. broadcast.Channel("orders.{id}", fn) now registers authorization callbacks, like Laravel's channel routes. private- and presence- channels without a rule are refused, and other channels stay public. Options.Authorize can decide every subscription instead.
    • Cross-site WebSocket hijacking. WebSockets accepted every Origin, so any site could open one with the user's cookies. Now only the same origin, clients that send no Origin, and Options.AllowedOrigins are accepted.
    • Smaller fixes: the SSE connected event escapes the channel name (it was written raw, allowing JSON and SSE frame injection), event names are stripped of newlines, channel names with control characters are refused, and a WebSocket may hold at most MaxSubscriptions (100) channels.
    • New: SSEHandlerWith / WebSocketHandlerWith(Options).
  • Signed storage URLs (pkg/storage): NewLocalDriver signed temporary download and upload URLs with a hard-coded fallback key when APP_KEY / STORAGE_SECRET was unset, so anyone could forge them. It now uses a random per-process key (with a warning), and refuses the old public key.
  • Tenancy (pkg/privacy): TenantMiddleware trusted whatever tenant the client named (X-Tenant-ID, query, route parameter or subdomain). New TenantMiddlewareOptions.Authorize checks membership and answers 403 when it fails. Without it, a one-time warning is logged.
  • SMTP (pkg/mail): Encryption: "starttls" silently fell back to plain text when the server didn't offer STARTTLS (an attacker can strip the offer); it is now required. Connections and the SMTP conversation have timeouts (SMTPConfig.Timeout, default 30s).
  • HTTP client (pkg/http): response bodies are capped at 64 MiB (MaxResponseSize, ErrResponseTooLarge) instead of being read fully into memory.
  • Metrics (pkg/telemetry):
    • Path labels are capped (MaxPaths, default 500; the rest count as other), so random URLs can't grow the metrics without bound.
    • NormalizePaths now works: ID-like segments become :id.
    • traceparent IDs must be lowercase hex and non-zero.
  • Flutter (pkg/flutter): Version and BuildID are escaped in the injected HTML.

Breaking

  • Cross-origin WebSockets: browser WebSockets from another origin, such as a Flutter web build on a different host, need broadcast.WebSocketHandlerWith(broadcast.Options{AllowedOrigins: [...]}).
  • Private channels: subscriptions to private- / presence- channels need a matching broadcast.Channel rule.
  • Signed storage URLs: they stop working across restarts until APP_KEY or STORAGE_SECRET is set.
  • SMTP: Encryption: "starttls" fails against servers that don't offer STARTTLS.

Full changelog: v1.13.0...v1.14.0

GoLaravel v1.13.0 - Method spoofing and .env fixes

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 11:37

Fixed

  • Form method spoofing didn't work. view.Method("PUT") emitted a _method field, but nothing read it, so HTML forms could never reach PUT, PATCH or DELETE routes. The engine now routes a POST with _method (or an X-HTTP-Method-Override header) of PUT, PATCH or DELETE as that method, before routing. GET is never overridden. Turn it off with Engine.MethodOverride(false).
  • .env parsing (pkg/config):
    • export KEY=value lines are read.
    • Unquoted values drop a trailing # comment.
    • Double-quoted values support \n, \" and \\, and their closing quote skips escaped quotes. Single-quoted values are taken literally.
    • Read errors are reported instead of being ignored.

Added

  • Tests for pkg/config and pkg/view, which had none.

Full changelog: v1.12.0...v1.13.0

GoLaravel v1.12.0 - Timeouts, cache stampede protection, validation rules

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 10:59

Added

  • Request body read timeout: Engine.BodyReadTimeout (default 2 minutes) and middleware.BodyReadTimeout(d) per route. Upgrade requests and requests without a body are not affected, and the deadline is cleared once the body has been read, so slow handlers and SSE streams keep working.
  • Cache stampede protection: Remember runs the function once for concurrent misses (per process, and across instances on the SQL / Redis stores through a backend lock; RememberLockTimeout).
  • Atomic Pull on the SQL and Redis stores (Puller; Redis GETDEL).
  • Validation: validation.Password() (min / max / letters / mixed case / numbers / symbols / not-in list, one message per unmet requirement; MultiRule), exclude, exclude_if, exclude_unless, exclude_with, exclude_without, required_array_keys, and dimensions (PNG, JPEG, GIF).

Changed

  • artisan make:oauth now generates a working controller: a FindOrCreate hook, with a warning against linking accounts by email alone, issues the app's JWT instead of returning the provider profile and its access token. A test checks the generated code compiles.

Fixed

  • Routes with more than 127 handlers overflowed the int8 chain index.

Full changelog: v1.11.0...v1.12.0

GoLaravel v1.11.0 - Asymmetric JWTs and one rate limiter

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 08:39

Added

  • JWT with public/private keys (pkg/auth): NewJWTManagerWithKey(privateKey, kid, ttl) signs RS256 (RSA ≥ 2048), ES256 (P-256) or EdDSA (Ed25519) tokens, so other services verify them with only the public key.
    • Verifying elsewhere: NewJWTVerifier(publicKey, kid) and NewJWTVerifierFromJWKS(json) create verify-only managers, and JWKS() publishes the public keys.
    • Rotation: AcceptKey(publicKey, kid) keeps accepting old keys; tokens carry kid and are checked only against that key.
    • Key files: ParsePrivateKeyPEM and ParsePublicKeyPEM read PEM keys.
    • Algorithm checks: the algorithm always comes from the manager, never from the token. Key-based managers refuse HS256 (no confusion with a public key used as an HMAC secret), and secret managers refuse key-signed tokens.
    • Interoperability: the ES256 format is checked against the example in RFC 7515, appendix A.3.

Fixed

  • ratelimit.ThrottleMax routes shared one counter. The counter was keyed only by client IP, so traffic on a route with a loose limit used up a strict one elsewhere (for example a feed route locking users out of login). The limit is now part of the key.

Deprecated

  • middleware.RateLimiter now delegates to ratelimit.ThrottleMax(n, time.Minute) instead of keeping its own in-memory token buckets. It therefore uses the configured ratelimit store (shared between instances with the Redis store) and sends the standard X-RateLimit-* headers. Use ratelimit.ThrottleMax or ratelimit.Throttle directly.

Full changelog: v1.10.0...v1.11.0

GoLaravel v1.10.0 - CI, Redis consolidation and store fixes

Choose a tag to compare

@hmmdlthf hmmdlthf released this 16 Nov 08:19

Added

  • CI (.github/workflows/ci.yml): every pull request and push to master runs go vet and go test -race ./..., plus an integration job against real MySQL 8.4, Postgres 17 and Redis 7.
  • Integration tests (integration/, a separate module) run on whichever backends are configured (GOLARAVEL_TEST_MYSQL_DSN, GOLARAVEL_TEST_POSTGRES_DSN, GOLARAVEL_TEST_REDIS_ADDR); SQLite always runs. They cover:
    • the SQL and Redis session drivers;
    • the SQL and Redis cache stores, including concurrent increments, tags and locks shared between two instances;
    • validation unique / exists;
    • the Redis client;
    • the queue and rate limiter Redis code.

Changed

  • One Redis client. pkg/queue and pkg/ratelimit now use the shared pkg/redis client instead of their own copies. The queue's copy put a connection back into the pool after a network error, so later commands could read a half-finished reply. Blocking pops use the new Client.DoTimeout. redis.Open creates a client without contacting the server.
  • ratelimit.RedisStore.Clear uses SCAN instead of KEYS, so it doesn't block a large Redis. New RedisStore.Close.

Fixed

  • Redis rate limiter could be exceeded. Hit counted and then added in separate commands, so concurrent requests (for example a burst of login attempts across instances) could all pass the limit. The trim, count and add now run in one Lua script; 50 concurrent hits with a limit of 10 admit exactly 10.
  • Delayed jobs on custom queues never ran. The Redis queue only moved due jobs for default, high and low; now it moves them for every queue Later was called with. Only the worker whose ZREM removed a job pushes it, so two workers can't run the same delayed job twice.
  • Container singletons (pkg/container): double-checked locking read instance without synchronization (a data race the new -race CI run found), and a singleton whose value was nil was rebuilt on every resolve. An atomic ready flag fixes both.
  • SQL cache Increment on Postgres (found by the new integration run): two concurrent first increments of a new key could both read 0, losing an update, because SELECT ... FOR UPDATE locks nothing when the row is missing. The row is now inserted before it is locked, and increments retry on deadlocks and serialization failures.
  • SQL cache locks on MySQL: re-acquiring a lock without expiry by its own owner returned false, because MySQL counts an UPDATE that changes nothing as 0 affected rows. The owner is now checked directly.

Full changelog: v1.9.0...v1.10.0