PyPI has become the second most dangerous package registry for supply chain attacks in 2026. According to Sonatype's Q2 2026 Open Source Malware Index, PyPI accounted for 48.5% of all non-npm malicious package activity — and the threat actor behind much of that activity is TeamPCP, a financially motivated, cloud-specialist group that has conducted the most sophisticated cascading supply chain campaign in PyPI's history.

This article covers the full arc of that campaign in 2026: the original TeamPCP kill chain (March 2026), the open-sourcing of the Shai-Hulud worm (May 12, 2026) and the explosive Wave 2 that followed, and the Hades campaign (June 8, 2026) which targeted bioinformatics and Model Context Protocol (MCP) developers on PyPI with a novel .pth startup hook delivering a Bun-based credential stealer. Then we cover what you can actually do about it.

Act I: The TeamPCP Kill Chain (March 2026)

To understand the Shai-Hulud waves, you need to understand how TeamPCP operates. Their strategy in March 2026 was a cascading credential chain: compromise the security tools that have privileged access to CI/CD pipelines, steal the credentials those tools can see, and use them to backdoor popular packages.

March 19, 2026 — Trivy GitHub Action Compromised
TeamPCP force-overrides 76 of 77 version tags in aquasecurity/trivy-action and all 7 tags in aquasecurity/setup-trivy. Any CI/CD pipeline using Trivy now exfiltrates SSH keys, cloud tokens, and GitHub PATs to the attacker.
March 21, 2026 — Checkmarx KICS & AST Compromised
Using PATs stolen via Trivy, TeamPCP poisons all 35 version tags of checkmarx/kics-github-action and version 2.3.28 of checkmarx/ast-github-action. Security scanners are now the attack vector.
March 24, 2026 — LiteLLM 95M dl/month Backdoored on PyPI
Using credentials stolen from LiteLLM's own CI/CD pipeline (which ran Trivy), TeamPCP publishes litellm 1.82.7 and 1.82.8. The versions are downloaded 119,000+ times before quarantine ~40 minutes later. CVE-2026-33634, CVSS 9.4.
March 27, 2026 — Telnyx Python SDK (750K dl/month) Backdoored
Two versions of the telnyx PyPI package (4.87.1 and 4.87.2) are published with a three-stage steganography payload: trojanised package → platform-specific loader → WAV audio file containing hidden second-stage → full credential harvester. Quarantined after ~4 hours.
April 2026 — Ransomware Partnership
Ransomware group Vect announces a partnership with TeamPCP, significantly escalating the threat. Any credentials already stolen via LiteLLM or Telnyx may now be used in ransomware attacks.

Act II: The Worm Goes Open Source (May 12, 2026)

The TeamPCP March campaign fed into something far larger: the Mini Shai-Hulud npm+PyPI worm. Starting April 29, 2026, TeamPCP launched a coordinated worm attack targeting the npm and PyPI registries simultaneously — a historic first. Over two weeks, 172 packages across 404 malicious versions were compromised, hitting TanStack, Mistral AI, Guardrails AI, and UiPath among others.

Then, on May 12, 2026 — one day after the massive TanStack compromise — TeamPCP did something unprecedented: they published the full Shai-Hulud worm source code to GitHub as open-source software, with a $1,000 XMR bounty challenge to whoever could run the largest supply chain attack using the code. Within 48 hours, the first clone appeared. Wave 2 had begun.

Wave 2 scale: By the time Wave 2 peaked, Shai-Hulud clones had compromised 492 packages and created 25,000+ attacker-controlled GitHub repositories used as staging infrastructure. Individual developer accounts were hijacked and turned into unwitting propagation nodes for the worm.
Wave Dates Packages Ecosystem Notable Targets
TeamPCP Kill Chain Mar 19–27, 2026 3 PyPI packages PyPI + GitHub Actions Trivy, Checkmarx, LiteLLM (95M dl/mo), Telnyx (750K dl/mo)
Mini Shai-Hulud Wave 1 Apr 29 – May 12, 2026 172 (404 versions) npm + PyPI TanStack, Mistral AI, Guardrails AI, UiPath, Bitwarden CLI
Shai-Hulud Wave 2 May 12 – June, 2026 492 peak npm + PyPI 25,000+ GitHub repos, @antv namespace, Lightning (311K dl/day)
Hades Campaign June 8, 2026 19–37 PyPI wheels PyPI Bioinformatics packages, MCP developers, LangChain variants

Act III: The Hades Campaign — PyPI's .pth Persistence Problem (June 8, 2026)

