Skip to main content

SherlockScan

CI PyPI

SherlockScan is a beta static risk scanner for Python package artifacts. Version 0.3.0 is prepared for release review on main; publishing to PyPI is a separate, manual action. The previously published version remains available until release approval.

A finding indicates potential risk; it does not prove maliciousness. A clean scan does not prove safety.

Install and run

Python 3.9 or newer is required. For the released version, use pip install sherlockscan. To evaluate the v0.3.0 source before publication:

git clone https://github.com/itsual/sherlockscan.git
cd sherlockscan
python -m pip install -e ".[dev]"
sherlockscan version
sherlockscan scan ./your-project --format json --output report.json
sherlockscan scan ./package.whl --format sarif --output results.sarif
sherlockscan scan requests==2.32.3 --format md

PyPI retrieval chooses a non-yanked wheel compatible with the running interpreter, or a source archive when no compatible wheel exists. It scans one exact artifact, not every wheel, platform or dependency. The report records its filename and SHA-256. Artifact hashes from PyPI detect mismatches; they do not establish publisher trust. For a different platform, supply its wheel explicitly.

What v0.3.0 does

  • Reads ZIP/wheel and TAR source archives without extracting or executing target code.
  • Downloads artifact bytes directly from PyPI, without pip or target build hooks.
  • Reads declared dependencies from METADATA, PKG-INFO or static PEP 621 project metadata.
  • Inspects Python AST calls, common import aliases, loader arguments and execution context.
  • Recognizes startup-executing .pth lines and identifies unanalyzed native code.
  • Scans source and up to two layers of bounded base64/hex/zlib literal decoding.
  • Explains each finding's trigger, legitimate uses and suggested investigation.
  • Produces Markdown, JSON, SARIF 2.1.0 and a declared-dependency CycloneDX SBOM.
  • Supports scoped suppressions and opt-in CI severity thresholds.

Importing networking or serialization libraries is informational. Co-occurring environment access and networking is a review hint; no data flow or attack is proven. torch.load checks distinguish explicit unsafe arguments, unknown arguments and statically constrained PyTorch >=2.6 defaults. Static alias resolution is limited; reflection, monkey patching, complex control flow and full interprocedural data flow are outside scope. Severity describes potential impact; confidence describes the evidence supporting a flag, not a probability that the package is malicious.

CLI and CI behavior

sherlockscan scan ./package.whl --fail-on HIGH --severity MEDIUM \
  --suppressions ./reviewed-suppressions.yaml --format json --output report.json \
  --sbom dependencies.cdx.json

--severity filters displayed details only. Policy evaluates all unsuppressed findings. Reports retain detected totals, actionable totals, suppression reasons and coverage gaps. --include-tests includes tests, docs and examples, which are excluded and listed by default. --no-deobfuscation disables decoding and explicitly marks that coverage incomplete. Use --config DIRECTORY for trusted custom risk_patterns.yaml and optional approved_packages.yaml. Existing v0.2 regex/keyword YAML remains supported. Rules may supply an uppercase id; otherwise a deterministic content-derived ID is used. Custom patterns are trusted configuration, not sandboxed code or regexes.

Exit Meaning
0 Supported checks completed and the configured threshold was not exceeded. No safety guarantee.
10 Unsuppressed findings exceeded --fail-on.
20 Incomplete coverage: unknown/dynamic metadata, invalid Python, native code or exhausted limits.
30 Scanner/input/configuration/download/output error; no successful scan verdict.
2 Invalid command-line usage.

Incomplete coverage takes precedence over a policy failure; findings remain in the report. By default findings alone do not fail a completed scan. CI users should set an appropriate --fail-on threshold and treat every nonzero exit as requiring review.

Suppressions are only loaded when explicitly supplied by the operator. See suppression instructions and rule guidance. Report false positives using the repository issue form after removing credentials and proprietary source.

Library API

from sherlockscan.engine import scan_package
from sherlockscan.reporting import render

report = scan_package("./package.whl", fail_on="HIGH")
print(report["status"], report["artifact"], report["coverage"])
print(render(report, "json"))

Schema 0.3 retains common v0.2 fields, but adds stable rule IDs, fingerprints, confidence, suppression state, policy status, artifact identity and coverage. CLI error/incomplete exit codes have changed intentionally. Legacy low-level scanner functions remain available for compatibility; engine.scan_package is the supported complete v0.3 pipeline. The legacy utils.resolve_package_target also uses static ingestion; callers must delete its returned temporary directory when finished.

Limits and review scope

Defaults: compressed artifact 100 MiB, expanded total 250 MiB, each member 25 MiB, 5,000 entries, ZIP ratio 1,000:1, per-source parsing 2 MiB, and a 60-second cooperative ingestion budget. Decoding uses two transforms and a cumulative 64 KiB budget per literal. Symlinks, devices, duplicate/case-colliding paths, encrypted ZIP entries and traversal paths are rejected. Python parsing and regex processing are not an OS-level sandbox; run investigations of hostile artifacts in an isolated environment.

Static metadata can be missing or incomplete. Optional extras and environment markers are preserved and inspected as declarations, not resolved for a chosen runtime. Dependencies are not recursively audited, SBOM dependency versions are not inferred from the scanner host, and native/compiled code is not analyzed. No automatic installation, package blocking based on co-occurrence, age-based quarantine, attestation enforcement or typosquatting verdicts are provided.

Develop and release review

python -m pytest
python -m ruff check sherlockscan tests integration
python -m build
python -m twine check dist/*

See the release review checklist, changelog, security policy, and launch measurement plan. The manual publishing workflow requires an explicit release-review confirmation. Pushing to main does not publish a package.

Metadata

Release files for sherlockscan 0.3.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 sherlockscan 0.3.0
File Size Uploaded Provenance Actions
sherlockscan-0.3.0.tar.gz 57.2 kB With provenance Details for sherlockscan-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 116.8 kB

Release files / sherlockscan-0.3.0.tar.gz

Download URL sherlockscan-0.3.0.tar.gz
Size 57.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a742a08ed4f97353cc865c116d8ea969be8b7df81149d5a02304037400a7a537
BLAKE2b-256 checksum
How to use checksums
b3c459fe3dccde6b5af090d8614ab0cd41685d8314fe9bf2a587dc0596ab21c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Release files / sherlockscan-0.3.0-py3-none-any.whl

Download URL sherlockscan-0.3.0-py3-none-any.whl
Size 59.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
626b257fed09baa5c9a89044afb66f15a87c5034f29255b9bb939b5964abbdd3
BLAKE2b-256 checksum
How to use checksums
988ffc3033f3a24c8b553e97fab4acf53a7a4f01c85d4962d76f25015b22ba36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Security for sherlockscan 0.3.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 sherlockscan-0.3.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 Oct 19, 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