Page MenuHomeSoftware Heritage

mailmaps: Add table UserMailmapEvent
ClosedPublic

Authored by vlorentz on Feb 7 2022, 5:05 PM.

Details

Summary

This will log all incoming HTTP requests on update events (assuming the user
is authorized), for audit purposes (requested by @zack).

I considered a log file or Elasticsearch (via journald) first, but vsellier
tells me we don't have a way to persist those; whereas the postgresql database
is properly backed up.

Diff Detail

Repository
rDWAPPS Web applications
Branch
mailmap
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26614
Build 41620: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 41619: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D7109 (id=25770)

Could not rebase; Attempt merge onto d4ca7bede2...

Updating d4ca7bed..cd3e29df
Fast-forward
 swh/web/auth/mailmap.py                          |  54 +++++++++--
 swh/web/auth/migrations/0005_usermailmapevent.py |  39 ++++++++
 swh/web/auth/models.py                           |  30 ++++++
 swh/web/tests/auth/test_mailmap.py               | 111 +++++++++++++++++++++--
 4 files changed, 218 insertions(+), 16 deletions(-)
 create mode 100644 swh/web/auth/migrations/0005_usermailmapevent.py
Changes applied before test
commit cd3e29df747669cd4887529bcd2789b9f1cd4852
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Feb 7 17:03:36 2022 +0100

    mailmaps: Add table UserMailmapEvent
    
    This will log all incoming HTTP requests on update events (assuming the user
    is authorized), for audit purposes.

commit d5b687fb78e03fa4c94da412a061877a59b400f5
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Feb 7 17:01:07 2022 +0100

    mailmaps: Add test_mailmap_add_full

commit 74157d48cd2c05951cf6e8f8910fb215791c63d9
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Feb 7 15:02:15 2022 +0100

    mailmaps: Make error handling more robust when 'from_email' is missing/empty.

commit ca4020e97dcf6ee4fc987400646fad6ccce87824
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Feb 7 14:50:58 2022 +0100

    mailmaps: Return a proper error in case of duplicate from_email
    
    Instead of a generic 500.

commit 98bdf12aea75bdcc2e3e96b49515112987daa164
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Feb 7 14:49:54 2022 +0100

    mailmaps: Add an endpoint to fetch the list
    
    This will be useful for debugging and checking records are indeed
    configured.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1350/ for more details.

anlambert added a subscriber: anlambert.

Looks good to me.

This revision is now accepted and ready to land.Feb 7 2022, 6:00 PM
This revision was landed with ongoing or failed builds.Feb 7 2022, 7:10 PM
This revision was automatically updated to reflect the committed changes.