You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+89-2Lines changed: 89 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,81 @@ Missing recommended tooling:
148
148
149
149
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.
150
150
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.
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
+
151
226
## Enrichment
152
227
153
228
`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,
163
238
<!-- brief:tools:start (generated by: brief list -readme tools) -->
164
239
## What it detects
165
240
166
-
54 language ecosystems with 446 tool definitions across 20 categories.
241
+
54 language ecosystems with 516 tool definitions across 20 categories.
note = "Example only; RSpec doesn't actually have security sinks"
233
318
```
234
319
235
320
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.
236
321
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
+
237
324
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.
0 commit comments