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

Joi.string().email() passes for foo@bar%2ecom #2685

Closed
arditshala opened this issue Oct 5, 2021 · 0 comments
Closed

Joi.string().email() passes for foo@bar%2ecom #2685

arditshala opened this issue Oct 5, 2021 · 0 comments
Assignees
Labels
bug Bug or defect dependency Update module dependency
Milestone

Comments

@arditshala
Copy link

arditshala commented Oct 5, 2021

  • is this issue currently blocking your project? (yes/no): yes
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: 12.x
  • module version with issue: ^17.4.2
  • last module version without issue: /
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

I am using the e-mail validator so Joi.string().email().required() and I am expecting this method to have the RFC for e-mails structure implemented, i.e not allowing something like foo@bar%2ecom to be passed through, I know that %2e is . but if Joi lets this through at least the the output object that Joi produces should display the email as foo@bar.com, shouldn't it?

const Joi = require('joi');

const user = Joi.object({
  email: Joi.string().email().required()
});

What was the result you got?

No failure, the e-mail was passed

What result did you expect?

Either a validation error saying the e-mail is not corrects because it contains not allowed chars or the returned object produced by Joi to have the e-mail output as foo@bar.com instead of foo@bar%2ecom

@hueniverse hueniverse self-assigned this Dec 1, 2021
@hueniverse hueniverse added bug Bug or defect dependency Update module dependency labels Dec 1, 2021
@hueniverse hueniverse added this to the 17.4.3 milestone Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect dependency Update module dependency
Projects
None yet
Development

No branches or pull requests

2 participants