Active
Project:
Restrict IP
Version:
5.0.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Feb 2018 at 16:48 UTC
Updated:
25 Dec 2024 at 11:39 UTC
Jump to comment: Most recent
1. Enable Restricted IPs
and give a list of allowed IP addresses
2. enable Check IP addresses only on the following paths
for example:
/protected_page
3. Access the /protected_page from any IP address not in the list of allowed IP addresses. Good! The illegal client is blocked as expected.
But, after any client from the list of allowed IP addresses successfully accesses the /protected_page, the illegal client can successfully access the /protected_page at the same time too!!!
Comments
Comment #2
jaypanThis sounds like a caching issue - I'm not sure if it's something that can be fixed at the module level, without disabling caching across the site. Let's do a bit of detective work on this though.
First, what caching have you got enabled on the site?
Comment #3
hoff331 commented@Jaypan,
We also experienced this issue - it was caused by the dynamic page cache module (disabling the dynamic page cache module resolved the issue).
Now that the dynamic page cache module is enabled by default, we should consider using the IP cache context or a custom cache context to ensure that restricted IPs are not being served cached content.
Comment #4
jaypanThanks that makes sense. I'll work on this next time I'm working on the module.
Comment #5
bill_redman commentedI just tried this module and it did not work as advertised. When I looked at the issues I found this one. My situation is slightly different but seems to be related. I did steps 1 (IP range rather than a list of individual IPs) & 2 as described at the beginning. However, when I tried to access the protected page from an IP not in the allowable range, I was not blocked at all. Access to the page was granted as if there was no restriction in place.
I don't use any cache module, but could the same forces be at work here? Thanks.
Comment #6
anybodyCleaning up the module versions with Drupal 8 & 9 compatible 3.x release. We have to sort out outdated issues to focus on 3.x stabilization. Older Drupal 8 versions (8.x-2.x and 8.x-1.x) will be deprecated soon, so it doesn't make much sense anymore to fix them. Please instead retest if this issue is still relevant for latest 3.x version. If you should experience other issues, please create a separate issue for that, if not already existing.
If the issue from this request still exists in 3.x, please create a Merge Request (MR) against the latest 3.x-dev version to fix the issue and tell us about the actual problem and expected result.
Thank you very much! Let's get this module fixed together as community :)
Comment #7
tce commentedConfirming the issue. I just installed the module version 3.0.0-beta4 and the dynamic cache is allowing the page to be visited if the cache has been built.
I'm wondering if you using StackMiddleware would work?
https://www.drupal.org/node/1909596#comment-11384523
Comment #8
anybodyPlease retry with 4.x
Comment #9
agentrickardWe've looked at the code. This will likely still be an issue in 4.x
I also need to file another issue about how r
estrict_ip_js_alter()can break JS rendering for anonymous users. Essentially, core will cache the partial JS payload and not reset that for anon users who *are* on the proper ip.Comment #10
anybodyThanks @agentrickard! This is absolutely possible. We also found several things that could / should be improved after becoming Co-Maintainers a while ago.
Would it make sense for you to become (co-)maintainer and help to push things forward here?
Comment #11
agentrickardI don't have a ton of time right now, though I am trying to unblock a project. It can't hurt to give me access, though I can't promise anything.
For page-level caching, we had to use a ServiceProvider override to override the core
getCacheId()method to add an "ip_allowed" or "ip_deneid" string to the cache id.Comment #12
anybody@agentrickard thanks, I think anyone with a lot of experience, like you, can help to push things forward here. I'll add you as co-maintainer.
Hopefully we all can improve things here sooner or later.
Comment #13
anybodyPS: And we should have tests, whereever possible!
Comment #14
smustgrave commentedComment #15
anybodyYeah I think we should check and add tests for this with priority to see if the issue (still) exists.