Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Astral 7 min read How-to mediumAdept

Securing Python projects from supply-chain attacks

Hash-pinning is the core defense against compromised maintainer accounts or hacked distribution servers, because version pins alone fail when PyPI files can be added post-release and GitHub Action tags can be force-pushed. Concrete hardening steps for Python projects on GitHub: pin Actions by commit SHA (via pinact, Dependabot or Renovate), verify SHA-256 hashes of downloaded binaries in Bash, Python or TypeScript, use PyPI Trusted Publishing over OIDC, require approvals on release environments, and lint workflows with zizmor. With uv, add dependency cooldowns via exclude-newer, lock CI tools as dependency groups and run them with UV_LOCKED, lock PEP 723 scripts, and set no-build to avoid executing source-distribution build backends.

Related posts

  • Defending Your Software Supply Chain: What Every Engineering Team Should Do Now

    Docker mediumAdept

    Recent supply chain compromises (the axios npm hijack attributed to Lazarus Group, the TeamPCP campaign via Trivy's GitHub Action, Shai-Hulud, GlassWorm) share one root cause: implicit trust in mutable tags, broad long-lived tokens and unsandboxed runners. The recommended defenses start with pinning Actions to commit SHAs and images to digests, using lock files with npm ci, and applying 3-day cooldowns on new dependency versions, since most malicious releases live only hours. Further layers are short-lived scoped CI credentials, avoiding pull_request_target, artifact proxies and build-time SBOMs, plus canary tokens and credential cleanup on developer machines. AI coding agents should run in microVM sandboxes and MCP servers should be governed. Many recommendations are paired with Docker products such as Hardened Images, Scout, Sandboxes and MCP Gateway.

  • Dependency prefixes are a supply chain risk: let's fix them

    Sourcegraph mediumAdept

    SemVer range prefixes like ^, ~ and wildcards in package.json act as a trust policy that lets compromised or hijacked packages flow into CI and production on the next install. The recommended controls are to commit lockfiles and install with npm ci, pnpm --frozen-lockfile or yarn --immutable, pin exact versions for high-blast-radius packages such as build tools, auth libraries and native-binding deps, set save-exact defaults, disable install scripts with an allowlist for exceptions, and run audits against the locked tree. To roll this out across hundreds of repositories, a Sourcegraph Batch Changes spec with a Node script rewrites React dependency ranges to approved exact versions and refreshes lockfiles without running scripts.

  • Protecting your Supabase projects from npm supply chain attacks

    Supabase mediumAdept

    npm supply chain attacks reach Supabase users through three common paths: maintainer compromise, typosquatting (including a real `supabase-javascript` package and AI-hallucinated names), and build pipeline compromise like the TanStack attack via `pull_request_target` and a poisoned Actions cache. Malicious lifecycle scripts can exfiltrate env vars, cloud metadata, kubeconfig, npm tokens and SSH keys before `npm install` even returns. The recommended layered defenses are pnpm 11 with a 3–7 day `minimumReleaseAge`, exact version pins for sensitive deps, committed and reviewed lockfiles, disabled install scripts with an allowlist, verifying `@supabase/` scopes, SHA-pinned GitHub Actions, and credential rotation after suspected exposure. A ready-made prompt lets a coding agent apply these settings across pnpm, npm, yarn and bun.

  • Our response to the TanStack npm supply chain attack

    OpenAI easyNovice

    Two OpenAI employee devices were compromised via the malicious TanStack npm package in the Mini Shai-Hulud supply chain attack, leading to credential-focused exfiltration from a limited set of internal repositories that held code-signing certificates for iOS, macOS and Windows apps. OpenAI isolated systems, revoked sessions, rotated credentials, blocked new notarizations with the old certificate, and is rotating signing certificates, which requires macOS users to update apps before the revocation deadline (extended to June 26, 2026). The affected devices had not yet received hardening controls rolled out after the Axios incident, including package manager minimumReleaseAge settings and provenance validation, which would have blocked the malicious package. No customer data, IP or signed malware was found.

  • Securing the Docker MCP Catalog: Commit Pinning, Agentic Auditing, and Publisher Trust Levels

    Docker mediumAdept

    Docker's MCP Registry now pins every Docker-built MCP server to a specific Git commit, enforced in CI and propagated to the org.opencontainers.image.revision label, so builds are deterministic and verifiable with docker inspect or cosign. A nightly workflow bumps pins via per-server PRs, and each incoming change gets an agentic security review by Claude Code and OpenAI Codex. The reviewers are treated as untrusted: they run in a Docker Compose stack with read-only code mounts, no Internet access, a fixed-file output directory, and a reverse proxy that injects API keys so secrets never enter the container. Risk labels map to GitHub status checks (critical blocks merge), and the catalog adds publisher trust indicators distinguishing known publishers from community servers.

The quest for software engineering knowledge.

Look:
Layout: