/tiran-skills:crypto-fips-auditfrom tiran-skills
Audits Python packages and bundled C/C++/Go/Rust code for cryptography usage, weak crypto, and FIPS 140-3 compliance. Flags insecure primitives, non-approved algorithms, vendored crypto libraries, and problematic dependencies.
Ships in tiran-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Status: Beta. Grounded in the sources below (NIST FIPS/SP, Red Hat/Fedora crypto-policy docs, Go/Rust/PyPI docs) and the reference scanner, and applied to real cases — but crypto policy moves fast, so verify findings against the cited sources and treat this as an assessment aid, not an authority.
It gathers evidence and assesses risk; it does not certify FIPS compliance. Only a NIST CMVP validation makes a module validated. This skill tells you where a package is likely to break on a FIPS-enforcing host or use non-approved crypto; report findings as evidence, never as a pass/fail certification.
Throughout, "FIPS" means FIPS 140-3 and the related NIST standards (FIPS
180-4, 186-5, 197, 198-1, 202, 203–205, SP 800 series); reference/fips-primer.md
maps them.
Scope to the one you need (step 1); each builds on the one before it:
scripts/scan_crypto.py, reference/binary-inspection.md); stop here
for a crypto-agility / CBOM inventory. No verdicts. Not crypto use: merely
calling an HTTP client (requests/httpx/urllib) for an HTTPS request with
default settings — the crypto lives in that library and the system OpenSSL, not
this package. Count it only when the package changes crypto behaviour (custom
SSLContext, verify=False, set_ciphers, pinned TLS version, its own cipher/
curve list, ctypes crypto loads, or it ships/calls crypto directly). The same
guard covers native client bindings (DB/queue/auth: pycurl, psycopg2,
pyzmq, grpcio, gssapi, …) — a default connection isn't the package's
crypto, but a bundled crypto copy, a TLS/cipher/enctype override, or an
inherently non-approved primitive (pyzmq CURVE, grpcio's BoringSSL) is
(reference/python-audit.md → "Native client libraries pull crypto in").random for
secrets, timing-unsafe compares, disabled TLS verification, weak keys. Run a
linter first (step 3); finding class 3 below. Dedicated lens:
reference/weak-crypto.md.The finding-class taxonomy (next) is the reporting side of these three questions.
This skill is the manual, source-first counterpart to
wheel-crypto-scan by Emilien
Macchi (Red Hat, Apache-2.0) — a deterministic tool that gathers crypto evidence
from built wheels and applies a FIPS-lensed ruleset. Step 5 recommends running it;
the manual techniques here let you audit without it and interpret what it reports.
Credit it when you use its output. Docs: https://my1.fr/wheel-crypto-scan/.
Scope of authority: use the tool and its docs for evidence-gathering mechanics (how to read a wheel/binary), not as an authority on FIPS policy — for what is approved, what "validated" means, key sizes, and transitions, the primary sources below win.
Guardrails. Read
../GUARDRAILS.mdand follow it unless the user says otherwise: work in a project-local.venvwith uv; ask before installing heavy packages or building (a from-sourcecryptographyor a CUDA/torch dep is multi-hundred-MB to multi-GB); don't delete content or commit/push without approval (never straight tomain); keep prose terse.
Report these as distinct categories; conflating them overstates FIPS-140 risk:
/etc/crypto-policies. These weaken
central policy control but are not FIPS-140 algorithm violations. Flag
them clearly as their own class.random for secrets, == on secrets instead of
hmac.compare_digest. These pass a FIPS algorithm check but are still real
vulnerabilities — raise them even on a FIPS host. reference/weak-crypto.md.Provenance flips the verdict — the same package differs by build, across three axes:
cryptography PyPI wheels bundle a static OpenSSL; a
distro rebuild (RHEL/Fedora python-cryptography) or from-source build links the
system OpenSSL and can pick up the FIPS provider.ca-certificates/python-certifi is often patched
to read the OS trust store instead of the bundled Mozilla set._md5/_sha1/…)
beside the OpenSSL-backed _hashlib. Fedora/RHEL build it so OpenSSL wins and the
built-ins honor FIPS; vanilla builds (python.org, pyenv, many conda/manylinux) can
satisfy hashlib.md5() from the bundled code and silently bypass FIPS. So a
hashlib verdict depends on which interpreter runs it. reference/python-audit.md.So state which artifact you judged (build, CA bundle, interpreter); note that a distro/from-source build may resolve a bundled-crypto/CA/hash finding, and don't fail a package whose shipped-in-this-environment build links the system provider.
Confirm with the user, and record in the report:
reference/native-crypto.md.Run the prior-work check in ../GUARDRAILS.md (has this
been audited/tracked upstream?). Then inventory what the package actually contains:
# Languages and compiled objects present
find . -name '*.py' | head; find . \( -name '*.so' -o -name '*.pyd' -o -name '*.dylib' \)
find . -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.rs' -o -name '*.go'
# Declared dependencies — cross-check against the problematic list
grep -REn 'dependencies|install_requires|requires-dist' pyproject.toml setup.cfg setup.py 2>/dev/null
Note whether it is pure-Python (steps 3, 6–8 apply; skip binary steps) or
ships compiled extensions (all steps apply). Cross-check declared deps against
the problematic-package table in reference/python-audit.md.
Don't flag crypto in test code. Test suites deliberately use weak/known-bad values
(negative tests, known-answer vectors — e.g. MD5, a static IV, an expired cert — to
prove a failure path). Audit shipped/runtime code; treat tests/, conftest.py,
fixtures, and examples/ as out of scope unless that code is actually imported at
runtime or ships in the wheel.
Grep and read the Python source. Full behavior, the per-package table, and the
usedforsecurity nuance are in reference/python-audit.md; the algorithm
verdicts are in reference/fips-primer.md; the weak-crypto class (use case 2) —
insecure use, greps, and linters — is in reference/weak-crypto.md. For a fast first
pass run a crypto-aware linter — uvx ruff check --select S . (preferred; add
semgrep --config p/crypto for RSA-padding/IV gaps) — then read the hits. A linter
finds weak crypto but cannot decide FIPS approval (strong-but-non-approved
primitives stay silent); that judgement is the steps below. Look for:
grep -REn 'hashlib\.(md5|sha1|new)|usedforsecurity' . # weak/ambiguous hashing
grep -REn 'set_ciphers|PROTOCOL_TLS|TLSVersion|OP_NO_TLS|minimum_version' . # TLS policy overrides
grep -REn '\brandom\.|SystemRandom|secrets\.' . # RNG: random ≠ CSPRNG
grep -REn 'ctypes.*(crypto|ssl|sodium|nacl)' . # crypto loaded by name at runtime
grep -REn 'modes\.ECB|MODE_ECB|PKCS1v15|import rsa\b|divmod' . # insecure use of an approved primitive
hashlib.md5(...)/sha1(...)/new("md5"...) without
usedforsecurity=False in a security context is a finding (md5 is
refused; sha1 is restricted). md4/ripemd160/sm3/whirlpool are
refused unconditionally. usedforsecurity=False is necessary but not always
sufficient — a strict approved-only OpenSSL can still reject it. Whether the
call is even enforced depends on the interpreter build: a distro (RHEL/
Fedora) CPython routes to OpenSSL, while a vanilla build may satisfy it from
CPython's bundled HACL* code and bypass FIPS. reference/python-audit.md.SSLContext
with manual tightening overrides system crypto-policies → step 7 /
system-integration class. Prefer ssl.create_default_context().random (Mersenne Twister) for keys/tokens/nonces is a finding; use
secrets/os.urandom.modes.ECB/MODE_ECB), RSA
PKCS#1 v1.5 encryption (PKCS1v15, Bleichenbacher/Marvin — use OAEP/PSS),
hand-rolled RSA/modexp (import rsa, pow(m,e,n), divmod), static/reused
IVs and nonces, and == on secrets (use hmac.compare_digest). Approved
algorithm, broken use → weak-crypto class. reference/fips-primer.md.cryptography
(pyca) — high-level hazmat primitives + safe recipes; see the table for its
provenance nuance (PyPI wheel bundles a static OpenSSL; a distro rebuild links
the system provider).Only if the package ships native code. Per-language build-flag guidance is in
reference/native-crypto.md. The rule across all three: use the system
validated provider; do not vendor, statically link, or self-compile crypto.
reference/native-crypto.md): for NSS/GnuTLS the validated boundary is a
low-level lib (softokn/freebl; nettle/hogweed), and libgcrypt's
validation is per-RHEL-version.GOFIPS140=…,
GODEBUG=fips140=on, its own CMVP cert #5247) — pure Go, no cgo. Older RHEL/
OpenShift: the OpenSSL bridge (CGO_ENABLED=1, dynamic link, no no_openssl
tag, strictfipsruntime). So CGO is required for the bridge but not the native
module — don't blanket-enforce it. reference/native-crypto.md → "Go" has the
exact per-version decision tree; Red Hat's check-payload
automates it (step 5).ring and default rustls are not FIPS; FIPS needs the
aws-lc-rs provider with --features=fips. Flag the openssl-sys vendored
feature (set OPENSSL_NO_VENDOR=1), webpki-roots diverging from the OS trust
store, and a doubled aws-lc-sys + aws-lc-fips-sys.Source review misses vendored/statically compiled-in crypto — the most
important case (cryptography's PyPI wheels compile OpenSSL straight into the extension).
Inspect the actual binaries. Commands, the system/bundled/static/unknown/opaque
posture model, and its limits are in reference/binary-inspection.md. The CLI
tools below are host-native; to inspect a foreign arch/OS wheel (a macOS
.dylib or Windows .pyd from a Linux box), use the portable pure-Python
(pyelftools/macholib/pefile) uv run reader in that reference instead.
readelf -d libfoo.so | grep NEEDED # linked from system libcrypto.so? or a mangled/bundled copy?
nm -D libfoo.so | grep -E 'EVP_|SSL_|PK11_|NSS_|gnutls_|gcry_|nettle_|ring_|sodium_' # defined vs imported (U)
strings -a libfoo.so | grep -Ei 'OpenSSL [0-9]|OPENSSLDIR|BoringSSL|AWS-LC|GnuTLS|Libgcrypt|NSS ' # banner ⇒ copy
go version -m ./bin # Go module list + GOFIPS140/tags/CGO_ENABLED
Recommended: run the reference scanner for a deterministic, cross-format pass, then triage its JSONL:
uvx wheel-crypto-scan scan dist/*.whl -o index.jsonl # or: uv tool install wheel-crypto-scan
uvx wheel-crypto-scan scan dist/ --jobs 8 -o index.jsonl # many wheels, in parallel
uvx wheel-crypto-scan scan --index-url https://pypi.org/simple/ foo -o index.jsonl # bulk from an index
uvx wheel-crypto-scan scan dist/*.whl --format html -o report.html # DataTables report for a human hand-off
uvx wheel-crypto-scan rules # print the encoded ruleset (study it, step "Reference scanner")
uvx wheel-crypto-scan schema # JSON Schema for the records below (authoritative field names)
# Per-wheel crypto inventory (families + libraries with linkage) — use case 1:
jq -r '.wheel.filename, (.crypto.families[]?), (.crypto.libraries[]? | " \(.name): \(.linkage)")' index.jsonl
# Triage by the record's own verdict class (maps onto step 8's finding classes) and findings:
jq -r 'select(.verdict.needs_human_review) | .wheel.filename' index.jsonl
jq -r '. as $w | .verdict.classes[]? | "\($w.wheel.filename)\t\(.)"' index.jsonl # NON_APPROVED_CRYPTO / CONTEXT_DEPENDENT / …
jq -r '.wheel.filename as $f | .findings[]? | "\($f)\t\(.rule_id)\t\(.verdict)\t\(.basis|join(","))"' index.jsonl # rule + NIST basis
# Any library carrying its own crypto (conditions are keyed <library>_linkage: openssl, nss, gnutls, …):
jq -r 'select(any(.verdict.conditions|to_entries[]; (.key|endswith("_linkage")) and (.value|IN("bundled","static","mixed")))) | .wheel.filename' index.jsonl
The record carries a top-level crypto inventory (families + per-library linkage), a
verdict (class/classes + conditions + needs_human_review), and a findings[]
array citing the NIST basis behind each — read the inventory for use case 1, the
verdict/findings for 2–3 (schema prints the exact fields). Output is FIPS
compatibility evidence; deciding FIPS compliance for a deployment stays a
human call (same split this skill draws). Add --resume/cache for large runs.
A clean scan is not "no weak crypto." wheel-crypto-scan is scoped to inventory + FIPS; it defers most class-3 insecure use (AES-ECB, RSA PKCS#1 v1.5, static IV/nonce, timing-unsafe compares, HTTP-client
verify=False, legacy 3DES/RC4) to a source linter. So a clean scan does not clear the weak-crypto lens — still run the step-3 linter (ruff --select S/semgrep p/crypto) and the manual checks. Read its--format htmlreport for the hand-off.
For Go or Rust binaries, or a whole container image/payload — which
wheel-crypto-scan doesn't cover — run Red Hat's
check-payload (payload/node/
local modes). It validates the Go FIPS build regime and system-OpenSSL linkage, and
(as of PR #360) Rust binaries
too — passing only when they link the system OpenSSL FIPS provider or match an attested
module. reference/native-crypto.md → "Go"/"Rust" and reference/binary-inspection.md
→ "Related tooling" explain what it checks.
A stripped, statically linked object with no symbols is opaque — you cannot prove absence of crypto, so report it for review, never as "clean".
reference/native-crypto.md.certifi,
webpki-roots) bypass the OS trust store. Remediations: SSL_CERT_FILE/
REQUESTS_CA_BUNDLE, or truststore
(verifies against the OS trust store; the default in pip 24.2+, Python 3.10+).
Which regime governs this — and why it is not FIPS or crypto-policies but a
distro-packaging / STIG / CC concern — is in reference/trust-store.md./etc/crypto-policies centrally sets TLS
versions, ciphers, DH groups, and signature/hash algorithms across libraries.
Code that hardcodes any of these (or ships its own crypto stack) bypasses
it. Surface every hardcoded TLS version / cipher list / curve list (system-
integration class). Setting the FIPS policy is necessary but not
sufficient — true FIPS mode is the kernel fips=1 flag. To probe what a
RHEL/UBI build actually refuses in FIPS mode without a FIPS host, use the container
recipe in reference/fips-140-3-and-openssl.md (§6, a quick-test hack — not real
kernel FIPS)./etc/crypto-policies comes from the image, but the kernel
fips_enabled flag comes from the host. Podman/CRI-O bind-mount the host's FIPS
policy in (addFIPSMounts()); a stock/distroless image or plain Docker can run
non-FIPS userspace on a FIPS kernel. reference/native-crypto.md.X25519MLKEM768 hybrid is FIPS-approvable — SP 800-56C lets the
approved ML-KEM-768 go first with X25519 as the auxiliary secret, and OpenSSL 3.5
FIPS marks it fips=yes; X25519 is not a disqualifier. Caveats are policy and
provider: some strict modes still refuse it (Go fips140=only) and it needs a
validated certified ML-KEM — prefer SecP256r1MLKEM768 only there. Good non-FIPS
crypto should prefer the hybrid handshake regardless. reference/fips-primer.md.Group findings by the taxonomy, most-severe first, each with file:line evidence, the algorithm class / standard it implicates, and a remediation:
random
for secrets, non-constant-time secret comparison. Approved algorithm, broken
use — a real vulnerability independent of FIPS. Full lens: reference/weak-crypto.md.usedforsecurity=False or an
approved swap.openssl-sys, Go crypto/internal/fips140), or anything you couldn't resolve.Restate the disclaimer: this is an evidence-based risk assessment, not a compliance certification; certificate/validation status must be confirmed against the live CMVP database.
Definition of done: each shipped artifact (source and, where applicable, the built wheel/binaries) has been reviewed across Python, native code, provider/ linkage, and policy; findings are grouped by the taxonomy with file:line evidence, the implicated standard, and remediations; provenance is stated; the three finding classes are kept distinct; and the report is framed as evidence, not a pass/fail certification.
AGENTS.md (opens in a new tab)README.md (opens in a new tab)reference/binary-inspection.md (opens in a new tab)reference/fips-140-3-and-openssl.md (opens in a new tab)reference/fips-primer.md (opens in a new tab)reference/native-crypto.md (opens in a new tab)reference/python-audit.md (opens in a new tab)reference/trust-store.md (opens in a new tab)reference/weak-crypto.md (opens in a new tab)scripts/scan_crypto.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub tiran/agent-skills --plugin tiran-skills12 skills in this plugin
/bootstrap-python-projectScaffold a new Python project from zero: src/ layout, PEP 621 metadata, a chosen build backend (hatchling for pure Python; meson-python / scikit-build-core / maturin for compiled) with dynamic VCS versioning, py.typed, ruff, a type checker, pytest + coverage, tox or nox via uv, and hardened GitHub Actions CI (SHA-pinned, Trusted Publisher, CodeQL/Scorecard/Dependabot). Always writes a README, LICENSE, and .gitignore. Orchestrates the choose-python-build-backend, modernize-python-metadata, ship-type-information, and secure-python-release-pipeline skills. Use when asked to start a new package, scaffold/bootstrap a Python project, set up a repo from zero, turn a loose script into a proper package, or bring an existing project up to this standard (adopt the layout, metadata, tooling, or CI it lacks)./choose-python-build-backendRecommend the right PEP 517 build backend for a new or existing Python package, and give enough context to migrate. Chooses by three axes: purelib (pure Python) vs platlib (compiled C/C++/Rust/Torch), static vs dynamic/VCS metadata, and native language/build system. Covers uv-build, flit-core, hatchling (incl. compiled via scikit-build-core[hatchling] / a custom build hook), meson-python, scikit-build-core, maturin, and setuptools (legacy). Weighs compiled-project concerns: Cython, PyTorch extensions, pybind11/nanobind bindings, the stable Python ABI (abi3 / limited API), and fast parallel builds (CMake+Ninja, Meson). Use when asked "which build backend should I use", to pick a backend for a new project, or to decide whether to move an existing project off setuptools./modernize-python-metadataImprove a Python package's metadata and move it into a PEP 621 [project] table in pyproject.toml — filling in what's missing along the way. Covers the readme field (dropping the open().read() hack), SPDX license expressions, trove classifiers, well-known project URLs, authors/keywords/requires-python, dependency version constraints (avoid upper caps), PEP 735 dependency groups vs extras, and the build-system table. Keeps the existing build backend (setuptools is fine). Includes a Poetry → PEP 621 migration lens (the [tool.poetry] field map and caret/tilde → floor translation; PDM too). Use when asked to clean up packaging metadata, move metadata out of setup.py/setup.cfg, migrate a Poetry (or PDM) project to [project]/PEP 621, or improve a project's PyPI page./port-to-free-threaded-pythonMake a Python package work correctly on the free-threaded (no-GIL) CPython build (PEP 703; the cp313t/cp314t "t" ABI) and declare that it does, so importing it does not silently re-enable the GIL. Covers the pure-Python thread-safety pass (mutable global/class state, caches, contextvars vs threading.local) and, for C/C++/Cython/pybind11/nanobind/Rust-PyO3 extensions, declaring support (Py_mod_gil / PyUnstable_Module_SetGIL / the per-binding flag), fixing data races with critical sections (Py_BEGIN_CRITICAL_SECTION), PyMutex, atomics and thread-local state, the borrowed-reference hazards and their strong-reference replacements (PyList_GetItemRef, PyDict_GetItemRef), building cp3Xt wheels (meson-python, scikit-build-core, maturin, setuptools, cibuildwheel), and testing under load with ThreadSanitizer and pytest-run-parallel. Use to add free-threading / no-GIL / nogil / free-threaded / PEP 703 support, ship a cp313t/cp314t wheel, or stop the GIL being re-enabled. For a single stable-ABI abi3t wheel (3.15+) pair it with port-to-python-limited-api./port-to-meson-pythonBuild a Python package (usually with a compiled C/C++/Cython/Fortran/Rust extension) with the meson-python PEP 517 backend, or port one off a bespoke setuptools setup.py. Covers the pyproject.toml backend, the meson.build (project / extension_module / install_sources), VCS/dynamic versioning computed in meson.build, editable installs, config-settings, and abi3 / limited-API wheels. Use when asked to adopt meson-python or Meson, scaffold a new meson-python project, drop setup.py, or produce standards-based wheels./port-to-python-limited-apiPort a hand-written C/C++ CPython extension from the version-specific C API to the Limited API (Py_LIMITED_API) so one stable-ABI abi3 wheel loads on every later Python instead of one per version — and optionally target Python 3.15 abi3t (PEP 803 + PEP 793 PyModExport) for a single wheel across GIL-enabled and free-threaded builds. Covers the usual first step of converting static PyTypeObject types to heap types (PyType_FromSpec / PyType_Slot), module state, multi-phase init, API substitutions, and the build flags / abi3 / abi3.abi3t wheel tags for meson-python, scikit-build-core, maturin, and setuptools. Use to adopt the limited API / stable ABI / abi3 / abi3t, stop rebuilding a C extension per Python version, or convert static types to heap types. Not for pybind11/nanobind (see pybind11-to-nanobind) or the PyTorch C++ ABI (see port-to-torch-stable-abi).