Just when the Shai-Hulud wave seemed to plateau, security researchers at Socket, Endor Labs, and StepSecurity disclosed a new and more technically sophisticated campaign on June 8, 2026: the Hades campaign. Named for its underworld theme, Hades targeted an entirely different victim profile: Python bioinformatics researchers and developers building on Model Context Protocol (MCP).

Six Python packages used in academic genomics, phenotype analysis, and graph machine learning were simultaneously replaced with trojanized versions — including ensmallen, embiggen, pyphetools, gpsea, phenopacket-store-toolkit, and ppkt2synergy. The expanded Socket research found 471 total artifacts (411 npm + 60 PyPI) across 37 PyPI wheels, including MCP-themed packages like langchain-core-mcp, and typosquats like rsquests, tlask, and rlask.

How the .pth Hook Works — Persistence Beyond Import

What makes Hades technically remarkable is its delivery mechanism. Unlike previous supply chain attacks that required the malicious package to be imported, Hades used Python's .pth file mechanism — a feature designed for extending the Python path, but capable of executing arbitrary code on every Python startup.

# Hades delivery mechanism — simplified
# 1. Malicious wheel installs an innocuous-looking file:
#    site-packages/ensmallen-setup.pth

# 2. Python processes ALL .pth files in site-packages at startup
# 3. The .pth file triggers import of the malicious module

# 4. The malicious module downloads Bun JavaScript runtime
#    and runs _index.js — obfuscated credential stealer
#
# Target credentials:
#   AWS_SECRET_ACCESS_KEY, GOOGLE_APPLICATION_CREDENTIALS
#   GITHUB_TOKEN, NPM_TOKEN, PYPI_TOKEN, RUBYGEMS_API_KEY
#   JFROG_ACCESS_TOKEN, Kubernetes service account tokens
#   SSH private keys (~/.ssh/), shell history, .env files
#   Docker config (~/.docker/config.json)
#   AI tool configs: ~/.claude/, ~/.cursor/, ~/.gemini/

The key threat: once a Hades-compromised package is installed in a virtual environment, every Python process in that venv exfiltrates credentials at startup — even processes completely unrelated to the malicious package. This means a bioinformatics researcher running genomics analysis scripts would silently leak their GitHub token and AWS keys on every execution.

Novel evasion techniques in Hades: The campaign also introduced AI prompt injection into package metadata — instructions designed to misdirect AI-powered security scanners into reporting the package as safe. StepSecurity also found a token-revocation wiper: if the malware detected it was being analysed in a sandbox, it would revoke the stolen tokens before the analyst could rotate them, destroying the evidence of compromise.

The Scale: 2026 PyPI by the Numbers

48.5%
Of all non-npm malicious package activity in PyPI
Source: Sonatype Q2 2026 Malware Index
1.8M+
Cumulative malicious packages across registries (decade)
Source: Sonatype Q2 2026
73%
Year-over-year increase in malicious open-source packages
Source: ReversingLabs 2026 SSC Report
492
Peak packages compromised in Shai-Hulud Wave 2
Source: CSA Research Note, May 2026
25,000+
Attacker-created GitHub repos used as staging infrastructure
Source: CSA Research Note, May 2026
50,000+
PyPI projects using Trusted Publishers (20%+ of uploads)
Source: PyPI Blog, 2026

PyPI Trusted Publishers: The Right Architecture With Real Limits

PyPI's Trusted Publishers system — based on OIDC tokens rather than long-lived API keys — is the right answer to credential theft. Instead of storing a static token in CI/CD secrets, your workflow exchanges a short-lived OIDC token for a 15-minute PyPI upload token. There is no secret to steal, rotate, or accidentally commit.

# .github/workflows/publish.yml — Trusted Publishers pattern
jobs:
  publish:
    permissions:
      id-token: write  # Required for OIDC exchange
    steps:
      - uses: pypa/gh-action-pypi-publish@release/v1
        # No TWINE_PASSWORD or API_TOKEN needed
        # PyPI verifies the OIDC token from GitHub

Over 50,000 PyPI projects now use Trusted Publishers, representing more than 20% of all file uploads. But the TeamPCP campaign revealed important limitations that developers need to understand:

Known Trusted Publishers attack surfaces:

1. Pull request trigger misconfiguration. If your workflow uses on: pull_request (rather than on: push to a protected branch), a contributor opening a PR from a fork can potentially trigger the OIDC exchange. PyPI's security model documentation explicitly warns against this pattern.

2. Compromised CI/CD environment. The Hades campaign used valid OIDC tokens from compromised maintainer CI/CD environments. Trusted Publishers does not prevent an attacker who controls your CI runner from minting a legitimate upload token.

3. Scope is upload-only. Trusted Publishers secures the publish step. It does not protect your development environment, local credentials, or downstream consumers from Shai-Hulud-style infection via a compromised dependency.

Defence Guide: Protecting Your Python Projects in 2026

Step 1: Audit for Hades .pth Infections Right Now

Check all your virtual environments for suspicious .pth files before doing anything else:

# Find all .pth files in your active venv
find $(python -c "import site; print(site.getsitepackages()[0])") \
     -name "*.pth" | xargs grep -l "import\|exec\|__import__" 2>/dev/null

# List all .pth files for manual review
find $(python -c "import site; print(site.getsitepackages()[0])") \
     -name "*.pth" -exec echo {} \;

# Legitimate .pth files contain only paths, not import statements
# Any .pth file with "import" or "exec" is suspicious

Step 2: Run pip-audit on Every Project

# Install pip-audit
pip install pip-audit

# Audit installed packages (uses OSV database)
pip-audit

# Audit a requirements.txt without installing
pip-audit -r requirements.txt

# Audit a poetry.lock
pip-audit --fix  # auto-fix where possible

# JSON output for CI/CD integration
pip-audit --format=json --output=audit.json

Step 3: Add OSV-Scanner to CI/CD

# GitHub Actions — add to your existing workflow
- name: OSV Scanner
  uses: google/osv-scanner-action@v2
  with:
    scan-args: |-
      --lockfile=requirements.txt
      --lockfile=poetry.lock
      --call-analysis=all

# OSV covers PyPI, matches against osv.dev database
# Updated within hours of new PyPI advisories

Step 4: Hash-Pin Dependencies in requirements.txt

# Generate pinned requirements with hashes
pip-compile --generate-hashes requirements.in > requirements.txt

# Example output (with integrity check on install):
# requests==2.32.3 \
#     --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6 \
#     --hash=sha256:...

# Install respects hashes — any tampering fails
pip install --require-hashes -r requirements.txt

Step 5: Enable PyPI Trusted Publishers

  • Go to PyPI project settings → Publishing → Add a new pending publisher
  • Configure: GitHub owner + repository + workflow file name + environment name
  • Use on: push to a protected branch (never on: pull_request alone)
  • Add branch protection: require PR review, no direct pushes, no force-push
  • Revoke all existing long-lived PyPI API tokens once OIDC is working
  • Enable mandatory 2FA on all maintainer PyPI accounts

Step 6: Monitor with Socket for Python

Socket's pypi_socket integration flags packages with install-time execution hooks, obfuscated code, and known malware lineages including Shai-Hulud, Hades, and TeamPCP payloads. For projects with direct PyPI exposure, Socket's package health signals provide a second layer of detection beyond pip-audit's CVE-only scope.

OptiBot coverage: CVE OptiBot's daily lockfile scanner monitors your requirements.txt, poetry.lock, and Pipfile.lock against OSV.dev and cross-references known TeamPCP, Shai-Hulud, and Hades package versions. When a new wave hits PyPI, you'll get alerted before your next manual audit. See Python Vulnerabilities monitoring for your stack.

Frequently Asked Questions

Is Shai-Hulud still active in July 2026?

The original TeamPCP infrastructure was disrupted, but the Shai-Hulud worm source code remains public on GitHub with a bounty attached. Multiple copycat campaigns are ongoing. Sonatype Q2 2026 data shows PyPI malicious activity at 48.5% of non-npm ecosystem threats — the attack surface remains live. The Hades variant was detected as recently as June 2026.

Does PyPI's Trusted Publishers prevent Shai-Hulud attacks?

Trusted Publishers prevents credential theft at the publish step — attackers cannot steal a long-lived API token. However, the Hades campaign showed that attackers who compromise a maintainer's CI/CD environment can still mint valid OIDC tokens. Trusted Publishers is necessary but not sufficient on its own. Combine it with branch protection, pip-audit in CI, and hash pinning.

What does a .pth file attack look like — how is it different from a normal supply chain attack?

A standard supply chain attack executes malicious code when the compromised package is imported. A .pth attack is worse: any file in site-packages/ ending in .pth is processed automatically by Python at startup — before any of your code runs, and regardless of which packages you actually use. This means the stealer activates on every Python invocation in that virtualenv, even your test runner, linting tools, and build scripts.

