Repository navigation
Conversation
- STRIDE-based threat model for jQuery core, built from a library-focused template - Covers the HTML pipeline, jQuery.extend, Ajax, the build and publish pipeline, and the report intake surface - Treats "a library can make sanitized input unsafe again" (CVE-2020-11022/11023) as a first-class failure mode - Published at /threat-model/ so SECURITY.md and the internal runbook can link to it
| ┌──────────────────────────────────────────────────────────┐ | ||
| │ Caller Application │ | ||
| │ │ | ||
| │ (developer code — may or may not sanitize before passing)│ | ||
| └─────────────────────────┬────────────────────────────────┘ | ||
| │ HTML strings, objects, URLs, | ||
| │ AJAX options, selectors | ||
| ▼ | ||
| ══════════════════════ TRUST BOUNDARY ══════════════════════ | ||
| (jQuery implicitly trusts its caller; | ||
| the caller implicitly trusts jQuery's output) | ||
| │ | ||
| ┌─────────────────────────▼────────────────────────────────┐ | ||
| │ jQuery │ | ||
| │ │ | ||
| │ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │ | ||
| │ │ DOM / HTML │ │ Object utils │ │ Ajax / JSONP │ │ | ||
| │ │ pipeline │ │ (extend) │ │ │ │ | ||
| │ │ (htmlPrefilter│ │ │ │ │ │ | ||
| │ │ buildFrag., │ └──────────────┘ └─────────────────┘ │ | ||
| │ │ selector) │ │ | ||
| │ └──────┬───────┘ │ | ||
| └──────────┼────────────────────────────────────────────────┘ | ||
| │ │ │ | ||
| ══════════ TRUST BOUNDARY ═══════════════════════════════════ | ||
| │ │ │ | ||
| ▼ ▼ ▼ | ||
| ┌─────────┐ ┌──────────┐ ┌───────────┐ | ||
| │ DOM │ │ Host page│ │ Network │ | ||
| │ (script │ │ globals │ │ (remote │ | ||
| │execution│ │(Object. │ │ servers, │ | ||
| │context) │ │prototype)│ │ CDN) │ | ||
| └─────────┘ └──────────┘ └───────────┘ |
There was a problem hiding this comment.
monospace alignment:
| ┌──────────────────────────────────────────────────────────┐ | |
| │ Caller Application │ | |
| │ │ | |
| │ (developer code — may or may not sanitize before passing)│ | |
| └─────────────────────────┬────────────────────────────────┘ | |
| │ HTML strings, objects, URLs, | |
| │ AJAX options, selectors | |
| ▼ | |
| ══════════════════════ TRUST BOUNDARY ══════════════════════ | |
| (jQuery implicitly trusts its caller; | |
| the caller implicitly trusts jQuery's output) | |
| │ | |
| ┌─────────────────────────▼────────────────────────────────┐ | |
| │ jQuery │ | |
| │ │ | |
| │ ┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ │ | |
| │ │ DOM / HTML │ │ Object utils │ │ Ajax / JSONP │ │ | |
| │ │ pipeline │ │ (extend) │ │ │ │ | |
| │ │ (htmlPrefilter│ │ │ │ │ │ | |
| │ │ buildFrag., │ └──────────────┘ └─────────────────┘ │ | |
| │ │ selector) │ │ | |
| │ └──────┬───────┘ │ | |
| └──────────┼────────────────────────────────────────────────┘ | |
| │ │ │ | |
| ══════════ TRUST BOUNDARY ═══════════════════════════════════ | |
| │ │ │ | |
| ▼ ▼ ▼ | |
| ┌─────────┐ ┌──────────┐ ┌───────────┐ | |
| │ DOM │ │ Host page│ │ Network │ | |
| │ (script │ │ globals │ │ (remote │ | |
| │execution│ │(Object. │ │ servers, │ | |
| │context) │ │prototype)│ │ CDN) │ | |
| └─────────┘ └──────────┘ └───────────┘ | |
| ┌──────────────────────────────────────────────────────────┐ | |
| │ Caller Application │ | |
| │ │ | |
| │ (developer code — may or may not sanitize before passing)│ | |
| └─────────────────────────┬────────────────────────────────┘ | |
| │ HTML strings, objects, URLs, | |
| │ AJAX options, selectors | |
| ▼ | |
| ══════════════════════ TRUST BOUNDARY ══════════════════════ | |
| (jQuery implicitly trusts its caller; | |
| the caller implicitly trusts jQuery's output) | |
| │ | |
| ┌─────────────────────────▼────────────────────────────────┐ | |
| │ jQuery │ | |
| │ │ | |
| │ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │ | |
| │ │ DOM / HTML │ │ Object utils │ │ Ajax / JSONP │ │ | |
| │ │ pipeline │ │ (extend) │ │ │ │ | |
| │ │(htmlPrefilter│ │ │ │ │ │ | |
| │ │ buildFrag., │ └───────┬──────┘ └───────┬────────┘ │ | |
| │ │ selector) │ │ │ │ | |
| │ └──────┬───────┘ │ │ │ | |
| └─────────┼──────────────────┼─────────────────┼───────────┘ | |
| │ │ │ | |
| ══════════╪═ TRUST BOUNDARY ═╪═════════════════╪════════════ | |
| │ │ │ | |
| ▼ ▼ ▼ | |
| ┌─────────┐ ┌──────────┐ ┌───────────┐ | |
| │ DOM │ │ Host page│ │ Network │ | |
| │ (script │ │ globals │ │ (remote │ | |
| │execution│ │(Object. │ │ servers, │ | |
| │context) │ │prototype)│ │ CDN) │ | |
| └─────────┘ └──────────┘ └───────────┘ |
|
|
||
| > "jQuery doesn't sanitize user input, so it shouldn't have security issues, right? Not really — an issue we fixed in 3.5.0 was a case where the user has already sanitized HTML before passing it to jQuery, and then jQuery was transforming it to one that could still run an embedded script." | ||
|
|
||
| In other words: **a library can re-introduce vulnerabilities into input that was already safe.** Mutation, normalization, and "helpful" rewriting are all places where this happens. This isn't hypothetical for jQuery — CVE-2020-11022 and CVE-2020-11023 are exactly that failure mode. The threat model below treats "making sanitized input unsafe again" as a first-class threat category, not an afterthought. |
There was a problem hiding this comment.
Should the CVE identifiers be hyperlinks, here and/or in the appendix?
|
Hey @timmywil! I started to work on proposal for a threat model (as discussed on slack) but I didn't had just yet time to formalize it... so I landed this commit on my fork (ref) in case that helps a bit with the design and the format. I mostly followed the style and format from other threat models we have in place for Node.js, Lodash, moment, webpack... I am happy to prepare a proposal if you like the format. Our goal with the threat model in those projects is overall to reduce the noise (see: Why Most Lodash Vulnerability Reports Get Rejected), simplify triage (see: Maintainer's Guide to GHSAs - Editorial criteria) and to clarify for developers what they need to be worried when using our software to build things. As a runbook for the team most of the time we use incident response plans like this one for Express where we have all the steps to follow when there are new reports or security incidents within the project. |
Adds a threat model for jQuery core as a page at
/threat-model/. It is maintainer-facing reference material that the security policy (jquery/jquery#5925) and the team's internal incident response runbook link to, and it is meant to be revisited after every CVE and at every major version.jQuery.extend, the Ajax subsystem, the build and publish pipeline, and the report intake surface (maintainer attention as an asset).The page uses Markdown tables and a fenced ASCII diagram. No other page on the site uses tables today, so the rendered output is worth a look in preview.