[PR #26] [MERGED] feat: add audit log with email notification #965

Closed
opened 2025-10-07 00:25:29 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/26
Author: @stonith404
Created: 9/9/2024
Status: Merged
Merged: 9/9/2024
Merged by: @stonith404

Base: mainHead: feat/audit-log


📝 Commits (5)

📊 Changes

51 files changed (+944 additions, -163 deletions)

View changed files

📝 .env.example (+1 -0)
📝 CONTRIBUTING.md (+1 -1)
📝 Dockerfile (+2 -1)
📝 README.md (+1 -0)
backend/email-templates/login-with-new-device.html (+119 -0)
📝 backend/go.mod (+1 -0)
📝 backend/go.sum (+2 -0)
📝 backend/internal/bootstrap/router_bootstrap.go (+6 -4)
📝 backend/internal/controller/app_config_controller.go (+9 -9)
backend/internal/controller/audit_log_controller.go (+56 -0)
📝 backend/internal/controller/oidc_controller.go (+2 -2)
📝 backend/internal/controller/webauthn_controller.go (+4 -10)
📝 backend/internal/dto/app_config_dto.go (+6 -0)
backend/internal/dto/audit_log_dto.go (+17 -0)
📝 backend/internal/job/db_cleanup.go (+7 -1)
📝 backend/internal/model/app_config.go (+7 -0)
backend/internal/model/audit_log.go (+50 -0)
📝 backend/internal/service/app_config_service.go (+32 -7)
backend/internal/service/audit_log_service.go (+85 -0)
backend/internal/service/email_service.go (+67 -0)

...and 31 more files

📄 Description

This PR adds an audit log that logs every login and client authorization.

Additionally, if a login was done on a new device or location an email gets sent. The email server must be setup in the application configuration first.

Screenshot 2024-09-09 at 10 16 32

Screenshot 2024-09-09 at 10 18 35


🔄 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/26 **Author:** [@stonith404](https://github.com/stonith404) **Created:** 9/9/2024 **Status:** ✅ Merged **Merged:** 9/9/2024 **Merged by:** [@stonith404](https://github.com/stonith404) **Base:** `main` ← **Head:** `feat/audit-log` --- ### 📝 Commits (5) - [`3e77217`](https://github.com/pocket-id/pocket-id/commit/3e77217a4a9119786416e88c451b6367ae9b0a13) add email notifications - [`4d30a24`](https://github.com/pocket-id/pocket-id/commit/4d30a2496e8c6a150f5a1827e6e6027e76d9765f) add audit log - [`3897fb8`](https://github.com/pocket-id/pocket-id/commit/3897fb8f3d262136e0aad2da961ddab04b5c61a7) add db cleanup for audit log - [`a50a8f6`](https://github.com/pocket-id/pocket-id/commit/a50a8f66794f7bbf99e26ccc41950f4b6bdc3958) improve audit log table on mobile - [`73fc8f1`](https://github.com/pocket-id/pocket-id/commit/73fc8f1fbc676cda849b9e7445ff8036f13625de) add test ### 📊 Changes **51 files changed** (+944 additions, -163 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+1 -0) 📝 `CONTRIBUTING.md` (+1 -1) 📝 `Dockerfile` (+2 -1) 📝 `README.md` (+1 -0) ➕ `backend/email-templates/login-with-new-device.html` (+119 -0) 📝 `backend/go.mod` (+1 -0) 📝 `backend/go.sum` (+2 -0) 📝 `backend/internal/bootstrap/router_bootstrap.go` (+6 -4) 📝 `backend/internal/controller/app_config_controller.go` (+9 -9) ➕ `backend/internal/controller/audit_log_controller.go` (+56 -0) 📝 `backend/internal/controller/oidc_controller.go` (+2 -2) 📝 `backend/internal/controller/webauthn_controller.go` (+4 -10) 📝 `backend/internal/dto/app_config_dto.go` (+6 -0) ➕ `backend/internal/dto/audit_log_dto.go` (+17 -0) 📝 `backend/internal/job/db_cleanup.go` (+7 -1) 📝 `backend/internal/model/app_config.go` (+7 -0) ➕ `backend/internal/model/audit_log.go` (+50 -0) 📝 `backend/internal/service/app_config_service.go` (+32 -7) ➕ `backend/internal/service/audit_log_service.go` (+85 -0) ➕ `backend/internal/service/email_service.go` (+67 -0) _...and 31 more files_ </details> ### 📄 Description This PR adds an audit log that logs every login and client authorization. Additionally, if a login was done on a new device or location an email gets sent. The email server must be setup in the application configuration first. ![Screenshot 2024-09-09 at 10 16 32](https://github.com/user-attachments/assets/fd6fed29-d9fe-4f6d-b36f-05285ddf2e28) ![Screenshot 2024-09-09 at 10 18 35](https://github.com/user-attachments/assets/547d821b-4f1d-43c6-b7e7-3c4f17b86d3a) --- <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-07 00:25:30 +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#965