Skip to content

Edgy edge cases/bugs re: dysfunctional CLPs and Session Token generation (tested in iOS/JS/CloudCode) #1490

Closed
@DoneStuffGetting

Description

@DoneStuffGetting

Parse v2.2.6

Two things I wanted to discuss:

  1. "Saving" a new PFUser behaves weirdly (iOS and JS)
  2. "signUp" has a minor security flaw or at least inconsistency (tested on iOS, with CLP locked)
  3. Session tokens created even if user isn't created (tested on iOS and JS, with CLP locked and no masterKey used)

Re: "saving" new PFUsers

When saving a new PFUser on iOS, the SDK(?) throws this error:

Caught "NSInternalInconsistencyException" with reason "User cannot be saved unless they are already signed up. Call signUp first."

When saving a new PFUser via Cloud Code, it does not throw that error but simply mimics a "signUp", which creates a session token for the server... in Cloud Code! (actually, read #3 as this may be a bug with the pfuser handling)

For sake of flexibility and consistency (with PFObjects), I think there should be an option to "save" a PFUser without having a session token created, or restricting (iOS) apps to always use PFUser.signUp. There are many use-cases for such a feature, and I feel that it is a meaningless restriction.

Personal use-case: I have some special logic to replace the standard "signUp" flow, which has me creating a PFUser via Cloud Code + MasterKey. But with how the "save" function is behaving, it's creating a session token for the server!

Re: "signUp" security flaw with table fully locked down

With the CLP's fully locked down (no public read/write/field addition), attempts to signUp with an existing username throws this error (what you'd expect if the User table had public read permission):

Optional(Error Domain=Parse Code=202 "Account already exists for this username" UserInfo={code=202, temporary=0, error=Account already exists for this username, NSLocalizedDescription=Account already exists for this username})

When trying to signUp with a new username (same CLP settings -> locked), then the normal response is given:

[Error]: Permission denied for this action. (Code: 101, Version: 1.13.0)
Optional(Error Domain=Parse Code=101 "Permission denied for this action." UserInfo={code=101, temporary=0, error=Permission denied for this action., NSLocalizedDescription=Permission denied for this action.})

For security reasons, "permission denied" should be sent if the CLP doesn't allow for it, instead of telling someone (who is probably not working in your scope of the app) valuable information.

Re: Session Tokens out of control

Steps to reproduce (in iOS SDK or Cloud Code):

  1. Lockdown User table (and session table if you want.. doesn't change outcome) in Server v2.2.6 Dashboard v1.0.8
  2. In iOS or Cloud Code, try to sign a new PFUser up (in Cloud Code, you can use .signUp or .save)
  3. Get error response
  4. Check dashboard
  5. See a new session token

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