Skip to main content

QSHIELD

Security checks for quantum circuits and the software that ships them.

PyPI version Python versions License: Apache 2.0

Workbench · Changelog

What it does

You write a quantum program. Something changes before it runs — a gate is swapped, a measurement is flipped, a dependency is tampered with. QSHIELD looks for that, and tells you where.

It reads a circuit, checks it, and gives you a report you can act on. It runs on your own machine.

Install

pip install qshield

Optional extras, only if you need them:

Extra Adds
qshield[qiskit,cirq] Parsers for Qiskit and Cirq
qshield[braket] Amazon Braket circuits
qshield[pytket] pytket circuits
qshield[formal] PyZX and Z3 verification
qshield[plugins] Sandboxed detector plugins

Python 3.10 or later.

Try it

qshield scan circuit.qasm                  # check one file
qshield scan . --recursive --format sarif  # check a whole project
qshield compare original.qasm candidate.qasm   # are these two the same circuit?
qshield ui                                 # open the browser Workbench

In Python:

import qshield

results = qshield.scan("circuit.qasm")
print(results.is_clean)

How it works

QSHIELD architecture

You give it a circuit, a model, or a list of dependencies. It runs five checks. You get findings you can put in a ticket, wire into CI, or read yourself.

The one check that needs extra setup

Most checks work out of the box. One does not.

Readout checks need something to compare against. A gate right before a measurement is normal — Deutsch's algorithm does it, and so does Bernstein–Vazirani. So "there is a gate before the measurement" tells you nothing on its own. You need to know what was approved.

QSHIELD compares your circuit against a reference you signed off earlier. If you haven't set one up, it says not checked rather than fine — because those are different answers.

# 1. Record what you approved, then sign it
qshield provenance keygen --private-key priv.pem --public-key pub.pem
qshield baseline create approved.qasm --workload my-circuit --approved-by you@example.com -o bl.json
qshield baseline sign bl.json --private-key priv.pem

# 2. Check a candidate against it (exit code 1 if the readout changed)
qshield baseline scan new.qasm -b bl.json -c approved.qasm \
    --public-key pub.pem --workload my-circuit

Without the --no-passphrase flag, step 1 asks you to choose a passphrase. Add --no-passphrase for scripts and CI.

Workbench

qshield ui opens a local web page. Pick a circuit file, click Scan, read the results. Nothing is uploaded.

Run-time protection

The runtime proxy sits between your code and a cloud quantum provider. It logs every call to a tamper-evident chain, so you can prove afterwards what was sent and when.

qshield runtime proxy --upstream https://provider.example/api \
  --audit-chain /var/log/qshield/audit.jsonl
qshield runtime audit-verify /var/log/qshield/audit.jsonl

Annealer models

If you submit a QUBO or Ising model to a solver rather than a circuit, qshield audit-qubo checks it first:

qshield audit-qubo model.qubo --expected-digest <hex>

The digest covers every coefficient at full precision. If someone edits the model after you approved it, the digest changes — even for an edit too small for a solver to notice.

Contextuality

qshield contextuality checks whether a circuit really produces a non-classical result. Useful when you need to show it is not secretly doing something classical.

Development

git clone https://github.com/katepallewarprathmesh-sketch/QShield
cd QShield
pip install -e '.[dev]'
./scripts/verify.sh          # runs everything CI runs

./scripts/verify.sh --fast skips the benchmark for a quicker loop.

More

Metadata

Release files for qshield 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qshield 1.7.0
File Size Uploaded Provenance Actions
qshield-1.7.0.tar.gz 457.9 kB With provenance Details for qshield-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qshield 1.7.0
File Interpreter ABI Platform Actions
qshield-1.7.0-py3-none-any.whl Python 3 none any Details for qshield-1.7.0-py3-none-any.whl

Total release size: 853.9 kB

Release files / qshield-1.7.0.tar.gz

Download URL qshield-1.7.0.tar.gz
Size 457.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1f42f482b226481656c817362de648b8c6ff109031bed233ca320432ca5cf231
BLAKE2b-256 checksum
How to use checksums
addd3d8abaa13ebfae667205feb2b963f3f4090de83fb435cd2b75a7b11d0fda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / qshield-1.7.0-py3-none-any.whl

Download URL qshield-1.7.0-py3-none-any.whl
Size 396.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f0c354a076d390edb75d220eb3371858fc402fa27232074de24ab2547834fe9
BLAKE2b-256 checksum
How to use checksums
8a6083c4309aa0d158836b8b566ef55e171788e194934fc34ce6081bb97205a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for qshield 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qshield-1.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page