Commit 8a73da2
[User Session] Clear metadata on older sessions (#10751)
### Closes #10744
This pull request introduces a new background job to clear outdated user
session data and schedules it to run daily. The job ensures sensitive
session information is removed for sessions older than one year. Below
are the most important changes:
### Addition of a new job:
*
[`app/jobs/user/clear_old_user_sessions_job.rb`](diffhunk://#diff-19bd9b2978ef88bf9ae1db00fbb346141d92e5d85c4cb816b8949d814f0c4792R1-R21):
Added a new job `ClearOldUserSessionsJob` to the `User` namespace. This
job iterates through user sessions older than one year and clears
sensitive data such as `device_info`, `os_info`, `timezone`, `ip`, and
location details (`latitude` and `longitude`).
### Scheduling the job:
*
[`config/schedule.yml`](diffhunk://#diff-18c4a92c666266e8bead5b6ddb034501022877cdf773c0d337499ed0a7f6d341R175-R179):
Scheduled the new `ClearOldUserSessionsJob` to run daily at 3:00 AM with
a low priority queue.
[Internal
discussion](https://hackclub.slack.com/archives/C047Y01MHJQ/p1750259883680629)
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gary Tou <[email protected]>1 parent f0bdbdb commit 8a73da2
File tree
3 files changed
+26
-0
lines changed- app
- jobs/user_session
- models
- config
3 files changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
175 | 180 | | |
176 | 181 | | |
177 | 182 | | |
| |||
0 commit comments