How do I tell if my project was affected by the March 2026 LiteLLM/Telnyx compromise?

Check your dependency history: if any lock file between March 24 10:39 UTC and ~11:20 UTC pins litellm==1.82.7 or litellm==1.82.8, or telnyx==4.87.1 / telnyx==4.87.2 between March 27 03:51–07:00 UTC, treat the environment as compromised. Rotate all credentials visible to that environment: AWS/GCP/Azure keys, GitHub tokens, SSH keys, Kubernetes service accounts, database passwords, and any API keys present in environment variables or .env files.

Is pip-audit enough to detect Shai-Hulud and Hades packages?

pip-audit queries the OSV database, which is updated with new advisories typically within hours of public disclosure. For the Hades campaign, malicious package versions were added to OSV after Endor Labs and Socket disclosed them on June 8, 2026. For the fastest detection of novel supply chain attacks before CVE assignment, complement pip-audit with Socket's Python integration — Socket detects behavioural patterns (install scripts, network calls at import, obfuscated payloads) that OSV cannot cover until an advisory is filed.

Why did bioinformatics packages get targeted in the Hades campaign?

Bioinformatics researchers typically work with high-value cloud compute environments (AWS, GCP) for large-scale genomic analysis, often with broad IAM permissions. They are less likely to have enterprise-grade security tooling in their Python environments than commercial software teams. The combination of valuable credentials and lower security baseline made them an attractive target for a credential-harvesting campaign.

Monitor your Python dependencies automatically

CVE OptiBot scans your requirements.txt, poetry.lock, and Pipfile.lock daily against OSV.dev — covering TeamPCP, Shai-Hulud, and Hades package versions. Get alerted before the next wave hits your stack.

Start free monitoring

PyPI est devenu le deuxième registre de paquets le plus dangereux pour les attaques supply chain en 2026. Selon le Sonatype Q2 2026 Open Source Malware Index, PyPI représente 48,5 % de toute l’activité malveillante non-npm — et le groupe derrière une grande partie de cette activité est TeamPCP, un acteur financialement motivé spécialisé dans le cloud, qui a mené la campagne supply chain en cascade la plus sophistiquée de l’histoire de PyPI.

Cet article couvre l’intégralité de cette campagne en 2026 : la chaîne de compromission originale de TeamPCP (mars 2026), l’open-source du ver Shai-Hulud (12 mai 2026) et la vague 2 explosive qui s’en est suivie, et la campagne Hades (8 juin 2026) qui a ciblé des développeurs Python en bio-informatique et en MCP (Model Context Protocol) via un mécanisme de hook .pth innovant livrant un stealer de credentials basé sur Bun. Puis ce qu’il faut faire concrètement.

Acte I : La chaîne de compromission TeamPCP (mars 2026)

Pour comprendre les vagues Shai-Hulud, il faut comprendre comment opère TeamPCP. Leur stratégie en mars 2026 est une chaîne de credentials en cascade : compromettre les outils de sécurité qui ont un accès privilégié aux pipelines CI/CD, voler les credentials que ces outils peuvent voir, et s’en servir pour backdoorer des paquets populaires.

19 mars 2026 — GitHub Action Trivy compromis
TeamPCP force-push 76 des 77 tags de version de aquasecurity/trivy-action et les 7 tags de aquasecurity/setup-trivy. Tout pipeline CI/CD utilisant Trivy exfiltre désormais clés SSH, tokens cloud et PATs GitHub vers l’attaquant.
21 mars 2026 — Checkmarx KICS & AST compromis
Avec les PATs volés via Trivy, TeamPCP empoisonne tous les 35 tags de version de checkmarx/kics-github-action et la version 2.3.28 de checkmarx/ast-github-action. Les scanners de sécurité deviennent le vecteur d’attaque.
24 mars 2026 — LiteLLM (95M tél./mois) backdooré sur PyPI
Avec les credentials volés depuis le propre pipeline CI/CD de LiteLLM (qui utilisait Trivy), TeamPCP publie litellm 1.82.7 et 1.82.8. Ces versions sont téléchargées 119 000+ fois avant la mise en quarantaine ~40 minutes plus tard. CVE-2026-33634, CVSS 9,4.
27 mars 2026 — SDK Python Telnyx (750K tél./mois) backdooré
Deux versions du paquet telnyx PyPI (4.87.1 et 4.87.2) sont publiées avec un payload stéganographique en 3 étapes : paquet troyanisé → chargeur spécifique à la plateforme → fichier audio WAV contenant le stage 2 caché → harvester de credentials complet. Mis en quarantaine après ~4 heures.
Avril 2026 — Partenariat ransomware
Le groupe ransomware Vect annonce un partenariat avec TeamPCP. Les credentials déjà volés via LiteLLM ou Telnyx peuvent désormais être utilisés dans des attaques ransomware.

