惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
T
Tenable Blog
Webroot Blog
Webroot Blog
L
Lohrmann on Cybersecurity
S
Securelist
S
Schneier on Security
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
I
Intezer
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
TaoSecurity Blog
TaoSecurity Blog
S
Secure Thoughts
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Privacy International News Feed
H
Hacker News: Front Page
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
博客园 - Franky
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
P
Proofpoint News Feed
S
Security Affairs
WordPress大学
WordPress大学
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
小众软件
小众软件
F
Full Disclosure
博客园 - 叶小钗
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
Security Latest
Security Latest
P
Proofpoint News Feed
月光博客
月光博客
T
Tailwind CSS Blog
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
Project Zero
Project Zero

Nx Blog

Sharing Tailwind CSS Styles Across Apps in a Monorepo | Nx Blog How SiriusXM Stays Competitive by Iterating and Getting to Market Fast | Nx Blog Agentic Experience Is the New Developer Experience | Nx Blog Nx Joins the Linux Foundation and the Agentic AI Foundation | Nx Blog A Monorepo Is NOT a Monolith | Nx Blog Why we deleted (most of) our MCP tools | Nx Blog Teach Your AI Agent How to Work in a Monorepo | Nx Blog How Broadcom stays efficient and nimble with monorepos | Nx Blog Why Monorepos are King in the Age of AI | Nx Blog Nx 2026 Roadmap: Expanding Agent Autonomy, Improving Performance, Better Polyglot and More | Nx Blog End to End Autonomous AI Agent Workflows with Nx | Nx Blog Autonomous Agents at Scale | Nx Blog Scaling 700+ Projects: How Nx Became a 'No-Brainer' for Caseware | Nx Blog Configure Tailwind v4 with Angular in an Nx Monorepo | Nx Blog The Missing Multiplier for AI Agent Productivity | Nx Blog A Year of Nx Webinars | Nx Blog Wrapping Up 2025 | Nx Blog Nx 22.3 Release: Angular 21 Support, tsgo Compiler, and Prettier v3 | Nx Blog Nx Cloud Release: Agent Resource Usage | Nx Blog Nx Platform Outperforms DIY Cache by 5x | Nx Blog An Nx Carol: Past, Present, and Future of Your Monorepo | Nx Blog Nx 22.1 Release: Terminal UI on Windows, Storybook 10, Vitest 4, and more! | Nx Blog The Compounding Effect: How Nx Features Multiply Performance Gains | Nx Blog 10 Monorepo Myths Debunked: Separating Fact from Fiction | Nx Blog Nx Cloud Release: Enterprise Task Analytics | Nx Blog Watch and Rebuild Storybook Dependencies with Nx | Nx Blog Book - React for Enterprise: Timeless Architecture for Enterprise Apps | Nx Blog Beyond Remote Cache: Unlock 70% More CI Performance | Nx Blog Nx 22 Release: Expanding the build platform | Nx Blog What's the Point of Generating All This Code If You Can't Merge It? | Nx Blog What's New in Nx Self-Healing CI | Nx Blog Nx Highlights: Smarter AI integration, all-new graph UI, and big new versions of your favorite tools | Nx Blog Making the Case for Smarter Monorepos, and How to Not Get Fooled by Myths | Nx Blog Integrating Biome in 20 Minutes | Nx Blog S1ngularity - What Happened, How We Responded, What We Learned | Nx Blog Stop Babysitting Your PRs: Self-Healing CI Cuts Time to Green by 50% | Nx Blog UKG Unifies Their Codebase and Eliminates CI Overhead to Focus on Customer Value | Nx Blog How Git Worktrees Changed My AI Agent Workflow | Nx Blog Nx Cloud Workspace Graph: See Your Organization's Code Structure Like Never Before | Nx Blog Seamless Java Deployment in Nx Using Docker | Nx Blog Getting Mobile Into Your Monorepo: Android + Nx | Nx Blog Polyglot Projects Made Easy: Integrating Spring Boot into an Nx Workspace | Nx Blog The Journey of the Nx Plugin for Gradle: From Prototype to Production | Nx Blog Combining Predictability and Intelligence With Nx Generators and AI | Nx Blog A New UI For The Humble Terminal | Nx Blog Continuous tasks are a huge DX improvement | Nx Blog New and Improved Module Federation Experience with Nx | Nx Blog A New UI for Nx Migration | Nx Blog Custom Task Runners and Self-Hosted Caching Changes | Nx Blog Enterprise Angular Monorepo Patterns | Nx Blog Using Rspack with Angular | Nx Blog Angular Architecture Guide To Building Maintainable Applications at Scale | Nx Blog Modern Angular Testing with Nx | Nx Blog Nx Update: 20.5 | Nx Blog Are Monorepos the Answer to Better AI-Assisted Development? | Nx Blog Making Cursor Smarter with an MCP Server For Nx Monorepos | Nx Blog React Development for 2025 | Nx Blog Using Apollo GraphQL in an Nx Workspace | Nx Blog Angular State Management for 2025 | Nx Blog Tailoring Nx for Your Organization | Nx Blog Nx Cloud Pipelines Come To Nx Console | Nx Blog Define the relationship with monorepos | Nx Blog See your affected project graph in Nx Cloud | Nx Blog Handling CORS In Your Workspace | Nx Blog Improve your architecture and CI pipeline times with Nx projects | Nx Blog Announcing Nx 20 | Nx Blog Introducing Nx Powerpack | Nx Blog Nx 19.5 is here! Stackblitz, Bun, Incremental Builds for Vite, Gradle Test Atomizer | Nx Blog Introducing Explain with AI | Nx Blog Nx Enterprise Podcast Episode 2: Tine Kondo | Nx Blog Monorepos and CI can be a Mess - Here's How Nx and Nx Cloud Fixed It | Nx Blog Nx Enterprise Podcast Episode 1: Hicham El Hammouchi | Nx Blog Nx 19.0 Release!! | Nx Blog Manage Your Gradle Project using Nx | Nx Blog Making the Argument for Monorepos | Nx Blog Reliable CI. A new execution model fixing both flakiness and slowness | Nx Blog Monorepos - Why Speed Matters | Nx Blog Nx Agents Walkthrough: Effortlessly Fast CI Built for Monorepos | Nx Blog Launch Nx Week Recap | Nx Blog Versioning and Releasing Packages in a Monorepo | Nx Blog Fast, Effortless CI | Nx Blog Introducing @nx/nuxt Enhanced Nuxt.js Support in Nx | Nx Blog What if Nx Plugins Were More Like VSCode Extensions | Nx Blog Monorepos: the Benefits, Challenges, and Importance of Tooling Support | Nx Blog Nx — Highlights of 2023 | Nx Blog Nx 17.2 Update | Nx Blog Unit Testing Expo Apps With Jest | Nx Blog Nx Docs AI Assistant | Nx Blog State Management Nx React Native/Expo Apps with TanStack Query and Redux | Nx Blog Nx 17 has Landed | Nx Blog Nx Conf 2023 — Recap | Nx Blog Nx Raises $16M Series A | Nx Blog Introducing Playwright Support for Nx | Nx Blog Nx 16.8 Release!!! | Nx Blog Step-by-Step Guide to Creating an Expo Monorepo with Nx | Nx Blog Qwikify your Development with Nx | Nx Blog Create Your Own create-react-app CLI | Nx Blog Storybook Interaction Tests in Nx | Nx Blog Evergreen Tooling — More than Just CodeMods | Nx Blog A Practical Guide on Effective AI Use - AI as Your Peer Programmer | Nx Blog
Can You Trust Your Build Cache? | Nx Blog
Jack Hsu · 2026-06-16 · via Nx Blog

