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

Fixes bug that if only backlist is supplied incorrectly getting 403 error #1

Merged
merged 1 commit into from
Aug 2, 2020

Conversation

MekDrop
Copy link
Contributor

@MekDrop MekDrop commented Aug 1, 2020

If this middleware is used without whitelist and only with backlist is supplied, it incorrectly things that not blacklisted IPs are bad.

F.e.:

Dispatcher::run([
    (new Middlewares\Firewall(null))
        ->blacklist([
            '123.0.0.1',
            '123.0.0.2',
        ])
]);

Incorrectly thinks that if user comes from IP 127.0.0.1 that with such IP is something wrong.

It seems for this case changing IpFirewall default state value helps because in that case IP validation works with rule not $whited && !$blacked but with !$blacked || $whited. And that is what we need for this case.

@MekDrop
Copy link
Contributor Author

MekDrop commented Aug 1, 2020

Hmm... It seems there is a problem with current tests. I didn't touched that part where tests are failing... :/

@oscarotero
Copy link
Member

LGTM. Don't worry about the tests, it's a different issue. I'm going to fix it and release a new version. Thanks!

@MekDrop MekDrop deleted the patch-1 branch August 2, 2020 19:32
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.

2 participants