Giter Club home page Giter Club logo

cpe-rs's People

Contributors

kendjohnson avatar lceleste-tenable avatar voteblake avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

cpe-rs's Issues

Parse CPE 2.3 spec

This library implements the CPE 2.2 spec, which was released in 2009. The CPE 2.3 spec was released in 2011: https://cpe.mitre.org/specification/. It would be great if the library defined types for parsing the 2.3 spec - namely for parsing formatted string binding such as cpe:2.3:a:gnu:bash:4.0:*:*:*:*:*:*:*. CPE 2.3 is backwards compatible with parsing WFN and URI in CPE 2.2 format.

Missing ':' delimiter when using "zero pad" flag

When using the zero pad flag ({cpe:0}) not only the value, but also the : is being omitted.

Which might lead to fields being shifted. For example:

    #[test]
    fn test_zero() {
        use cpe::cpe::Cpe;

        let original = "cpe:/a:foo:bar:1.2::x";
        let parsed = OwnedUri::from_str(original).unwrap();

        let formatted = format!("{parsed:0}");
        let reparsed = OwnedUri::from_str(&formatted).unwrap();

        assert_eq!(parsed.part(), reparsed.part());
        assert_eq!(parsed.vendor(), reparsed.vendor());
        assert_eq!(parsed.product(), reparsed.product());
        assert_eq!(parsed.version(), reparsed.version());
        assert_eq!(parsed.update(), reparsed.update());
        assert_eq!(parsed.edition(), reparsed.edition());
    }

The test will fail for:

assert_eq!(parsed.update(), reparsed.update());

With:

assertion `left == right` failed
  left: Any
 right: Value("x")

Left:  Any
Right: Value("x")

As the value shifted:

  • Original: cpe:/a:foo:bar:1.2::x
  • Formatted: cpe:/a:foo:bar:1.2:x

Failing to parse `*` or `ANY` correctly

It looks to make like a CPE containing * or ANY fails to parse correctly.

* gets rejected, despite this being printed out with the "alternate" format.
ANY gets translated into Component::Value("ANY").
And `` (empty) gets translated into Component::Any. But fails for the `Language`.

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.