Your remote build cache is one of the most important pieces of infrastructure you run, and likely one of the least audited. It is shared across branches and CI jobs in your organization. When a task gets a cache hit, the build task does not run. The cache hands back bytes that someone, somewhere, on some branch, produced earlier.

A shared cache is a trust boundary, and most teams have never treated it like one. Two things have to hold for a cached artifact to be trustworthy:

  1. The key that identifies it has to actually describe it.
  2. Only trusted builds can write under that key.

Break either one and a cache hit replays bytes that no one vetted.

We are in the middle of a steady stream of software supply-chain attacks built on compromised credentials and poisoned dependencies. A build cache is another target which affects everyone who pulls from it.

Cache misconfigurations are common and dangerous

A task's cache key is a hash of the inputs the tool accounts for: the files and values you declare, plus whatever it infers on your behalf. If the build reads a file that lands in neither bucket (a shared config outside the package, a source directory someone forgot to list), changing that file does not change the key. A poisoned artifact gets served under a clean hash, and there is no way to tell the difference.

The tool trusts the author to have enumerated everything and verified configuration correctness. One mistake can make the cache silently unsafe.

Undeclared inputs make the hash unreliable

Suppose a shop app declares inputs for its source code and Vite config.

{
  "nx": {
    "targets": {
      "build": {
        "inputs": [
          "src/**/*.ts",
          "src/**/*.tsx",
          "vite.config.ts"
        ]
      }
    }
  }
}

But the Vite config imports from a shared directory that sits outside of the project.

