[PR #695] [MERGED] fix: Auth fails when client IP is empty on Postgres #672

Closed
opened 2025-10-08 00:14:58 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/695
Author: @ItalyPaleAle
Created: 6/29/2025
Status: Merged
Merged: 6/30/2025
Merged by: @stonith404

Base: mainHead: fix-686


📝 Commits (7)

📊 Changes

10 files changed (+122 additions, -51 deletions)

View changed files

📝 backend/internal/dto/audit_log_dto.go (+8 -9)
📝 backend/internal/dto/validations.go (+6 -6)
📝 backend/internal/model/audit_log.go (+1 -1)
📝 backend/internal/service/audit_log_service.go (+18 -8)
📝 backend/internal/service/geolite_service.go (+9 -5)
📝 backend/internal/service/geolite_service_test.go (+11 -22)
backend/resources/migrations/postgres/20250628000000_audit_logs_ip_null.down.sql (+4 -0)
backend/resources/migrations/postgres/20250628000000_audit_logs_ip_null.up.sql (+5 -0)
backend/resources/migrations/sqlite/20250628000000_audit_logs_ip_null.down.sql (+30 -0)
backend/resources/migrations/sqlite/20250628000000_audit_logs_ip_null.up.sql (+30 -0)

📄 Description

Fixes #686

Auth fails with Postgres when the client IP is empty, for example when proxies connect to Pocket ID via a Unix Domain Socket (UDS).

This was due to the fact that in Postgres we store IPs with the INET column type, which doesn't accept empty values.

The fix involves making the field nullabe.

Additionally, improved error handling throughout the process.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pocket-id/pocket-id/pull/695 **Author:** [@ItalyPaleAle](https://github.com/ItalyPaleAle) **Created:** 6/29/2025 **Status:** ✅ Merged **Merged:** 6/30/2025 **Merged by:** [@stonith404](https://github.com/stonith404) **Base:** `main` ← **Head:** `fix-686` --- ### 📝 Commits (7) - [`db87516`](https://github.com/pocket-id/pocket-id/commit/db875165191be5bbe5af24870279c87d726f3df2) fix: Auth fails when client IP is empty on Postgres - [`c0d2501`](https://github.com/pocket-id/pocket-id/commit/c0d25010e543531c9da718f835a074146a94aed1) Merge branch 'main' of https://github.com/pocket-id/pocket-id into fix-686 - [`796ad3c`](https://github.com/pocket-id/pocket-id/commit/796ad3c186d7dbe8afa3d6ec022e1f00b8fe3cb5) Merge branch 'main' of https://github.com/pocket-id/pocket-id into fix-686 - [`37dded5`](https://github.com/pocket-id/pocket-id/commit/37dded57c67c2eb46568b70f07101e8319d7868d) Changed per review feedback - [`662e8a6`](https://github.com/pocket-id/pocket-id/commit/662e8a6d7e896dc73d322139d1409e9a1c1e482c) Fix - [`b09f7c2`](https://github.com/pocket-id/pocket-id/commit/b09f7c29b8dbb940c434c8c05d7051f771100f25) Use simpler types - [`301bfd2`](https://github.com/pocket-id/pocket-id/commit/301bfd28672c42502d264d0cae9bdbf916654920) Add missing indexes in Postgres ### 📊 Changes **10 files changed** (+122 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `backend/internal/dto/audit_log_dto.go` (+8 -9) 📝 `backend/internal/dto/validations.go` (+6 -6) 📝 `backend/internal/model/audit_log.go` (+1 -1) 📝 `backend/internal/service/audit_log_service.go` (+18 -8) 📝 `backend/internal/service/geolite_service.go` (+9 -5) 📝 `backend/internal/service/geolite_service_test.go` (+11 -22) ➕ `backend/resources/migrations/postgres/20250628000000_audit_logs_ip_null.down.sql` (+4 -0) ➕ `backend/resources/migrations/postgres/20250628000000_audit_logs_ip_null.up.sql` (+5 -0) ➕ `backend/resources/migrations/sqlite/20250628000000_audit_logs_ip_null.down.sql` (+30 -0) ➕ `backend/resources/migrations/sqlite/20250628000000_audit_logs_ip_null.up.sql` (+30 -0) </details> ### 📄 Description Fixes #686 Auth fails with Postgres when the client IP is empty, for example when proxies connect to Pocket ID via a Unix Domain Socket (UDS). This was due to the fact that in Postgres we store IPs with the INET column type, which doesn't accept empty values. The fix involves making the field nullabe. Additionally, improved error handling throughout the process. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-08 00:14:59 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id-pocket-id-1#672