Skip to content

Add support for regex string for password policy validatorPattern setting #3331

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

Merged
merged 1 commit into from
Jan 8, 2017
Merged

Add support for regex string for password policy validatorPattern setting #3331

merged 1 commit into from
Jan 8, 2017

Conversation

bhaskaryasa
Copy link
Contributor

fixes issue #3302

@acinader
Copy link
Contributor

acinader commented Jan 7, 2017

@bhaskaryasa this looks good to me. one question, if you supply a bad regex string like say: \xx

what happens? I'd think that you'd want the server to not start and make sure that you get a decent error message or stack trace so it is obvious what is causing the failure?

what do you think?

@livingstonef
Copy link

@bhaskaryasa This is good! Particularly thorny issue if you are using the parse-server lib directly (i.e $ parse-server /path-to-config.json). It is basically impossible to supply either a validation callback or pure regex. this fixes the regex bit. still don't think you can pass a callback in the currently documented way.

@acinader before this fix, if you submit a regex string it fails JSON validation with "unexpected token..."

@flovilmart
Copy link
Contributor

@livingstonef you can provide a 'js' config file as well, as it's loaded through a require call :)

@bhaskaryasa
Copy link
Contributor Author

@acinader - I believe JSON parsing itself would fail if you passed something like '\xx'. That should cause the Parse Server startup failure with the exception logged.

@bhaskaryasa
Copy link
Contributor Author

@flovilmart - I did not know that was possible!! Nice 👍

@acinader
Copy link
Contributor

acinader commented Jan 8, 2017

@bhaskaryasa yeah, that'd be my guess to. Can you please verify that the server doesn't start and that the error doesn't get eaten somehow?

@bhaskaryasa
Copy link
Contributor Author

@acinader - Yes, tested. Startup fails with SyntaxError: Unexpected token x in JSON at position 202.
I think we are good.

@dkarviga
Copy link

dkarviga commented Jan 9, 2017

@flovilmart could you please provide an example of js file that can be used for initialization of parse-server?

@flovilmart
Copy link
Contributor

flovilmart commented Jan 9, 2017

// config.js
module.exports = {
  appId: "hello",
  masterKey: "world"
  /* more options */
}

$ parse-server ./config.js

@dkarviga
Copy link

dkarviga commented Jan 9, 2017

@flovilmart thanks!

@bhaskaryasa bhaskaryasa deleted the password-regex-string branch January 9, 2017 16:43
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.

6 participants