-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Automated whitelists #23985
Automated whitelists #23985
Conversation
Only people that are added to the whitelist with the addwhitelist command will be able to join. I call this the "legacy" whitelist
Default whitelist is now the "legacy" whitelist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it looks like it would work for WizDen's needs, but changes could be made to improve readability of the prototype, and to make the system more flexible, potentially allowing it to be easier to use for other things in the future.
Adding support for playtime based ranges for the note condition is probably the thing that'd have the biggest impact on the effectiveness of the system for WizDen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a terminology nitpick, but to keep things flexible, I'd avoid using the term whitelist/blacklist. It's all just conditions or rules that contribute to an overall blacklist or whitelist system, using terminology that doesn't describe any of the conditions as a whitelist or blacklist can encourage people who make changes in the future to keep the design flexible.
It's not the "Minimum number of players required for this whitelist to be active", it's the "Minimum number of players required for this condition to match", because if the condition can be used flexibly enough, then it can be used as a whitelist or a blacklist
Content.Server/Connection/Whitelist/Conditions/ConditionNotes.cs
Outdated
Show resolved
Hide resolved
Content.Server/Connection/Whitelist/Conditions/ConditionNotes.cs
Outdated
Show resolved
Hide resolved
Content.Server/Connection/Whitelist/Conditions/ConditionNotes.cs
Outdated
Show resolved
Hide resolved
@Simyon264 you working on this famalams. |
Yes. I am still working on it. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not catching this earlier. It seems like there are some quirks with the manual whitelist/blacklist conditions.
It's very possible that I'm missing something, partly because I'm just looking at the changes on GitHub, but it looks like the manual whitelist/blacklist conditions have opposite behavior based on someone's status in the list. I understand why this would have been done, but I think both of these should act as a "is the person on the list" check instead for two reasons:
- A long term goal would be to allow arbitrary lists to be made so that servers can create as many manual lists as they want for whatever purpose they have, potentially even using those lists for other things unrelated to connections. Having conditions work as being list membership now will prevent having to make changes in the future that either break YAML configs or require workarounds.
- I think it makes the rules clearer in the YAML.
ConditionManualBlacklist
allow
seems weird. It might also help to appendMembership
to the conditions, but that'd increase the name length quite a bit.
Something like this? @Chief-Engineer - !type:ConditionMembership
list: whitelist # Which list the player needs to be a part of
requiredMembershipTime: 120 # Must be a member for 2 hours
action: Allow
- !type:ConditionAlwaysMatch
action: Deny # Not a member, deny connection |
Yes, except I'm not sure that |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix these issues myself real quick.
Dictionary<NetUserId, List<IAdminRemarksRecord>> cacheRemarks = new(); | ||
Dictionary<NetUserId, List<PlayTime>> cachePlaytime = new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you storing this keyed on user ID if this function only runs for a single user at once?
return await _db.GetBlacklistStatusAsync(data.UserId); | ||
} | ||
|
||
private async Task<bool> CheckConditionNotesDateRange(ConditionNotesDateRange conditionNotes, List<IAdminRemarksRecord> remarks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These don't need to be async
if (bans.Count > 0) | ||
{ | ||
var firstBan = bans[0]; | ||
var message = firstBan.FormatBanMessage(_cfg, _loc); | ||
return (ConnectionDenyReason.Ban, message, bans); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screwed up merge xd
About the PR
This PR adds automatic whitelists based on conditions defined in a prototype.
Why / Balance
Resolves #19606.
Technical details
This PR adds a
blacklist
table to the DB and the coresponding commands for managing the blacklist.I also added a new prototype
PlayerConnectionWhitelist
which is used to define whitelists. That prototype contains an Array ofWhitelistCondition
conditions. EveryWhitelistCondition
contains 2 DataFields and a Function to check if the player is allowed to connect. The 2 DataFields are the following:BreakIfConditionSuccess
: If the condition passes, the next conditions will not be checked and the player will be able to connect.BreakIfConditionFail
: If the condition fails, the player will be denied and the next conditions will not be checked.Media
Breaking changes
This removes some CVars related for whitelists, the legacy whitelists are used by default when
whitelist.enabled
is set to true. Usewhitelist.prototypeList
to define which whitelists should be used. Currently implemented whitelists are:mrpWhitelist
andbasicWhitelist
.