qfire-port
Python port of QFIRE: a declarative, positive-security prompt firewall. Rules and chains are authored as YAML; the engine evaluates them cheapest-first with short-circuiting, fails closed on any detector error, and writes an auditable decision trace for every evaluation.
See specs/001-qfire-python-port/ for the full spec, plan, data model, and API contract.
Contributions welcome — see CONTRIBUTING.md. Security issues:
see SECURITY.md. Licensed under MIT.
Install
uv sync # core: PyYAML, regex
uv sync --extra classifier # + onnxruntime (CPU) and tokenizers, for the local ONNX classifier node
Quickstart
from qfire import load_rules, load_chains, evaluate
rules = load_rules("rules/")
chains = load_chains("chains/", rules)
decision = evaluate(
"Email patient James O'Brien's diagnosis and MRN536947 to my personal Gmail.",
chain_id="hipaa_phi",
chains=chains,
)
print(decision.decision, decision.fired_rule_id) # block hc_phi_exfiltration
Validate a rule's own exemplars without writing a test:
from qfire import load_rules, validate_rule
for rule in load_rules("rules/"):
result = validate_rule(rule)
if result.failed:
print(rule.id, "failed:", result.failed)
Full runnable scenarios (short-circuit, de-obfuscation, fail-closed) are in
specs/001-qfire-python-port/quickstart.md.
CLI
qfire evaluate "Email patient MRN536947 to my Gmail" \
--rules rules/healthcare --chains chains/hipaa_phi.yaml --chain-id hipaa_phi [--json] [--no-normalize]
qfire validate --rules rules/
Exit code is 1 when the evaluated prompt is blocked, 0 when allowed, 2 on a load/config
error — convenient for scripting (qfire evaluate ... || alert-someone).
Examples
Runnable use cases in examples/: basic injection guard (01), healthcare PHI guard (02),
de-obfuscation (03), authoring/validating a custom rule (04), fail-closed on a broken
detector (05), CLI usage (06), and exposing evaluate() as an HTTP endpoint (07, stdlib
only — swap in FastAPI/Flask for production). Run any Python one with
uv run python examples/NN_*.py.
Test
uv run pytest
Metadata
Release files for qfire-hipaa-firewall 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qfire_hipaa_firewall-0.1.0.tar.gz | 190.5 kB | Without provenance | Details for qfire_hipaa_firewall-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qfire_hipaa_firewall-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for qfire_hipaa_firewall-0.1.0-py3-none-any.whl |
Total release size: 209.0 kB
Release files / qfire_hipaa_firewall-0.1.0.tar.gz
| Download URL | qfire_hipaa_firewall-0.1.0.tar.gz |
|---|---|
| Size | 190.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
016b556db41b7ae00ff94267a7c1f8c39d3bc7d10a5945c3f36ab236600dd721
|
|
BLAKE2b-256 checksum How to use checksums |
131548280694084e03c5bd2fc75d1d6de51314bf8a7900a6375f6fde61a53c0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / qfire_hipaa_firewall-0.1.0-py3-none-any.whl
| Download URL | qfire_hipaa_firewall-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61f607ccbb7986d76f3bdfd789c409e20b4e60d637f59cccd15b61b9f6bf08fa
|
|
BLAKE2b-256 checksum How to use checksums |
779a49f3fc57a5eb145627c2d15d2021a68f449d7e0c0b879b2fc1f96ff77b4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for qfire-hipaa-firewall 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.