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

Refine username detection during login #15653

Merged
merged 2 commits into from Apr 24, 2024

Conversation

moving-bits
Copy link
Member

Description

  • do not terminate detection on JS-escaped double quotes in username
  • check for and unescape JS-escaped Unicode characters
  • along the way: shortens username detection regexp to look for username only, as findcount is detected otherwise meanwhile

(switching to reading serverParameters seems to be non-feasable here, as it is not yet available during login)

- do not terminate detection on JS-escaped double quotes in username
- check for and unescape JS-escaped Unicode characters
@moving-bits moving-bits merged commit a307d09 into cgeo:release Apr 24, 2024
2 checks passed
@moving-bits moving-bits deleted the issue_15610 branch April 24, 2024 18:28
Comment on lines -98 to 99
public static final Pattern PATTERN_LOGIN_NAME_CACHE_COUNT = Pattern.compile("\"publicGuid\":\"[^\"]+\",\"referenceCode\":\"[^\"]+\",\"id\":[0-9]+,\"username\":\"([^\"]+)\",\"dateCreated\":\"[0-9:T-]+\",\"findCount\":([0-9]+),");
public static final Pattern PATTERN_LOGIN_NAME1 = Pattern.compile(",\"referenceCode\":\"[^\"]+\",\"id\":[0-9]+,\"username\":\\s*\"(([^\\\\\\\"]*(\\\\[a-z\\\"])*)*)\\\",");
public static final Pattern PATTERN_FINDCOUNT = Pattern.compile("\"findCount\":\\s*([0-9]+)[,\\s]");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea to recognise that we are in the right place (block), but without the need for an ordered position (reference to another entry).
The block starts with window['chromeSettings'] = {, so we could use something like
window\['chromeSettings'\].*"username":\s*\"(([^\\\\\"]*(\\[a-z\"])*)*)\"
Maybe additional escapes are necessary.

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.

Username not detected (login failing) if username contains special caracters
2 participants