Skip to content

Weird ios-only SSO cookie bug #2722

Closed
@glebtv

Description

@glebtv

Submit feature requests to http://www.mattermost.org/feature-requests/. File non-security related bugs here in the following format:

Summary

Gitlab SSO does not work on iOS

Environment Information

  • Device Name: iPhone (any)
  • OS Version: 10+
  • Mattermost App Version: 1.17, master
  • Mattermost Server Version: 5.10.beta

Steps to reproduce

Seems to be happening if mattermost is using a top level domain (no www, no subdomains)

Expected behavior

Gitlab SSO works

Observed behavior

Gitlab SSO shows {"status": "ok"}

Possible fixes

I have debugged my problem down to this line:
https://github.com/joeferraro/react-native-cookies/blob/master/ios/RNCookieManagerIOS/RNCookieManagerIOS.m#L137

currentCookie.domain has "mydomain.ru", and topLevelDomain has ".mydomain.ru" with a dot in front.
If I add a dot to currentCookie.domain, like this it starts to work without any problems:

for(NSHTTPCookie *currentCookie in allCookies) {
    NSString *domainWithDot = [NSString stringWithFormat:@".%@", currentCookie.domain];
    if([currentCookie.domain containsString:topLevelDomain] || [domainWithDot containsString:topLevelDomain]) {
        [cookies setObject:currentCookie.value forKey:currentCookie.name];
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions