Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable logging remote IP address #620

Merged

Conversation

Nathan-Cohen
Copy link
Contributor

Hello,
I've created this Pull Request in response to the user's request regarding the possibility to disable logging of the remote IP address in django-auditlog's audit logs (#524). This feature is desirable in the context of personal data protection, especially in compliance with the General Data Protection Regulation (GDPR).

In this Pull Request, I've added a new configuration, AUDITLOG_DISABLE_REMOTE_ADDR, which allows disabling the logging of the remote IP address. When this configuration is enabled, the remote IP address will no longer be recorded in the audit logs.

I've had to deal with this problem myself and I think it's important to address it for reasons of data confidentiality, which is why I've done this.

@hramezani
Copy link
Member

Thanks @Nathan-Cohen for this PR.
Please:

@Nathan-Cohen Nathan-Cohen force-pushed the disable-logging-remote-ip-address branch from e7144ab to 693a509 Compare March 25, 2024 16:50
@Nathan-Cohen
Copy link
Contributor Author

Nathan-Cohen commented Mar 25, 2024

@hramezani It's done, let me know if I need to make any other changes.

auditlog/middleware.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
auditlog/middleware.py Outdated Show resolved Hide resolved
@@ -1273,6 +1273,12 @@ def test_register_from_settings_invalid_settings(self):
):
self.test_auditlog.register_from_settings()

with override_settings(AUDITLOG_DISABLE_REMOTE_ADDR="str"):
Copy link
Member

@hramezani hramezani Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to move this test in MiddlewareTest because the checking is in middleware init

@hramezani
Copy link
Member

Thanks @Nathan-Cohen for the update.

Please add a test to showing enabling AUDITLOG_DISABLE_REMOTE_ADDR will exclude the remote address logging.

Copy link

codecov bot commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.24%. Comparing base (5289482) to head (2560bd1).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #620      +/-   ##
==========================================
+ Coverage   95.21%   95.24%   +0.02%     
==========================================
  Files          31       31              
  Lines        1025     1031       +6     
==========================================
+ Hits          976      982       +6     
  Misses         49       49              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hramezani hramezani merged commit a0ae594 into jazzband:master Mar 31, 2024
8 checks passed
@hramezani
Copy link
Member

Thanks @Nathan-Cohen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants