Giter Club home page Giter Club logo

ajv-formats-draft2019's People

Contributors

carlo-quinonez avatar dependabot[bot] avatar fadysalama avatar fluffywaffles avatar luzlab avatar nichtich avatar zo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ajv-formats-draft2019's Issues

typescript declarations

It would be nice if this package had typescript types so that I could use it more easily in my typescript project (and have the typescript compiler check that I'm using it correctly).

I'm also using ajv-formats, which does include a index.d.ts in the package.

Bundle uuid from ajv-formats

AJV removed uuid from the stock distribution. This library should include the formatter for uuid since it's a part of the draft2019 spec.

Email IRIs are not valid `iri-reference`

The following simple script does not work:

const Ajv = require('ajv');
const apply = require('ajv-formats-draft2019');
const ajv = new Ajv();
apply(ajv); // returns ajv instance, allowing chaining

let schema = {
  type: 'string',
  format: 'iri-reference'
};
let result = ajv.validate(schema, 'mailto:[email protected]');

console.log (result)

With @FadySalama, we have dug deeper into the issue and find the following problems:

iri-reference generated by CycloneDX invalid?

Hi,

sorry to open another one about the scheme validation.
We're generating our bill of material with CycloneDX. The generated json files contain repository links that look like this:
{ "type": "vcs", "url": "git+https://github.com/Alex-D/check-disk-space.git" }
or
{ "type": "vcs", "url": "git+ssh://[email protected]/estools/escodegen.git" }

The validation of the json (using ajv) against the schema (also provided by CycloneDX) fails with dozens of errors:

{
    instancePath: '/components/1/externalReferences/2/url',
    schemaPath: '#/properties/url/format',
    keyword: 'format',
    params: { format: 'iri-reference' },
    message: 'must match format "iri-reference"'
}

According to your comment in #11 the strange git+ scheme seems to be valid but not in any of the lists you're validating against.
I honestly don't know where these references come from, but apparently they seem to be in a few package.json files on github (e.g. https://github.com/Alex-D/check-disk-space/blob/main/package.json)
I can work around the problem by wrapping the format validator and cutting off the git+ prefix, but that's not how it should be.

const validate = ajv.formats['iri-reference'] as FormatValidator<string>;
ajv.formats['iri-reference'] = (value) => {
   if (value && value.startsWith('git+')) {
     value = value.substring(4);
   }
   return validate(value);
};

What's your opinion on this?
Are git+https or git+ssh valid schemes or not?
Can they be supported?

Failing test on Node 10

After merging the smtp-address-parser PR, the tests failed on Node 10.

@gene-hightower Can you please fix this in your module? Otherwise, I'm going to revert the changes. Sorry I should have setup the GH action to run the tests BEFORE I merged the PR...

iri-reference should not check for URI schemes

The IETF specification does not specify that the URI scheme in an iri should be checked. After quickly checking with the JSON Schema community, this seems to be a bug. Why was this implemented explicitly and can it be simply removed?

同学,您这个项目引入了94个开源组件,存在1个漏洞,辛苦升级一下

检测到 luzlab/ajv-formats-draft2019 一共引入了94个开源组件,存在1个漏洞

漏洞标题:ansi-regex 安全漏洞
缺陷组件:[email protected]
漏洞编号:CVE-2021-3807
漏洞描述:Ansi-Regex是用于匹配ANSI 转义码的正则表达式。
ansi-regex 存在安全漏洞,该漏洞源于易受低效正则表达式复杂性的影响。
影响范围:(2.1.1, 5.0.1)
最小修复版本:5.0.1
缺陷组件引入路径:[email protected]>[email protected]>[email protected]>[email protected]>[email protected]>[email protected]
[email protected]>[email protected]>[email protected]>[email protected]>[email protected]>[email protected]
[email protected]>[email protected]>[email protected]>[email protected]>[email protected]>[email protected]

另外还有几个漏洞,详细报告:https://mofeisec.com/jr?p=i0adfd

S3 and other IRI

I have a valid S3 bucket URI: s3://cbers-pds/CBERS4/MUX/177/106/CBERS_4_MUX_20181029_177_106_L4/CBERS_4_MUX_20181029_177_106_L4_BAND5.tif

Unfortunately, it is rejected by this library.

I guess it's due to the fact that schemes on npm is outdated. Is there a way to disabled the schemes check?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.