Skip to content

Joi.string().email() considers "a@a.com/asd" as valid email #2212

@klesgidis

Description

@klesgidis

Support plan

  • which support plan is this issue covered by? Community
  • is this issue currently blocking your project? yes
  • is this issue affecting a production system? yes

Context

  • node version: v10.15.0
  • module version with issue: 16.1.7
  • last module version without issue: old joi (14.3.1) (not @hapi/joi)
  • environment node
  • used with standalone

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

const schema = Joi.string().email();
schema.validate('a@a.com/asd');

What was the result you got?

{ value: 'a@a.com/asd' }

What result did you expect?

I expected to see an error here.

I believe the "/asd" information is lost here: https://github.com/hapijs/address/blob/master/lib/domain.js#L102 where you validate the host but you don't consider the pathname

Thanks in advance

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions