SkillMITv1.0.2neo-pragnyaruns codefirst-party

Package security scan

Find out why a Python package gets quarantined, flagged or blocked by package firewalls and SCA tools (Black Duck, JFrog Xray or Curation, Sonatype Nexus Firewall, Snyk, Mend, Socket), and fix it with free tools instead of a subscription. It scans the exact built or published wheel and sdist: secrets with gitleaks, vulnerable dependencies with pip-audit, Grype or OSV, malicious-package heuristics with GuardDog, Bandit, licence metadata, and an inventory of scripts, binaries and minified JS. It produces a report, applies honest fixes (remove secret-shaped strings, declare every bundled licence, close real code issues), and adds a blocking dist-scan job to the release workflow. Use whenever someone says their package was quarantined, flagged, blocked or failed a security scan, asks for a security scan or report without a paid tool, wants an SBOM or pre-release security gate for PyPI, or asks what Black Duck or a package firewall will find, even if they don't say scan.

At a glance

Kind
Skill · Ananke skill
Reference
neo-pragnya/package-security-scan · ananke://skill/neo-pragnya/package-security-scan@1.0.2
Files
5 · 51.1 KB
How it's used
Skills load on demand: the agent sees this skill's name and description, and opens SKILL.md (and any bundled references or scripts) when a task matches.

Where it fits

Task
Deploy and releaseReview securityVerify before shipping
Methodology
ADLCDevOpsSDLC
Lifecycle phase
DeploymentVerification
Role
DevOps / SRE engineerRelease managerSecurity engineer
Domain
Developer toolingSecurity
Language
Python
Framework or tool
GitHub Actions
Platform
Ananke PlexusClaude CodeGitHub Copilot
Needs
Python

Facets reviewed by the Dex Trove maintainers. Facets say where an item is relevant, not that it will run in your setup. How facets work

Checked by Dex

Verified, not self-reported: dex-trove 0.3.16 installed this item into each layout and checked that the tool can load it. Dex collects no download or usage data.

  • Claude Code ✓ loads
  • GitHub Copilot ✓ loads

Documentation

View upstream ↗
Contents

Package firewalls judge the files you publish, not your repo. Proven on Ananke Plexus and Dex Trove, where dependency CVEs were clean but the packages were quarantined. The causes were:

  • credential-shaped placeholders in shipped content;
  • fake keys in the sdist’s tests;
  • a declared licence of MIT while the package bundled Apache-2.0 and OFL-1.1 content;
  • an unfiltered tarfile.extractall;
  • heuristic hits on vendored minified JS and third-party scripts.

What the CVE scanners can’t see

Trivy, Grype, osv-scanner, pip-audit and Semgrep all called Ananke Plexus 0.3.28 clean (0 CVEs, 0 secrets, its own licence), and it was quarantined. Its wheel carried a 3.5 MB minified Mermaid bundle with undeclared licences (GuardDog: threat-runtime-obfuscation) and read a keychain secret with the macOS command that prints a stored password, the same one infostealers run. Dev Guru, clean itself, was blocked because it depends on Ananke. So scan_dist.py now blocks, not just reports:

  • bundled: minified or third-party code (licence banners, bundler marks, lines over 1,000 characters, files over 200 KB) unless accepted with a licence that’s in License-Expression;
  • signatures: what malware does, in any shipped file, docs included: keychain dumps, browser password stores, SSH and cloud keys, pipe-to-shell, encoded PowerShell, exec of decoded data, chat webhooks, tunnel and paste hosts, hidden Unicode in code;
  • heuristics: any GuardDog rule not in the reviewed baseline, and Bandit HIGH. A rule can be accepted only in the files reviewed (paths), so the same rule anywhere new blocks;
  • vulns: pip-audit, plus Grype and osv-scanner when installed.

Reviewed findings live in .scan-dist.toml, each with a reason. Even a guide that quotes the command it’s warning about will block the release. Describe it instead of quoting it.

1. Get the evidence first

