Socket
Book a DemoInstallSign in
Socket

pysarif

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pysarif

Package to work with SARIF files as Python objects

0.1.0
pipPyPI
Maintainers
1

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.

Keywords

sarif

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.