Acte II : Le ver passe en open source (12 mai 2026)

La campagne TeamPCP de mars a alimenté quelque chose de bien plus grand : le ver Mini Shai-Hulud npm+PyPI. Dès le 29 avril 2026, TeamPCP lance une attaque de ver coordonnée ciblant simultanément npm et PyPI — une première historique. En deux semaines, 172 paquets en 404 versions malveillantes sont compromis, touchant TanStack, Mistral AI, Guardrails AI, UiPath et d’autres.

Puis, le 12 mai 2026 — un jour après le compromis massif de TanStack — TeamPCP fait quelque chose d’inédit : ils publient le code source complet du ver Shai-Hulud sur GitHub en open source, avec un bounty de 1 000 XMR pour quiconque pourrait lancer la plus grande attaque supply chain avec ce code. En 48 heures, le premier clone apparaissait. La vague 2 avait commencé.

Ampleur de la vague 2 : Au pic de la vague 2, les clones de Shai-Hulud avaient compromis 492 paquets et créé 25 000+ dépôts GitHub contrôlés par les attaquants utilisés comme infrastructure de staging. Des comptes de développeurs individuels ont été détournés et transformés en nœuds de propagation involontaires du ver.

Acte III : La campagne Hades — le problème .pth de PyPI (8 juin 2026)

Alors que la vague Shai-Hulud semblait se calmer, les chercheurs de Socket, Endor Labs et StepSecurity ont divulgué le 8 juin 2026 une nouvelle campagne techniquement plus sophistiquée : la campagne Hades. Elle ciblait un profil de victimes totalement différent : les chercheurs Python en bio-informatique et les développeurs travaillant sur le Model Context Protocol (MCP).

Six paquets Python utilisés en génomique, analyse de phénotype et graph machine learning ont été remplacés simultanément par des versions troyanisées — dont ensmallen, embiggen, pyphetools, gpsea, phenopacket-store-toolkit et ppkt2synergy. La recherche étendue de Socket a trouvé 471 artefacts au total (411 npm + 60 PyPI) sur 37 wheels PyPI, incluant des paquets à thème MCP comme langchain-core-mcp, et des typosquats comme rsquests, tlask et rlask.

Comment fonctionne le hook .pth — persistence au-delà de l’import

Ce qui rend Hades techniquement remarquable, c’est son mécanisme de livraison. Contrairement aux attaques précédentes qui nécessitaient d’importer le paquet malveillant, Hades utilise le mécanisme de fichiers .pth de Python — une fonctionnalité conçue pour étendre le chemin Python, mais capable d’exécuter du code arbitraire à chaque démarrage de Python.

# Mécanisme de livraison Hades — simplifié
# 1. Le wheel malveillant installe un fichier d’apparence innocente :
#    site-packages/ensmallen-setup.pth

# 2. Python traite TOUS les fichiers .pth de site-packages au démarrage
# 3. Le fichier .pth déclenche l’import du module malveillant

# 4. Le module télécharge le runtime JavaScript Bun
#    et exécute _index.js — stealer de credentials obfusqué
#
# Credentials cibles :
#   AWS_SECRET_ACCESS_KEY, GOOGLE_APPLICATION_CREDENTIALS
#   GITHUB_TOKEN, NPM_TOKEN, PYPI_TOKEN
#   Tokens Kubernetes, clés SSH (~/.ssh/)
#   Historique shell, fichiers .env
#   Config Docker (~/.docker/config.json)
#   Config outils IA : ~/.claude/, ~/.cursor/, ~/.gemini/

Le risque clé : une fois un paquet compromis par Hades installé dans un environnement virtuel, chaque processus Python dans ce venv exfiltre des credentials au démarrage — même les processus sans rapport avec le paquet malveillant. Le stealer s’active à chaque exécution Python dans ce venv, y compris votre test runner, vos outils de linting et vos scripts de build.

Techniques d’évasion inédites dans Hades : La campagne a également introduit de l’injection de prompt IA dans les métadonnées des paquets — des instructions conçues pour tromper les scanners de sécurité pilotés par IA en leur faisant reporter le paquet comme sûr. StepSecurity a également trouvé un effaceur de tokens : si le malware détectait une analyse en sandbox, il révoquait les tokens volés avant que l’analyste puisse les faire tourner, détruisant les preuves de compromission.