Ask for the scanner’s policy violation names: one line each, such as “Secrets detected” or “License not approved”. They say which of the reasons below applies. While you wait, scan the published files yourself. Download them with curl from https://pypi.org/pypi/<name>/<version>/json, because pip download refuses a package whose requires-python excludes the local Python. Run the script on that directory:

python scripts/scan_dist.py --dist <dir-with-whl-and-tar.gz> --out scan-report [--extras all]

It needs gitleaks and uv (brew install gitleaks); pip-audit, GuardDog and Bandit come through uvx. It writes scan-report/summary.md and scan.json, and exits 1 on any secret or vulnerable dependency.

For a second opinion, all free:

  • brew install grype syft osv-scanner trivy, then grype dir:<venv> on an environment with the wheel installed.
  • trivy fs --scanners vuln,secret,license.
  • osv-scanner.

2. Map findings to quarantine reasons and fix honestly

Reason a firewall quarantinesCheckHonest fix
Secretsgitleaks over wheel and sdist (tests ship in the sdist)Remove the content, or build test fakes at runtime ("AKIA" + "…"). Allowlist only reviewed false positives (UUIDs, public IDs), narrowly, with the reason
Vulnerable dependenciespip-audit over the tree the wheel resolves to, with the extras users installuv lock --upgrade-package X, raise the lower bound, release a new version (never re-upload a version)
LicenceLicense-Expression vs what is bundled (fonts, vendored JS, copied content)Declare the full expression (MIT AND Apache-2.0 AND OFL-1.1), ship the texts, add a test that keeps them in step
Malicious-code heuristicsGuardDog, Bandit HIGHFix real issues (path traversal, shell=True on input). Document expected hits (vendored minified JS, a deny-list containing rm -rf /) in the release notes
Immaturity or popularitypackage age, downloadsNothing in code: request an exception, or wait out the maturity window

Never disguise benign code to slip past a scanner. That means no string splitting of rm -rf, no encoding of URLs, and no hiding of files. It’s evasion, and it makes the next reviewer’s job harder. Remove the content, fix it, or document it. Fake credentials built at runtime in tests are fine: they never ship as a credential-shaped literal.

Repo-history scans are a separate job. Removing a placeholder from the tree doesn’t remove it from history. Pin each historical finding by fingerprint in .gitleaksignore (commit:file:rule:line), so anything new is still reported. Never allowlist whole directories such as tests/ or a vendored-content folder: that hides exactly what a firewall will find.

3. Gate every release

  1. Copy scripts/scan_dist.py into the repo, and assets/gitleaks.toml to .gitleaks.toml if there are reviewed false positives. Read any existing .gitleaks.toml first and merge; don’t overwrite it.
  2. Add a Makefile target: scan: build then python scripts/scan_dist.py --dist dist --out scan-report. Ignore scan-report/ in git.
  3. Paste assets/dist-scan-job.yml into the release workflow and add dist-scan to the publish job’s needs:. Tools are pinned there: gitleaks by version and SHA-256, the Python tools with uv tool install X==ver. Lint the workflow with actionlint and zizmor.
  4. Write a “reviewed heuristic hits” list in the release guide, so a reviewer can match the firewall’s report line by line.
  5. Expect new advisories on release day. Trivy or pip-audit may block a tag over a CVE published hours earlier. Bump the lockfile, and release the next version rather than re-tagging one that already reached TestPyPI.

Free tools

NeedTools
Dependency CVEspip-audit, osv-scanner, Grype + Syft, Trivy, OWASP Dependency-Check; Dependabot (free on public repos)
Secretsgitleaks, trufflehog, detect-secrets; GitHub secret scanning (public repos)
Malicious-package heuristicsGuardDog; Socket.dev public package pages (open in a browser)
Code issuesBandit, Semgrep CE, CodeQL (public repos)
LicencesScanCode Toolkit (closest to Black Duck’s licence scan), Trivy, reuse lint
SBOM and postureSyft or CycloneDX SBOMs, OpenSSF Scorecard, build provenance attestations

More detail on each reason and on reading Black Duck output: references/quarantine-reasons.md.