Problem/Motivation
Spinning this out from #126197: Option to Disable IP Logging.
Drupal permanently logs IP addresses and has done so for at least ten years. This isn't used for anything by default, it's just stored away.
#126197: Option to Disable IP Logging adds a privacy module which would anonymise IP addresses - this is great for things like flood control and similar where the IP address is used for a specific reason (i.e. we need to store a unique identifier for the duration of a request). However comment module just doesn't need to store IP addresses at all - the fact it's linked directly and permanently with e-mail addresses/user accounts makes it different from log/flood etc. too
Proposed resolution
Add a configuration setting to control whether IP addresses are logged or not. Default this to off for new sites but add an update to leave it on for existing sites - we can add a change record to let existing sites know they can change it themselves.
This will be compatible with the privacy module - you could re-enable IP logging and have privacy module installed, in which case comments get associated with a unique identifier, just not the actual IP address - still useful for identifying sock puppet accounts on social sites and similar.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | 2828793-37.patch | 5.48 KB | catch |
| #37 | interdiff-2828793-33-37.txt | 1.25 KB | catch |
| #33 | 2828793-33.patch | 5.08 KB | andypost |
| #33 | interdiff-2828793-29.txt | 1.39 KB | andypost |
| #29 | interdiff-2828793-28.txt | 1.09 KB | andypost |
Comments
Comment #2
catchHere's a patch.
Comment #3
catchs/wth/with
Comment #4
mlncn commentedLovely! Works as expected on a new site.
Since we're changing a default, we need a change record, yes? Oh yes, you noted that in the description. Tagging accordingly.
Comment #6
catchComment #8
wim leersComment #9
wturrell commentedI got:
so I changed it to 8401 (right?) and replicated the
@addtogroup updatesstuff (which I don't understand).Also, any chance of an idiot's guide (in issue summary perhaps) for how to upgrade an existing site to use this? i.e. how do you get the new config setting in there without uninstalling and reinstalling the comment module (which you can't).
Thanks.
Comment #10
mac_weber commentedIndentation is incorrect here.
Comment #11
Munavijayalakshmi commentedComment #12
Munavijayalakshmi commentedComment #13
jofitzRe-rolled (and resolved the indentation issue highlighted in #10).
Comment #14
yoroy commentedHappy to see this become the better new default.
This does not provide a UI right? I couldn't find any in simplytest :-)
Comment #15
catchYes there's no UI for it yet, I don't really know where that UI could live for comment module to be honest.
Also the setting isn't actually used in comment module yet, so needs work for that, and we need test coverage.
Comment #16
mac_weber commentedTBH, I hope the IP log option is default off and no UI to change it.
Keeping it only to be changed by who somehow really "needs" it would avoid for example a beginner developer that doesn't have a well configured server to set this option on - by obfuscation.
Comment #17
yoroy commentedAgreed. To be clear: I was checking, not promoting a UI for it :)
Comment #18
catchYes I had no intention to provide a UI here. There's really no reason to collect and store real IP addresses permanently, and comment is the only core module that does so.
If we want to add cryptolog or similar functionality to core we could default to that eventually, also with no UI. Cryptolog is enough to identify issues such as hundreds of commenters coming from the same IP address, you can then collect actual IP addresses for a bit to see what they are. It would also improve the privacy case for flood control etc., but those are already temporary and cycled out, so much less of a concern for me. We have an issue open for that already separately.
Marking CNW because we need to add test coverage and actually implement the behaviour change still.
Comment #21
catchComment #22
catchComment #23
andypostPatch to prevent logging
It needs changes in
\Drupal\Tests\comment\Kernel\CommentHostnameTest::testGetDefaultHostname(should fail now)And upgrade path changes
Comment #24
andypostFixed test, now only upgrade path tests needed
Comment #25
andypostyes, UI should live in contrib a-la
gdpr_commentand the URL/admin/structure/comment/settingsComment #28
andypostFix token test
Comment #29
andypostAdded upgrade test
I guess it needs Lee to approve
Comment #30
andypostComment #33
andypostFix test for real
Comment #36
larowlanthis needs to be a post update hook as it is changing config
Crediting jibran who I confirmed that with
Comment #37
catchRe-rolled with a post-update.
Comment #38
larowlannit: whitespace
looks good to me
Comment #39
catchAdded a change record.
Comment #41
larowlanfixed on commit
Committed 36ecfc6 and pushed to 8.7.x.
Updated and published change record
Comment #43
isinadinos commentedJust came out at this post and sadly realised that ips are not stored in comment_field_data table any more. Is there a guide how to enable this feature (at least programmaticaly)? It is essential for my blog to store comments which are needed in the future.