import { defineConfig } from "vite";import { sharedPlugin } from '../../shared/vite-shared-plugin.js';export default defineConfig({  plugins: [    sharedPlugin(),    // ...  ]});

The build applies the plugin from shared/vite-shared-plugin.js which affects dist, yet the file is absent from the declared inputs:

A build cache key computed from declared inputs only, while a file the build reads sits outside it

Editing shared/vite-shared-plugin.js changes the output but not the cache key. A key that should identify the whole build now identifies a subset of it, so one hash can stand for two different artifacts. That is the gap every attack in this post walks through.

The exploit primitive

Every version of this attack reduces to the same three steps:

  1. Find a file the build reads and compiles into its cached output, but which is not in the task's hash (cache key).
  2. Show that editing that file produces the same cache key as before. Same key means the cache cannot distinguish a clean build from a poisoned one.
  3. On a shared cache, whoever populates that key first wins. A malicious branch builds with the edited file, seeds the key with a poisoned artifact, and everyone on clean main replays it on a cache hit, without building, without ever seeing the payload in their working tree.

The victim never edited the malicious file. They never saw it in a diff. They did not even run the build. They pulled an artifact from the cache because the key matched. The consequence is direct: a teammate's branch can poison main.

This is not hypothetical

We took several widely-used open-source monorepos (real projects, millions of downstream installs between them) and confirmed the core flaw against the actual build tooling, not on paper. In many cases, editing a file that the build compiles into its output produced the same cache key.

Let's go over an issue we found when looking through projects. This kind of misconfiguration shows up in real open-source projects and affects many remote caching solutions, including both Nx and Turborepo.

Missing tsconfig in inputs list

When a tsconfig file is missing from a package's inputs it can lead to a broken cached output. In the best case, downstream consumers get a stale package. In the worst case, they get a compromised one.

A publishable package extends a tsconfig.base.json that lives at the repo root, outside the package:

packages/some-pkg/tsconfig.json

{
  "extends": "../../tsconfig.base.json"
}

The root tsconfig.base.json is not in the package's declared inputs, and editing its paths mapping does not change the build's cache key. An attacker can remap any module to a file of their choosing.

{
  "compilerOptions": {
    "paths": {
      "some-dep": ["./evil/shim.ts"]
    }
  }
}

Here the some-dep module is swapped with an evil/shim.ts file that re-exports the real module and runs a payload. A bundler follows the remap and pulls evil/shim.ts into the output, so the compiled dist runs the malicious code instead of the real dependency. None of it changes the cache key, and the poisoned dist is what npm publish ships.

Now the consumers of this package receive the poisoned artifact.

You don't need an attacker

Take the malice out and the same broken key still costs you. If the key misses a file the build compiles, you get a false-positive hit, and the cache replays an artifact built before your change.

Say you update an API and rebuild. The changed file is not in the task's key, so it replays a stale artifact and everything downstream builds against the old shape. The mismatch either breaks in production, far from its cause, or runs stale, serving last week's behavior while your source says otherwise.

The key looked clean, so nothing points you at the cache. You lose hours bisecting correct code, and the usual escape is to bust the whole cache and rebuild, throwing away every legitimate hit and handing back the slow CI the cache existed to remove.

The cache is a trust boundary

None of these tools has a bug. They hash the inputs you declare and replay on a match, exactly as designed. The exposure is structural. A shared cache is a trust boundary with two halves. The key has to describe the artifact, and only trusted builds can write under it. Signing the artifact does not close the gap either: a signature proves who produced the bytes, not that the key covered every input that shaped them.

Mitigations you can apply today

Input enforcement is the durable fix, but you can shrink the blast radius right now, whatever build tool you use:

  • Build release artifacts without the cache. Run publish jobs from a clean checkout with cache reads off, so a poisoned entry can never reach a tarball.
  • Separate cache access by trust level. A protected branch should not read what an untrusted or fork branch could have written.
  • Gate cache tokens to critical jobs. Treat cache tokens (TURBO_TOKEN, NX_CLOUD_ACCESS_TOKEN) as sensitive information that potentially grants write access to your cache. Give untrusted and fork pipelines read-only access at most, for example by gating the write token behind a protected GitHub Actions environment.
  • Audit the usual undeclared inputs. Shared tsconfig files and configs, env files, generated code, and global tool configs are the files most often read but never hashed. Automated analysis can help surface some of these.

These work with any build tool, but each is a manual control you have to set up and keep enforcing. With Nx Cloud, the recommended access-control settings give you the same protection without turning the cache off.

Nx Cloud separates write access by branch

Nx Cloud allows you to scope the cache by trust level. Builds on protected branches like main use a read-write token and read and write the shared, trusted cache. Builds on unprotected branches, like PRs, read it through a read-only token to stay fast, while their writes land in an isolated scope that protected branches never read. Workspace settings > Access Control > Use recommended settings sets this up, disabling anonymous access and provisioning the tokens so it does not depend on each pipeline author to get it right.

Make the inputs enforceable (Sandboxing)

Trust scoping controls what an untrusted build can write. Sandboxing controls what any write can contain, so it protects you even when you trust the writer. Nx Cloud Task Sandboxing runs each task with its file I/O validated against the inputs and outputs it declares, and records any read or write outside that set as a violation. The attack depends on a build quietly reading a file that is not in the hash, and sandboxing makes that impossible to do quietly.

Nx Cloud reports every violation, the unexpected reads and writes per task, so you see exactly what the build touches but does not declare.

In strict mode, sandboxing fails any task that reads or writes outside its declared set, closing both the deliberate poisoning and the everyday false-positive hit.

A cache only saves you time if you can trust what it gives back.

  • Treat it as the trust boundary it is.
  • Control who can write to it, and verify that what they wrote is what they declared.

Do both, and trust every cache hit.