Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tighten the Discord check (
#3165) so invalid-format or unexpected responses from Discord's username-attempt API cannot report false-positiveCLAIMEDresults:"presenseStrs": ["{\"taken\":true}"]alongside"absenceStrs": ["{\"taken\":false}"]so only an explicit{"taken":true}confirmation is reported asCLAIMED."regexCheck"to^(?!.*\.\.)[A-Za-z0-9_.]{2,32}$to match Discord's actual username rules (ASCII letters, digits, underscores, and non-consecutive periods; 2–32 chars).USERNAME_INVALID_CHARACTERSandUSERNAME_INVALID_REPEATING_DOTSto"errors"as defense in depth.maigret/resources/db_meta.jsonandsites.md(preserving LF line endings).Fixes #3165
Root Cause
DiscordusesPOST https://discord.com/api/v9/unique-username/username-attempt-unauthedwithcheckType: "message", previously had nopresenseStrs(is_presense_detected = Trueby default), and used a broadregexCheckthat allowed hyphens (-) and repeating dots (..).Probing the live API with usernames containing
-or..(such asjohn-doe,C.fED-X5QAh6_blx8, orNyQ.kppTm_f..gk0zwa0yy) returnsHTTP 400:{"message": "Invalid Form Body", "code": 50035, "errors": {"username": {"_errors": [{"code": "USERNAME_INVALID_CHARACTERS", "message": "Username can only use letters, numbers, underscores and periods."}]}}}{"message": "Invalid Form Body", "code": 50035, "errors": {"username": {"_errors": [{"code": "USERNAME_INVALID_REPEATING_DOTS", "message": "Username cannot contain repeating dots."}]}}}Because
HTTP 400is not flagged bydetect_error_page,presenseStrswas empty, and{"taken":false}was absent from the error payload, Maigret reported[+] Discord: https://discord.com(CLAIMED) for any username with-or...Live boundary checks against Discord's API confirmed it accepts uppercase letters (
Blue->{"taken":true}), leading/trailing periods (.abc12345,abc12345.->{"taken":true}), and 2-char names (ab->{"taken":true}), while rejecting-and..withHTTP 400(50035).Verification
python -m maigret john-doe NyQ.kppTm_f..gk0zwa0yy --site Discord --db maigret/resources/data.json --no-autoupdate --dns-resolver threaded-> falsely reported[+] Discord: https://discord.com(1account each).CONTRIBUTING.mdtwo-filter validation):python -m maigret --self-check --site Discord --db maigret/resources/data.json --no-autoupdate --dns-resolver threaded-> passed cleanly (1/1in0.7s).1e5fe11b34d6([-] Discord: Not found!) and923a88d920fd([?] Discord: Site-specific error: Rate limited) ->0accounts claimed.john-doe,NyQ.kppTm_f..gk0zwa0yy, andC.fED-X5QAh6_blx8-> rejected upfront byregexCheck(Illegal Username Format For This Site!),0accounts claimed and no wasted API requests.process_site_resultchecks (6/6 passed):{"taken":true}->CLAIMED;{"taken":false}->AVAILABLE;USERNAME_INVALID_CHARACTERS/USERNAME_INVALID_REPEATING_DOTS->UNKNOWN; unexpectedHTTP 200/HTTP 400bodies ->AVAILABLE.pytest tests/test_data.py tests/test_sites.py tests/test_country_tags.py tests/test_site_false_positives.py tests/test_errors.py tests/test_error_detection.py tests/test_username_markers.py-> 137 passed.data_sha256match (b7214cae4dc7f860db50211687796f0ce18eb849039b9c97bdda989716df2e72).