Skip to content

invalid mime types on data uri #1607

@yonjah

Description

@yonjah

Context

  • node version: 10
  • joi version: 13.7.0
  • environment (node, browser): node
  • used with (hapi, standalone, ...): standalone Fuzzing

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

When running through random generated examples on Joi I noticed the following will fail validation

const Joi  = require('joi');
const schema = Joi.string().dataUri();

console.log('text/x-script.phyton', schema.validate('data:text/x-script.phyton;charset=utf-8,some test here'));
console.log('text/x-script', schema.validate('data:text/x-script;charset=utf-8,some test here'));
console.log('text/script', schema.validate('data:text/script;charset=utf-8,some test here'));

Which result you had ?

Both text/x-script and text/x-script.phyton fail to be parsed as valid mime types and validation failed

What did you expect ?

since all mime types used are valid ones I expect all validations to pass.

Not sure if this is a major issue since it's probably never used and it might be better to only allow very simple mime types. But it might make sense to mention this limitation in the documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug or defect

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions