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

AllowedRestrictedUser Wildcard #1227

Closed
Faicu opened this issue May 27, 2017 · 4 comments
Closed

AllowedRestrictedUser Wildcard #1227

Faicu opened this issue May 27, 2017 · 4 comments
Assignees
Milestone

Comments

@Faicu
Copy link

Faicu commented May 27, 2017

Hello! I want to use AllowedRestrictedUser to restrict my username, Faicu to my IP. But, I have dynamic IP and it is modifying daily with a NEW part of it. Example: 23.33.55.10 today. 23.33.55.11, tomorrow and I want, if possible to use wildcard at last series of numbers, like: 23.33.55.* or 23.33.55.% something like this.

Environment description

BungeeCord - Spigot

AuthMe build number:

5.2 1542

@sgdc3 sgdc3 added this to the 5.3.2 milestone Jul 2, 2017
@sgdc3 sgdc3 self-assigned this Jul 2, 2017
sgdc3 added a commit that referenced this issue Jul 2, 2017
@rautamiekka
Copy link

The added RegEx support is a great addition, but AFAIS no documentation changes were done which clearly state you have to use Java-specific RegEx syntax.

@ljacqu
Copy link
Member

ljacqu commented Jul 3, 2017

The best way would be if we supported * as wildcard. Would not require any regex prefix and is probably what the user would expect. I'm not sure how it could be best implemented, though :/

@rautamiekka
Copy link

rautamiekka commented Jul 3, 2017

^ I think that should internally be done as a RegEx regardless since it provides a massive range of possibilities. In which case you could do this (designed for Perl but should work with Java when Java's additional requirements are met):

  • Escape characters as needed, except the * if we'll use it as the wildcard.
  • If it's an IPv4 address, replace * with [0-9]{1,3} (I know, this allows IPv4 0.0.0.0-999.999.999.999, but that's not really any of our concern). If it's a string (username, etc.), with .*. EDIT 2017-07-25: I found a working complete IPv4 address RegEx which allows only the IPs it's supposed to, but it's a lot of text cuz of options, so I made a gist: https://gist.github.com/rautamiekka/e6e088f085a553778992dfd9e1ffb2da
  • Assuming you want the string you're supposed to compare against to match completely: prepend ^ and append $ to the RegEx string. However, if Java has its own quirks with this that make this step redundant, I'm not aware of such thing.
  • Run the RegEx string through RegEx matcher like usual.
  • Do your stuff.

@ljacqu
Copy link
Member

ljacqu commented Jul 8, 2017

I've tested the new regex feature successfully on an online server, so in the interest of keeping our tracking clean (milestones and whatnot) I open a follow-up issue and close this.

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

No branches or pull requests

4 participants