Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## v0.39.7

- Replaced `github.com/go-ozzo/ozzo-validation` with the fork `github.com/pocketbase/ozzo-validation` since the original library has recently changed ownership and the new maintainer cannot be trusted.
_There are plans to create eventually a new validation library from scratch more suited for our needs in PocketBase because ozzo-validation is known to have some minor performance and obscure regex issues, but until then we'll stick with the fork (and if you use `ozzo-validation` in your own Go code, I'd suggest to swap the imports with the fork)_.

- Fixed missing import collection `fields` property access ([#7760](https://github.com/pocketbase/pocketbase/issues/7760)).

- Fixed View collection `*` validator and added more friendly error messages ([#7761](https://github.com/pocketbase/pocketbase/issues/7761)).

- ⚠️ Security fix for unhandled panic in internal worker goroutines ([#7762](https://github.com/pocketbase/pocketbase/discussions/7762)).
_To prevent this from showing again, all existing internal worker functions were wrapped with [`routine.SafeWrap(f)`](https://pkg.go.dev/github.com/pocketbase/pocketbase/tools/routine#SafeWrap) (auto recovers and returns any eventual panic as regular error)._


## v0.39.6

- Added `Cc` and `Bcc` recipients to the dev `sendmail` command for consistency with the SMTP mailer.
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG_16_22.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
> For the most recent versions, please refer to [CHANGELOG.md](./CHANGELOG.md)
---

## v0.22.48

- (_Backported from v0.39.7_) Replaced `github.com/go-ozzo/ozzo-validation` with the fork `github.com/pocketbase/ozzo-validation` since the original library has recently changed ownership and the new maintainer cannot be trusted.

- (_Backported from v0.39.7_) Fixed View collection `*` validator and added more friendly error messages ([#7761](https://github.com/pocketbase/pocketbase/issues/7761)).

- (_Backported from v0.39.7_) ⚠️ Security fix for unhandled panic in internal worker goroutines ([#7762](https://github.com/pocketbase/pocketbase/discussions/7762)).


## v0.22.47

- (_Backported from v0.39.6_) Bumped the min Go GitHub action version to 1.26.5 as it includes some [minor security fixes](https://github.com/golang/go/issues?q=milestone%3AGo1.26.5).
Expand Down
2 changes: 1 addition & 1 deletion apis/backup_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"regexp"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
)

Expand Down
2 changes: 1 addition & 1 deletion apis/backup_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apis
import (
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/core/validators"
"github.com/pocketbase/pocketbase/tools/filesystem"
Expand Down
7 changes: 4 additions & 3 deletions apis/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import (
"strings"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/filesystem"
"github.com/pocketbase/pocketbase/tools/router"
"github.com/pocketbase/pocketbase/tools/routine"
"github.com/pocketbase/pocketbase/tools/types"
"github.com/spf13/cast"
)
Expand Down Expand Up @@ -195,7 +196,7 @@ func (p *batchProcessor) Process(batch []*core.InternalRequest, timeout time.Dur
p.stopCh <- struct{}{}
}()

go func() {
routine.FireAndForget(func() {
err := p.process(txApp, batch, 0)

if err != nil {
Expand All @@ -216,7 +217,7 @@ func (p *batchProcessor) Process(batch []*core.InternalRequest, timeout time.Dur
}

p.errCh <- err
}()
})

select {
case responseErr := <-p.errCh:
Expand Down
2 changes: 1 addition & 1 deletion apis/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"slices"
"strings"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/auth"
"github.com/pocketbase/pocketbase/tools/router"
Expand Down
2 changes: 1 addition & 1 deletion apis/collection_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
)

Expand Down
26 changes: 13 additions & 13 deletions apis/realtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strings"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/pocketbase/dbx"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/picker"
Expand Down Expand Up @@ -260,7 +260,7 @@ func realtimeUpdateClientsAuth(app core.App, authRecord *core.Record) error {
group := new(errgroup.Group)

for _, chunk := range chunks {
group.Go(func() error {
group.Go(routine.SafeWrap(func() error {
for _, client := range chunk {
clientAuth, _ := client.Get(RealtimeClientAuthKey).(*core.Record)
if clientAuth != nil &&
Expand All @@ -275,7 +275,7 @@ func realtimeUpdateClientsAuth(app core.App, authRecord *core.Record) error {
}

return nil
})
}))
}

return group.Wait()
Expand All @@ -288,7 +288,7 @@ func realtimeUnsetClientsAuthByRecordModelOrProxy(app core.App, authModel core.M
group := new(errgroup.Group)

for _, chunk := range chunks {
group.Go(func() error {
group.Go(routine.SafeWrap(func() error {
for _, client := range chunk {
clientAuth, _ := client.Get(RealtimeClientAuthKey).(*core.Record)
if clientAuth != nil &&
Expand All @@ -299,7 +299,7 @@ func realtimeUnsetClientsAuthByRecordModelOrProxy(app core.App, authModel core.M
}

return nil
})
}))
}

return group.Wait()
Expand All @@ -312,7 +312,7 @@ func realtimeUnsetClientsAuthByCollection(app core.App, collection *core.Collect
group := new(errgroup.Group)

for _, chunk := range chunks {
group.Go(func() error {
group.Go(routine.SafeWrap(func() error {
for _, client := range chunk {
clientAuth, _ := client.Get(RealtimeClientAuthKey).(*core.Record)
if clientAuth != nil && clientAuth.Collection().Name == collection.Name {
Expand All @@ -321,7 +321,7 @@ func realtimeUnsetClientsAuthByCollection(app core.App, collection *core.Collect
}

return nil
})
}))
}

return group.Wait()
Expand Down Expand Up @@ -623,7 +623,7 @@ func realtimeBroadcastRecord(app core.App, action string, record *core.Record, d
}

for _, chunk := range chunks {
group.Go(func() error {
group.Go(routine.SafeWrap(func() error {
var clientAuth *core.Record

for _, client := range chunk {
Expand Down Expand Up @@ -766,7 +766,7 @@ func realtimeBroadcastRecord(app core.App, action string, record *core.Record, d
}

return nil
})
}))
}

return group.Wait()
Expand All @@ -782,7 +782,7 @@ func realtimeBroadcastDryCacheKey(app core.App, key string) error {
group := new(errgroup.Group)

for _, chunk := range chunks {
group.Go(func() error {
group.Go(routine.SafeWrap(func() error {
for _, client := range chunk {
messages, ok := client.Get(key).([]subscriptions.Message)
if !ok {
Expand All @@ -801,7 +801,7 @@ func realtimeBroadcastDryCacheKey(app core.App, key string) error {
}

return nil
})
}))
}

return group.Wait()
Expand All @@ -817,15 +817,15 @@ func realtimeUnsetDryCacheKey(app core.App, key string) error {
group := new(errgroup.Group)

for _, chunk := range chunks {
group.Go(func() error {
group.Go(routine.SafeWrap(func() error {
for _, client := range chunk {
if client.Get(key) != nil {
client.Unset(key)
}
}

return nil
})
}))
}

return group.Wait()
Expand Down
2 changes: 1 addition & 1 deletion apis/record_auth_email_change_confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apis
import (
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/security"
)
Expand Down
4 changes: 2 additions & 2 deletions apis/record_auth_email_change_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package apis
import (
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/go-ozzo/ozzo-validation/v4/is"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/mails"
)
Expand Down
2 changes: 1 addition & 1 deletion apis/record_auth_impersonate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apis
import (
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
)

Expand Down
4 changes: 2 additions & 2 deletions apis/record_auth_otp_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/go-ozzo/ozzo-validation/v4/is"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/mails"
"github.com/pocketbase/pocketbase/tools/routine"
Expand Down
2 changes: 1 addition & 1 deletion apis/record_auth_password_reset_confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apis
import (
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/core/validators"
"github.com/pocketbase/pocketbase/tools/security"
Expand Down
4 changes: 2 additions & 2 deletions apis/record_auth_password_reset_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/go-ozzo/ozzo-validation/v4/is"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/mails"
"github.com/pocketbase/pocketbase/tools/routine"
Expand Down
2 changes: 1 addition & 1 deletion apis/record_auth_verification_confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apis
import (
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/security"
"github.com/spf13/cast"
Expand Down
4 changes: 2 additions & 2 deletions apis/record_auth_verification_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/go-ozzo/ozzo-validation/v4/is"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/mails"
"github.com/pocketbase/pocketbase/tools/routine"
Expand Down
2 changes: 1 addition & 1 deletion apis/record_auth_with_oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"syscall"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/pocketbase/dbx"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/auth"
"github.com/pocketbase/pocketbase/tools/dbutils"
Expand Down
2 changes: 1 addition & 1 deletion apis/record_auth_with_otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"fmt"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
)

Expand Down
4 changes: 2 additions & 2 deletions apis/record_auth_with_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"slices"
"strings"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/go-ozzo/ozzo-validation/v4/is"
"github.com/pocketbase/dbx"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/dbutils"
"github.com/pocketbase/pocketbase/tools/list"
Expand Down
2 changes: 1 addition & 1 deletion apis/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package apis
import (
"net/http"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/forms"
"github.com/pocketbase/pocketbase/tools/router"
Expand Down
2 changes: 1 addition & 1 deletion apis/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/router"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/superuser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/fatih/color"
"github.com/go-ozzo/ozzo-validation/v4/is"
"github.com/pocketbase/ozzo-validation/v4/is"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/tools/security"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion core/auth_origin_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"slices"

validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/pocketbase/dbx"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/types"
)
Expand Down
4 changes: 2 additions & 2 deletions core/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ func (app *BaseApp) initLogger() error {
},
})

go func() {
routine.FireAndForget(func() {
ctx := context.Background()

for {
Expand All @@ -1469,7 +1469,7 @@ func (app *BaseApp) initLogger() error {
handler.WriteAll(ctx)
}
}
}()
})

app.logger = slog.New(handler)

Expand Down
2 changes: 1 addition & 1 deletion core/collection_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"fmt"
"slices"

validation "github.com/go-ozzo/ozzo-validation/v4"
validation "github.com/pocketbase/ozzo-validation/v4"
"github.com/spf13/cast"
)

Expand Down
Loading
Loading