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

Cannot create role with : in name #1480

Closed
4 tasks done
dblythy opened this issue May 17, 2022 · 6 comments · Fixed by #1481
Closed
4 tasks done

Cannot create role with : in name #1480

dblythy opened this issue May 17, 2022 · 6 comments · Fixed by #1481
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@dblythy
Copy link
Member

dblythy commented May 17, 2022

New Issue Checklist

Issue Description

When creating a new role, using : in the string prevents "name" from being set. I am not sure why this is.

Steps to reproduce

await new Parse.Role(Test:Test, new Parse.ACL()).save(null, {useMasterKey: true});

Actual Outcome

Error: name is required.

Expected Outcome

Role to save

Environment

Server

  • Parse Server version: FILL_THIS_OUT
  • Operating system: FILL_THIS_OUT
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): FILL_THIS_OUT

Database

  • System (MongoDB or Postgres): FILL_THIS_OUT
  • Database version: FILL_THIS_OUT
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): FILL_THIS_OUT

Client

  • Parse JS SDK version: FILL_THIS_OUT

Logs

@parse-github-assistant
Copy link

parse-github-assistant bot commented May 17, 2022

Thanks for opening this issue!

  • ❌ Please fill out all fields with a placeholder FILL_THIS_OUT, otherwise your issue will be closed. If a field does not apply to the issue, fill in n/a.

@dblythy dblythy changed the title Cannot create role with : in text Cannot create role with : in name May 17, 2022
@cbaker6
Copy link

cbaker6 commented May 17, 2022

Does the server allow a : in the role name? The error in the code in this SDK says it limits the characters on purpose:

if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
return new ParseError(
ParseError.OTHER_CAUSE,
"A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.'
);

I remember the other SDKs having similar code when I was adding Role to the Swift SDK:

@dblythy
Copy link
Member Author

dblythy commented May 17, 2022

It doesn't allow it, trying to set an invalid key as a role name simply results in the name being unset, which causes Error: name is required

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label May 17, 2022
@mtrezza
Copy link
Member

mtrezza commented May 17, 2022

trying to set an invalid key as a role name simply results in the name being unset

Could you elaborate on this?

@dblythy
Copy link
Member Author

dblythy commented May 17, 2022

Yes, the following code:

await new Parse.Role(':%#', new Parse.ACL()).save()

rejects on the server side with "Error: name is required"

Where it should reject on the client side with "invalid role name"

@mtrezza
Copy link
Member

mtrezza commented May 17, 2022

Got it, so the solution will still deny roles names with colon.

@mtrezza mtrezza linked a pull request May 24, 2022 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants