Skip to content

Commit b8be950

Browse files
authored
Merge pull request #38 from git-pkgs/update-readme
Update README with threat-model, sinks, and taxonomy documentation
2 parents af94b49 + abe6546 commit b8be950

1 file changed

Lines changed: 89 additions & 2 deletions

File tree

README.md

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,81 @@ Missing recommended tooling:
148148

149149
Tools built into the language runtime (go test, gofmt, cargo clippy, dart analyze, deno lint, etc.) are detected automatically when the language is present and won't show as missing.
150150

151+
## Threat model
152+
153+
`brief threat-model` unions the threat categories implied by all detected tools. Each tool definition carries taxonomy tags from [oss-taxonomy](https://github.com/ecosyste-ms/oss-taxonomy) that classify what it does (web framework, ORM, template engine, HTTP client, etc). A mapping table in `_threats.toml` resolves those tags to CWE/OWASP threat categories. The output is fully deterministic -- no AI, no heuristics, just lookup.
154+
155+
```
156+
brief threat-model .
157+
brief threat-model --json .
158+
```
159+
160+
A Rails project produces:
161+
162+
```
163+
Detected: ruby
164+
Stack: ActiveRecord, Bundler, GitHub Actions, RSpec, Rails, RuboCop, Ruby
165+
166+
auth_bypass Authentication Bypass [CWE-287 A07:2021]
167+
via Rails
168+
169+
csrf Cross-Site Request Forgery [CWE-352 A01:2021]
170+
via Rails
171+
172+
mass_assignment Mass Assignment [CWE-915 A08:2021]
173+
via ActiveRecord
174+
175+
sql_injection SQL Injection [CWE-89 A03:2021]
176+
via ActiveRecord
177+
178+
ssti Server-Side Template Injection [CWE-1336 A03:2021]
179+
via Rails
180+
181+
xss Cross-Site Scripting [CWE-79 A03:2021]
182+
via Rails
183+
```
184+
185+
Rails carries `role:framework` + `layer:backend` which fires the backend-framework mapping (XSS, CSRF, SSRF, open redirect, path traversal, auth bypass). It also carries `function:templating` which fires XSS and SSTI, and `function:authentication` which fires auth bypass and session fixation. ActiveRecord carries `function:data-mapping` which fires SQL injection and mass assignment. Tools with no taxonomy contribute nothing, so projects using only linters and formatters get an empty threat list.
186+
187+
Match is conjunctive: a tool must carry all of a mapping's tags to fire it. `role:framework` + `layer:frontend` fires a different (smaller) set than `role:framework` + `layer:backend`, so React and Express don't get the same threats.
188+
189+
## Sinks
190+
191+
A "sink" in security analysis is a function where untrusted data ends up doing something dangerous -- executing a SQL query, rendering HTML, spawning a shell process, opening a file path. `brief sinks` collects these from all detected tools and outputs the combined set relevant to this project's stack, so you know what to grep for without reading every tool's documentation.
192+
193+
```
194+
brief sinks .
195+
brief sinks --json .
196+
```
197+
198+
```
199+
ActiveRecord:
200+
Arel.sql sql_injection CWE-89
201+
Marks string as safe SQL, bypassing protections
202+
find_by_sql sql_injection CWE-89
203+
where sql_injection CWE-89
204+
With string interpolation; safe with hash or parameterized array
205+
order sql_injection CWE-89
206+
Column name not parameterizable; allowlist instead
207+
208+
Rails:
209+
html_safe xss CWE-79
210+
Marks string as safe, bypassing ActionView output escaping
211+
redirect_to open_redirect CWE-601
212+
When target is from params
213+
render inline: ssti CWE-1336
214+
Renders string as ERB template
215+
216+
Ruby:
217+
eval code_injection CWE-95
218+
system command_injection CWE-78
219+
Marshal.load deserialization CWE-502
220+
```
221+
222+
Language definitions carry stdlib sinks (eval, system, pickle.loads, etc). Frameworks carry their own (html_safe, dangerouslySetInnerHTML, redirect_to). ORMs carry raw query escape hatches (find_by_sql, $queryRawUnsafe, Arel.sql). Notes indicate when only some forms of a method are dangerous.
223+
224+
The sink data covers 17 languages, 28 web frameworks, 17 ORMs, 15 HTTP clients, 13 template engines, 10 auth libraries, and more. The knowledge base carries over 700 sinks total.
225+
151226
## Enrichment
152227

153228
`brief enrich` runs the same scan, then fetches metadata from external APIs about the project itself: what packages it publishes, their download counts and dependents, runtime end-of-life status, and OpenSSF Scorecard.
@@ -163,7 +238,7 @@ Data sources: [ecosyste.ms](https://ecosyste.ms) for published package metadata,
163238
<!-- brief:tools:start (generated by: brief list -readme tools) -->
164239
## What it detects
165240

166-
54 language ecosystems with 446 tool definitions across 20 categories.
241+
54 language ecosystems with 516 tool definitions across 20 categories.
167242

168243
**Languages:** Ada, C, C#, C++, COBOL, Clojure, Common Lisp, Crystal, D, Dart, Deno, Elixir, Elm, Emacs Lisp, Erlang, F#, Fortran, GDScript, Gleam, Go, Groovy, Haskell, Haxe, Java, JavaScript, Julia, Kotlin, Lua, Mojo, Nim, Nix, OCaml, Objective-C, Odin, PHP, Perl, Prolog, Python, R, Racket, Roc, Ruby, Rust, Scala, Scheme, Solidity, Swift, Tcl, TypeScript, V, VHDL, Verilog, Zig.
169244

@@ -179,7 +254,7 @@ Data sources: [ecosyste.ms](https://ecosyste.ms) for published package metadata,
179254

180255
**Docs:** Docsify, Docusaurus, Dokka, Doxygen, ExDoc, Hugo, Javadoc, Jekyll, MkDocs, Nextra, Read the Docs, Redoc, Sphinx, Starlight, Storybook, Swagger UI, TypeDoc, VitePress, Yard, cargo doc, dart doc, deno doc, mdBook, phpDocumentor, pkgsite.
181256

182-
**Build:** Actix Web, AdonisJS, Angular, Astro, Autotools, Axum, CMake, Chi, Django, Dune, Echo, Electron, Eleventy, Ember.js, Express, FastAPI, Fastify, Fiber, Flask, Flutter, Foundry, Gatsby, Gin, GoReleaser, Hardhat, Hono, Koa, Laravel, Less, Mage, Make, Meson, NestJS, Next.js, Nuxt, Parcel, Phoenix, PostCSS, Qwik, Rails, Rake, React, React Native, Remix, Rocket, Rollup, Rspack, SWC, Sass, Sinatra, SolidJS, Spring Boot, Svelte, SvelteKit, Symfony, Tailwind CSS, Tauri, UnoCSS, Vite, Vue, Webpack, cross, esbuild, tsup.
257+
**Build:** Actix Web, AdonisJS, Angular, Astro, Authlib, Autotools, Axum, CMake, CarrierWave, Chi, Devise, Django, Dune, EJS, Echo, Electron, Eleventy, Ember.js, Express, Faraday, FastAPI, Fastify, Fiber, Flask, Flutter, Formidable, Foundry, FreeMarker, Gatsby, Gin, GoReleaser, Gson, Guzzle, HTTParty, Haml, Handlebars, Hardhat, Hono, Invoke, Jackson, Jinja2, Koa, Laravel, Less, Liquid, Mage, Make, Mako, Meson, Multer, Mustache, NestJS, Newtonsoft.Json, Next.js, NextAuth.js, Nokogiri, Nunjucks, Nuxt, OkHttp, OmniAuth, Ox, PHP LDAP, Parcel, Passport, Phoenix, PostCSS, Pug, PyCryptodome, PyJWT, PyYAML, Qwik, Rails, Rake, React, React Native, Remix, RestClient, Resty, Rocket, Rollup, Rspack, SWC, Sass, ShellJS, Shrine, Sinatra, Slim, SnakeYAML, SolidJS, Spring Boot, Svelte, SvelteKit, Symfony, Tailwind CSS, Tauri, Thymeleaf, Twig, UnoCSS, Vite, Vue, Webpack, XStream, aiohttp, axios, bcrypt, bcrypt-ruby, cross, crypto-js, cryptography, defusedxml, esbuild, execa, fast-xml-parser, golang-jwt, got, httpx, js-yaml, jsonwebtoken, ldap3, ldapjs, lxml, net-ldap, node-fetch, python-jose, python-multipart, requests, reqwest, ruamel.yaml, ruby-jwt, sh, tsup, undici, urllib3, xml2js.
183258

184259
**Codegen:** Buf, GraphQL Code Generator, OpenAPI, Protobuf, Thrift, Wire, ent, gRPC, mockgen, sqlc.
185260

@@ -230,10 +305,22 @@ alternatives = ["rake spec", "rspec"]
230305

231306
[config]
232307
files = [".rspec", "spec/spec_helper.rb"]
308+
309+
[taxonomy]
310+
role = ["testing-framework"]
311+
function = ["testing"]
312+
313+
[[security.sinks]]
314+
symbol = "let!"
315+
threat = "dos"
316+
cwe = "CWE-400"
317+
note = "Example only; RSpec doesn't actually have security sinks"
233318
```
234319

235320
The `default = true` flag marks a tool as the canonical choice for its category in that ecosystem. The `brief missing` command uses this to suggest the right tool when a category is absent.
236321

322+
Tool definitions can carry two optional sections. `[taxonomy]` classifies what the tool does using terms from [oss-taxonomy](https://github.com/ecosyste-ms/oss-taxonomy): `role` (framework, library, linter), `function` (api-development, templating, data-mapping), `layer` (backend, frontend, data-layer), `domain` (web-development, blockchain). These tags pass through to the JSON output and drive the `threat-model` command. `[[security.sinks]]` lists known dangerous methods with their CWE references, used by the `sinks` command. Both are optional and populated incrementally.
323+
237324
Detection uses five primitives: file/directory presence, dependency names from parsed manifests, file content matching, structured key existence (JSON/TOML), and ecosystem filtering to prevent cross-language false positives.
238325

239326
## Library usage

0 commit comments

Comments
 (0)