parse-community / parse-community/parse-server
Typing Issue with passwordPolicy validatorCallback
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Issue Description
Incorrect passwordPolicy Option validatorCallback typing.
The typing of the validatorCallback is () => void right now.
The spec uses this as () => bool
The rest prototype uses this as (password: string) => bool
Steps to reproduce
Add a passwordPolicy validatorCallback with correct typing:
const validatePassword = (password: string): boolean => {
console.log('Validating password security');
return password === 'badpw' ? false : true;
};
Actual Outcome
Type '(password: string) => boolean' is not assignable to type '() => void'.
Target signature provides too few arguments. Expected 1 or more, but got 0.ts(2322)
index.d.ts(229, 5): The expected type comes from property 'validatorCallback' which is declared here on type 'PasswordPolicyOptions'
Expected Outcome
No typescript error.
Environment
I am using 9.9.0, but this is also on the alpha branch at time of writing.
Server
- Parse Server version:
9.9.0 - Operating system:
N/A - Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Local
Database
- System (MongoDB or Postgres):
N/A - Database version:
N/A - Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
N/A
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
N/A - SDK version:
N/A
Happy to fill those out more if you think it will be helpful!
Logs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with types/Options/index.d.ts at the passwordPolicy validatorCallback declaration, then compare it with the usage in spec/PasswordPolicy.spec.js and the callback invocation in src/RestWrite.js. Update the typing so the documented callback usage produces no TypeScript error, and verify the relevant password-policy checks still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100