Skip to main content

Python OpenVEX Library

Project description

vexipy

Validate codecov OpenSSF Scorecard OpenSSF Best Practices CodeQL

py-vex logo

A Python implementation of the OpenVEX specification.

This library aims to provide a simple-to-use API for creating, validating, and modifying OpenVEX data.

Installing

python3 -m pip install vexipy

Example Usage

from vexipy import Component, Document, Statement, Vulnerability

vulnerability = Vulnerability(
    id="https://nvd.nist.gov/vuln/detail/CVE-2019-17571",
    name="CVE-2019-17571",
    description="The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.",
    aliases=[
        "GHSA-2qrg-x229-3v8q",
        "openSUSE-SU-2020:0051-1",
        "SNYK-RHEL7-LOG4J-1472071",
        "DSA-4686-1",
        "USN-4495",
        "DLA-2065-1",
    ],
)
print(vulnerability.to_json())

document = Document.from_json(
    """
    {
        "@context": "https://openvex.dev/ns/v0.2.0",
        "@id": "https://openvex.dev/docs/example/vex-9fb3463de1b57",
        "author": "Wolfi J Inkinson",
        "role": "Document Creator",
        "timestamp": "2023-01-08T18:02:03.647787998-06:00",
        "version": "1",
        "statements": [
            {
            "vulnerability": {
                "name": "CVE-2014-123456"
            },
            "products": [
                {"@id": "pkg:apk/distro/git@2.39.0-r1?arch=armv7"},
                {"@id": "pkg:apk/distro/git@2.39.0-r1?arch=x86_64"}
            ],
            "status": "fixed"
            }
        ]
    }
    """
)

statement = Statement(
    vulnerability=Vulnerability(name="CVE-2014-123456"),
    status="fixed",
)

component = Component(
    identifiers={"purl": "pkg:deb/debian/curl@7.50.3-1?arch=i386&distro=jessie"},
    hashes={"md5": "a2eec1a40a5315b1e2ff273aa747504b"},
)

statement = statement.update(products=[component])

document = document.append_statements(statement)

Contributing

We welcome contributions to this project! To contribute, please follow these guidelines:

How to Contribute

  1. Fork the repository - Create a fork of this repository to your GitHub account
  2. Create a feature branch - Make your changes in a new branch off of main
  3. Make your changes - Implement your feature or bug fix
  4. Submit a Pull Request - Open a PR from your fork's branch to our main branch

Requirements

Code Quality Standards

  • Tests must pass - All existing tests must continue to pass
  • Test coverage - New code is expected to include appropriate test coverage
  • PEP standards - Code must follow Python Enhancement Proposal (PEP) standards
  • Linting and formatting - Code must pass all linting and formatting checks

Development Tools

Before submitting a PR, please run the following tools locally:

# Format code
ruff format .

# Check for linting issues
ruff check .

# Sort imports
isort .

# Type checking
mypy .

These tools are enforced by CI and your PR will not be merged if any checks fail.

Signed-off-by Line

All commits must include a Signed-off-by line. This certifies that you have the right to submit the code under the project's license and agrees to the Developer Certificate of Origin (DCO).

To add a signed-off-by line to your commit, use the -s flag:

git commit -s -m "Your commit message"

This will automatically add a line like:

Signed-off-by: Your Name <your.email@example.com>

Pull Request Process

  • Ensure your PR has a clear title and description
  • Reference any related issues in your PR description
  • Make sure all commits in your PR include the signed-off-by line
  • Verify that all tests pass and code meets quality standards
  • Run all development tools locally before submitting
  • Be prepared to address feedback and make changes if requested

Questions?

If you have questions about contributing, please open an issue or reach out to the maintainers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vexipy-0.3.0.tar.gz (406.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vexipy-0.3.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file vexipy-0.3.0.tar.gz.

File metadata

  • Download URL: vexipy-0.3.0.tar.gz
  • Upload date:
  • Size: 406.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vexipy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7594d02a3d452daa1f1de8943c2bb7973997f639f9f9cbcb1cee33e55bd51512
MD5 4e8277d8d3a502064074514b19a07c5d
BLAKE2b-256 7166192a72f33891812530d91dbad874ff0c51417a34b8cd78cc67eea366cb20

See more details on using hashes here.

Provenance

The following attestation bundles were made for vexipy-0.3.0.tar.gz:

Publisher: publish.yaml on colin-pm/vexipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vexipy-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: vexipy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vexipy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d97afbe16cf6d74561aa705f96f534da2467048799fdc6f7389a31adbb20dd6
MD5 0cbd615d4fe23324c966248953b50252
BLAKE2b-256 c374f241c98cf9234e022091eaf149f6b536bf601e6d855909a52bf2fe1b511f

See more details on using hashes here.

Provenance

The following attestation bundles were made for vexipy-0.3.0-py3-none-any.whl:

Publisher: publish.yaml on colin-pm/vexipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page