Chiffres clés 2026 pour PyPI

48,5%
De toute l’activité malveillante non-npm dans les registres de paquets
Source : Sonatype Q2 2026 Malware Index
1,8M+
Paquets malveillants cumulés sur tous les registres (10 ans)
Source : Sonatype Q2 2026
73%
Hausse annuelle des paquets open source malveillants
Source : ReversingLabs 2026 SSC Report
492
Paquets compromis au pic de la vague 2 Shai-Hulud
Source : CSA Research Note, mai 2026
25 000+
Dépôts GitHub créés par les attaquants comme infrastructure de staging
Source : CSA Research Note, mai 2026
50 000+
Projets PyPI utilisant les Trusted Publishers (20%+ des uploads)
Source : Blog PyPI, 2026

PyPI Trusted Publishers : La bonne architecture avec ses limites

Le système de Trusted Publishers de PyPI — basé sur des tokens OIDC plutôt que des clés API statiques — est la bonne réponse au vol de credentials. Au lieu de stocker un token statique dans les secrets CI/CD, votre workflow échange un token OIDC à courte durée contre un token d’upload PyPI valable 15 minutes. Il n’y a aucun secret à voler, faire tourner ou committer accidentellement.

Plus de 50 000 projets PyPI utilisent maintenant les Trusted Publishers, représentant plus de 20 % de tous les uploads. Mais la campagne TeamPCP a révélé des limites importantes que les développeurs doivent comprendre :

Surfaces d’attaque connues des Trusted Publishers :

1. Mauvaise configuration du trigger pull request. Si votre workflow utilise on: pull_request (plutôt que on: push vers une branche protégée), un contributeur ouvrant une PR depuis un fork peut potentiellement déclencher l’échange OIDC.

2. Environnement CI/CD compromis. La campagne Hades a utilisé des tokens OIDC valides issus d’environnements CI/CD de mainteneurs compromis. Les Trusted Publishers ne protègent pas contre un attaquant qui contrôle votre runner CI.

3. Périmètre limité au publishing. Les Trusted Publishers sécurisent l’étape de publication. Ils ne protègent pas votre environnement de développement, vos credentials locaux, ni les consommateurs en aval contre une infection de type Shai-Hulud via une dépendance compromise.

Guide de protection de vos projets Python en 2026

Etape 1 : Auditer les infections .pth maintenant

Vérifiez tous vos environnements virtuels pour des fichiers .pth suspects avant tout :

# Trouver tous les .pth suspects dans le venv actif
find $(python -c "import site; print(site.getsitepackages()[0])") \
     -name "*.pth" | xargs grep -l "import\|exec\|__import__" 2>/dev/null

# Les fichiers .pth légitimes ne contiennent que des chemins
# Tout fichier .pth avec "import" ou "exec" est suspect

Étape 2 : Lancer pip-audit sur chaque projet

# Installation
pip install pip-audit

# Audit des paquets installés (base OSV)
pip-audit

# Audit d’un requirements.txt sans installation
pip-audit -r requirements.txt

# Sortie JSON pour CI/CD
pip-audit --format=json --output=audit.json

Étape 3 : Pinner les dépendances avec des hashes

# Générer requirements.txt avec hashes d’intégrité
pip-compile --generate-hashes requirements.in > requirements.txt

# Installation avec vérification des hashes
pip install --require-hashes -r requirements.txt
# Toute altération du paquet fait échouer l’installation

Étape 4 : Activer les Trusted Publishers pour vos publiés

  • Paramètres PyPI → Publishing → Ajouter un publisher OIDC
  • Configurer : propriétaire GitHub + dépôt + fichier workflow + nom d’environnement
  • Utiliser on: push vers une branche protégée (jamais on: pull_request seul)
  • Protection de branche : review PR obligatoire, no direct push, no force-push
  • Révoquer tous les tokens PyPI statiques une fois OIDC opérationnel
  • 2FA obligatoire sur tous les comptes PyPI mainteneur

Surveillez vos dépendances Python automatiquement

CVE OptiBot scanne vos requirements.txt, poetry.lock et Pipfile.lock quotidiennement contre OSV.dev — couvrant les versions connues TeamPCP, Shai-Hulud et Hades. Soyez alerté avant que la prochaine vague touche votre stack.

Démarrer le monitoring gratuit