Skip to content

doc: introduce threatmodel - #472

Open
dkw-oss wants to merge 3 commits into
mainfrom
threatmodel
Open

dkw-oss wants to merge 3 commits into
mainfrom
threatmodel

Conversation

@dkw-oss

@dkw-oss dkw-oss commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Description:

This PR introduces a THREATMODEL.md to cover gemstash in light of the recent security issues fixed within it.

I will abide by the code of conduct.

Comment thread THREATMODEL.md Resolved
Comment thread THREATMODEL.md Resolved
Comment thread THREATMODEL.md Resolved
Comment thread THREATMODEL.md Resolved
Comment thread THREATMODEL.md Resolved
Comment thread THREATMODEL.md Resolved
Comment thread THREATMODEL.md Resolved
dkw-oss and others added 2 commits November 28, 2026 00:14
- Point the integrity goal at Bundler's checksum checks
- Reword the intro to the rules so it reads plainly
- Spell out what rule 9 means: one store per gem source
- Split the upstream-redirect paragraph into steps and a list
- Name Bundler where the integrity of stored gems is discussed

@colby-swandale colby-swandale left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • With the default memory cache, removing or downgrading a key with gemstash authorize doesn't reach the running server for up to 30 minutes. The CLI clears the key from its own process's cache, and each Puma worker keeps its cached copy until :cache_expiration runs out. Add this to Known Gaps. The workaround today is to restart Gemstash after removing a key, or to use Memcached or Redis.

  • Out of Scope says an attacker who controls the cache isn't covered, but gap 7 lists Memcached unmarshalling as a known gap. Pick one framing, for example "the cache is fully trusted, and gap 7 is what that trust costs", and add a "To close it" line like the other gaps have.

  • Compared with TUF's attack list, freeze and rollback aren't covered. Stored gems are never refreshed and dependency data can be 30 minutes stale, so a broken or malicious Gemstash can keep clients on old versions. The compact index also comes from the upstream while gems come from the cache, so clients can get index data and gem files that never existed together. Both are mostly inherent to a caching proxy, so name them in Known Gaps or Out of Scope.

  • Nits: PrivateSource#serve_gem reads the whole gem into memory on every download, so gap 5 also applies to fetches, not just pushes. Rule 5 depends on the nosniff header that Sinatra's default protection adds, and no spec checks it. :max_upstream_bytes: nil turns off the size limit, and gap 1 and the checklist should say so. The deployment checklist would also be easier to keep current in gemstash-deploy.7.

  • The language avoids standard security terms, which makes sentences long and keeps the doc from matching the words reporters and tools search for. Use the standard term in each heading, such as SSRF, open redirect, unsafe deserialisation, and denial of service, and explain it in plain words underneath. Pick one word per concept: "upstream" and "gem source" are used interchangeably, and gap 3 says "cached gems" for what Entry Points calls stored. Split rule 3 and the redirect credentials sentence into lists. Give rules and gaps stable IDs instead of numbers that shift when an entry is added. Explain allowed_upstreams: "*" and :protected_fetch once and link to that, rather than repeating them in five places each.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants