Skip to content

invalid GUID/UUID is validated as valid #2320

@swantzter

Description

@swantzter

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): yes

Context

  • node version: v13.11.0
  • module version with issue: v17.1.1
  • last module version without issue: unknown/none
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information: Dashes are required in UUID's as per RFC 4122, page 4
        UUID                   = time-low "-" time-mid "-"
                                 time-high-and-version "-"
                                 clock-seq-and-reserved
                                 clock-seq-low "-" node
    

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

const invalidUUID = '4880367593064f4cab697d01d82b301c'

Joi.string().uuid({ version: 'uuidv4' }).validate(invalidUUID)

example with v4 but should be applicable to all

What was the result you got?

> Object {value: "4880367593064f4cab697d01d82b301c"}

What result did you expect?

> Object {error: exports.ValidationError: "value" must be a valid GUID, value: "4880367593064f4cab697d01d82b301c"}

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions