Skip to main content

Package to work with SARIF files as Python objects

Project description

PySarif

This package provides a simple way to load, save, and interact with SARIF files.

The SARIF file, once loaded, can be interacted with like a normal Python object.

Nearly all of the code has been automatically generated from the SARIF JSON Schema using a modified version of Microsoft's jschema-to-python package. The modified version can be found in generator.

Quickstart

pip install pysarif

from pysarif import load_from_file, save_to_file

sarif = load_from_file("/path/to/sarif.sarif")
for rule in sarif.runs[0].tool.driver.rules:
    print(rule.name)

save_to_file(sarif, "/path/to/new/sarif.sarif")

What about existing packages?

Microsoft offers the sarif-om package. Sadly, they do not provide any way to load an existing SARIF file into their object model, nor do they provide a way to serialize the object model into a SARIF file. As such, I believe there is currently no (easy) way to work with SARIF files in Python, other than working with it as a dict.

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

pysarif-0.1.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

pysarif-0.1.0-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file pysarif-0.1.0.tar.gz.

File metadata

  • Download URL: pysarif-0.1.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pysarif-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b38c6915746d4d95f7f6cbd2f0be4a2cb6abdeabd0359ab86774c361fe3a1103
MD5 096fdbd5e192e767e4e60df6b03f5c9d
BLAKE2b-256 f4ab76c108652369e6f6ed3bf0809acbdf30d3f1f432cbeb2b4eb7863c0d5e7d

See more details on using hashes here.

File details

Details for the file pysarif-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysarif-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 47.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pysarif-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36abc3659f58dd36fdc163ee1690ee0b73a2d579a0cf13338d595cf298485e1a
MD5 dcce3b4c4c8b3b4427a2038ece637f03
BLAKE2b-256 da37591606b2dcc748e7dd17f06b8ed9545236308b77919bb776b79f9d92a56d

See more details on using hashes here.

Supported by

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