File size: 21,955 Bytes
1340dfb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | # Anchors are literal source substrings. Two entries are in insecure, secure order.
# File-qualified anchors use filename.py::substring. Unqualified anchors target the entry module.
# Evidence is derived from observed checks, never from these source-review notes.
[[legacy]]
id = "report-file-containment"
source = "def read_report"
sink = ["return (report_root", "return candidate.read_text"]
flow = ["request filename", "path join", "file read"]
secure_flow = ["request filename", "resolved containment under a trusted root", "file read"]
control = "Resolve and check containment under a service-owned tree."
review = "The positive has a clear path-construction flaw. The correction is conditional on ownership of the entire directory tree across check and read; callers are absent."
secure_status = "ambiguous"
[[legacy]]
id = "theme-catalog-selection"
source = "def read_theme"
sink = ["return (theme_root / (theme", "return (theme_root / filenames"]
flow = ["request theme identifier", "CSS path construction", "file read"]
secure_flow = ["request theme identifier", "closed lookup of an authored filename", "file read"]
control = "Fixed identifier-to-file lookup in a deployment-owned directory."
review = "Simple but meaningful identifier-versus-file distinction. File-entry ownership is an external assumption."
[[legacy]]
id = "line-counter-process-arguments"
source = "def line_count"
sink = ["result = subprocess.run(", "result = subprocess.run("]
flow = ["request-derived document path", "absolute path", "process API"]
secure_flow = ["request-derived path", "absolute path", "one argument in a fixed process vector"]
control = "Fixed executable, argument vector, and absolute file operand."
review = "GNU/POSIX utility semantics and upstream path authorization limit the correction's scope. No shell execution evidence."
status = "unverified"
[[legacy]]
id = "asset-size-native-api"
source = "def asset_size"
sink = ["subprocess.check_output(", "return Path(asset_path).stat()"]
flow = ["request-derived asset path", "metadata lookup"]
control = "Use the OS metadata API without a shell."
review = "Trivial sink replacement with clear CWE-78 scope. No command-execution proof; any file-access decision is external."
status = "unverified"
[[legacy]]
id = "announcement-html-text"
source = "def announcement_html"
sink = "return f"
flow = ["user message", "interpolated HTML text node"]
secure_flow = ["user message", "HTML text escaping", "interpolated text node"]
control = "Escape for a plain HTML text node."
review = "Introductory browser-output contrast; the test measures HTML parse shape for ordinary text containing markup delimiters."
[[legacy]]
id = "search-input-html-attribute"
source = "def search_field"
sink = "return f"
flow = ["search query", "HTML escaping", "double-quoted value attribute"]
secure_flow = ["search query", "quote-aware escaping", "double-quoted value attribute"]
control = "Escape quotes in a quoted, plain-text HTML attribute."
weak_control = "Escapes ampersands and angle brackets but leaves quotes literal."
review = "Tests ordinary text containing a quote in an attribute; no active browser content is used."
difficulty = "intermediate"
[[legacy]]
id = "inbox-sqlite-value-binding"
source = "def count_messages"
sink = "return conn.execute"
finding = ["query = f", "return conn.execute"]
flow = ["mailbox argument", "SQL value position", "SQLite execute"]
secure_flow = ["mailbox argument", "bound SQLite value"]
control = "Bind the mailbox as a data value."
review = "Canonical value-binding lesson. Source review identifies a statement-text interpolation; no injection reproduction."
[[legacy]]
id = "inventory-sqlite-sort-column"
source = "def inventory_rows"
sink = "return conn.execute"
finding = ["query = f", "return conn.execute"]
flow = ["sort key", "ORDER BY expression", "SQLite execute"]
secure_flow = ["user sort key", "closed map", "authored ORDER BY identifier"]
control = "Resolve the sort field through a closed map of SQL identifiers."
weak_control = "Binds warehouse; the sort expression remains outside the bound values."
review = "Partially safe SQL is realistic. Column selection and value binding are different controls."
difficulty = "intermediate"
[[legacy]]
id = "moderation-note-log-framing"
source = "def log_moderation_note"
sink = "logger.info("
flow = ["multiline moderation note", "rendered log message", "line-oriented logger"]
secure_flow = ["multiline note", "JSON string escaping", "single physical log line"]
control = "Serialize the message payload as a single JSON record."
review = "The finding depends on a line-oriented log. The fixture exercises a normal multiline note."
[[legacy]]
id = "sync-result-log-event-catalog"
source = "def log_sync_result"
sink = "logger.warning("
flow = ["peer status", "message formatting", "line-oriented logger"]
control = "Select a trusted message or a constant fallback."
review = "The peer status domain is deliberately small. The test confirms both a known status and unexpected multiline input."
[[legacy]]
id = "thumbnail-filesystem-error"
source = ["except OSError as exc", ""]
sink = ["return 500", "return 500"]
flow = ["filesystem error", "public error body"]
control = "Return a fixed public error body."
review = "Small but realistic failure path. Local temporary-file and missing-file outcomes are observable."
[[legacy]]
id = "ledger-database-error"
source = ["except sqlite3.Error as exc", ""]
sink = ["return 503", "return 503"]
flow = ["SQLite error", "public error object"]
control = "Translate SQLite failures to a fixed public message."
review = "A real local SQLite schema error distinguishes response behavior without requiring an external database."
[[legacy]]
id = "billing-https-context-verification"
sink = ["context.verify_mode =", "context = ssl.create_default_context"]
control = "Use default certificate and hostname verification for the fixed HTTPS endpoint."
review = "The fixture inspects the TLS context at a fake transport boundary. It does not establish handshake behavior."
difficulty = "intermediate"
[[legacy]]
id = "mail-relay-tls-trust-source"
source = ["def open_relay_tls", ""]
sink = "context = ssl.create_default_context"
flow = ["CA bundle selection", "TLS context trust store", "relay connection"]
control = "Load only deployment-managed CA trust alongside the configured relay name."
review = "Realistic trust-root provenance distinction. The trust-loading call and server hostname are observed through a fake context."
difficulty = "intermediate"
[[legacy]]
id = "download-grant-random-token"
sink = ["return random.randbytes", "return secrets.token_hex"]
control = "Use the OS-backed secrets API for the bearer token."
review = "Trivial source-selection case. The check observes generator selection and output format, not unpredictability."
[[legacy]]
id = "device-pairing-random-code"
sink = ["random.randrange(", "secrets.randbelow("]
control = "Use a cryptographic generator; external flow must control attempts and expiry."
review = "The evidence covers generator selection and formatting. Rate limits, replay protection and code lifetime are outside the snippet."
[[legacy]]
id = "preview-tempfile-permissions"
sink = ["handle = path.open(", "with NamedTemporaryFile("]
control = "Create an owner-only temporary file from the start."
review = "POSIX umask, directory visibility and identity are material. Windows runs cannot establish the stated POSIX permission outcome."
status = "unverified"
difficulty = "intermediate"
[[legacy]]
id = "export-staging-file-creation-mode"
sink = "fd = os.open("
control = "Request mode 0600 during exclusive creation."
review = "Context-specific POSIX accessibility; the phase does not verify access as another UID."
status = "unverified"
difficulty = "intermediate"
[[legacy]]
id = "preferences-data-only-decoding"
source = "def decode_preferences"
sink = ["pickle.loads(", "json.loads("]
flow = ["client message bytes", "pickle deserialization", "preferences validation"]
control = "Bounded JSON parsing and validation of expected fields."
weak_control = "Checks fields after invoking the object decoder."
review = "The trust boundary is explicit. Field validation after object construction is ineffective for the named weakness. No executable decoding evidence."
status = "unverified"
[[legacy]]
id = "uploaded-catalog-storage-format"
source = "def read_catalog_titles"
sink = ["titles = catalog[", "titles = json.load("]
flow = ["uploaded shelf", "pickled value at lookup", "decoded titles"]
control = "Use a bounded JSON array with string-element validation."
weak_control = "Read-only shelf mode prevents writes but still decodes objects."
review = "The difference between opening a shelf and reading the pickled value is annotated; no uploaded shelf is decoded by the benchmark."
status = "unverified"
difficulty = "intermediate"
[[legacy]]
id = "reset-token-log-minimization"
source = ["def record_reset_request", ""]
sink = "logger.info("
flow = ["reset credential", "formatted log entry"]
control = "Keep the reset credential out of the logging function."
review = "A direct disclosure contrast with a fake credential and no recovery service."
[[legacy]]
id = "gateway-header-log-allowlist"
source = "def record_gateway_result"
sink = "logger.info("
flow = ["request headers", "gateway metadata", "log message"]
control = "Allowlist header presence and omit all header values."
review = "Realistic diagnostic metadata contrast; checks case-insensitive header presence and omission of a fake credential."
difficulty = "intermediate"
[[legacy]]
id = "profile-bearer-request-location"
source = "def profile_request"
sink = ["return Request(", "add_unredirected_header("]
flow = ["bearer credential", "URL query", "Request object"]
secure_flow = ["bearer credential", "nonforwarded Authorization header", "Request object"]
control = "Keep the credential in an unredirected Authorization header."
review = "The fixture inspects request and offline redirect objects; it makes no HTTP request."
difficulty = "intermediate"
[[legacy]]
id = "account-recovery-post-body"
source = "def recovery_verify_request"
sink = "return Request("
flow = ["recovery code", "URL query", "POST request"]
secure_flow = ["recovery code", "encoded form body", "POST request"]
control = "Move the code into the form body and omit sensitive bodies from diagnostics."
review = "POST alone is an intentional distractor. The test checks request construction without contacting a service."
[[legacy]]
id = "dashboard-session-cookie-transport"
source = "def dashboard_cookie"
sink = "OutputString("
control = "Set the Secure cookie attribute."
review = "The test parses the actual serialized header; transport and browser behavior are out of scope."
[[legacy]]
id = "handoff-cookie-transport-policy"
source = "def attach_handoff_cookie"
sink = "response.set_cookie("
control = "Set Secure from the public HTTPS policy, independent of proxy-to-app transport."
review = "The fixture observes Django-compatible response arguments. It does not test Django middleware or an actual proxy."
difficulty = "intermediate"
framework = "django"
[[legacy]]
id = "outbound-metrics-credential-source"
source = ["token = \"synthetic", "token = os.environ"]
sink = "return {\"Authorization"
finding = "token = \"synthetic"
control = "Require a runtime credential instead of using a source-code fallback."
review = "Obvious literal serves as an introductory scenario; verification observes distinct behavior under missing and present configuration."
[[legacy]]
id = "inbound-hook-shared-secret-source"
source = ["expected = b\"synthetic", "expected = os.environ"]
sink = "return compare_digest("
finding = "expected = b\"synthetic"
control = "Require the deployment's expected secret and deny missing configuration."
weak_control = "Timing-resistant comparison does not protect a hardcoded expected secret."
review = "The fake fixture exercises normal authentication and observes configuration dependence in memory."
difficulty = "intermediate"
[[legacy]]
id = "billing-rollup-capability"
source = "def read_billing_rollup"
sink = "return conn.execute("
control = "Require a trusted billing-auditor capability before reading."
review = "An in-memory database and fabricated roles exercise denied and allowed access. The location marks the operation with the missing guard."
[[legacy]]
id = "workspace-export-capability"
source = "def queue_workspace_export"
sink = "return queue.enqueue("
control = "Apply the workspace-specific export entitlement before queuing."
review = "A fake queue observes policy ordering and side-effect suppression; separate worker-time policy is outside scope."
difficulty = "intermediate"
[[legacy]]
id = "member-password-memory-hard-hash"
source = "def member_password_record"
sink = ["return salt, sha256(", "digest = scrypt("]
control = "Use a salted, versioned memory-hard KDF."
weak_control = "Unique salts prevent digest reuse but do not raise work per guess."
review = "Guidance-based comparison. This phase does not benchmark memory or password guess resistance."
difficulty = "intermediate"
[[legacy]]
id = "operator-password-pbkdf2-work-factor"
source = "def operator_password_record"
sink = "digest = pbkdf2_hmac("
finding = "rounds = 1_000"
control = "Choose and version an appropriate PBKDF2 work factor."
review = "A deliberately obvious parameter difference with a guidance-dependent threshold. No work-factor measurement was performed."
difficulty = "intermediate"
[[scenario]]
id = "support-ticket-audit"
cwe = "CWE-532"
source = "def acknowledge"
sink = "self.audit.info("
flow = ["support ticket payload", "receipt construction", "operational log"]
control = "Use the receipt identifier as the audit field and keep the body out of logs."
insecure = "The acknowledgement logs the complete support-ticket body, which may contain private information."
secure = "The acknowledgement logs only the receipt ID and preserves the receipt response."
review = "Separate receipt construction and logging across two modules; verification observes output and a fictional private field."
difficulty = "intermediate"
[[scenario]]
id = "fulfillment-diagnostics"
cwe = "CWE-209"
source = ["except InventoryUnavailable as error", ""]
sink = "return 503"
flow = ["inventory service exception", "reservation view", "public response"]
control = "Return a public error code and correlation ID; emit only approved internal diagnostics."
insecure = "The reservation view puts inventory-service diagnostics in its public error body."
secure = "The response contains a fixed error and a request identifier. Normal stock results are preserved."
review = "Checks the successful inventory call and a controlled service failure without networking."
difficulty = "intermediate"
[[scenario]]
id = "project-archive-permission"
cwe = "CWE-862"
source = "project_id = request.json"
sink = "self.projects.mark_archived("
control = "Enforce the trusted membership policy before any write and retain unauthenticated rejection."
insecure = "The endpoint checks authentication but omits its available per-project authorization policy."
secure = "The endpoint checks a trusted membership role before creating the archive side effect."
review = "A two-module endpoint and policy fixture covers anonymous, viewer and maintainer outcomes."
difficulty = "advanced"
[[scenario]]
id = "helpdesk-transcript-renderer"
cwe = "CWE-79"
source = "transcript = self.transcripts.get("
sink = "fragments.py::return f"
flow = ["stored transcript", "preview service", "renderer text-node interpolation"]
secure_flow = ["stored transcript", "preview service", "renderer HTML text escaping", "text node"]
control = "Escape stored transcript text in its HTML text-node context."
insecure = "The renderer passes stored transcript text through as HTML markup."
secure = "The renderer escapes the text while retaining the receipt identifier and markup around it."
review = "The source and sink span files. The fixture measures parsing of harmless transcript text and the missing-record path."
difficulty = "advanced"
[[negative]]
id = "approved-dashboard-sort"
cwe = "CWE-89"
source = "def dashboard_names"
sink = "return connection.execute("
control = "An Enum limits SQL fragments and the account selector is bound."
secure = "The dynamic-looking ORDER BY value comes only from two authored SQL expressions. Unknown names fail before SQLite receives a statement."
review = "False-positive probe for formatted SQL and explicit allowlist provenance."
difficulty = "intermediate"
[[negative]]
id = "worker-tool-registry"
cwe = "CWE-78"
source = "def emit_worker_version"
sink = "return subprocess.run("
control = "Resolve a public label to a fixed argument tuple and launch without a shell."
secure = "The request chooses a registry entry for a fixed version command. The selected binary locations are deployment-controlled."
review = "Uses a mocked process interface. Neither executable is started."
difficulty = "intermediate"
[[negative]]
id = "internal-shell-status"
cwe = "CWE-78"
sink = "return subprocess.run("
control = "Use a constant command, fixed shell path and working directory, and explicit environment."
secure = "Shell use is visible but the executed expression and environment contain no user input. Assumes an administrator-controlled POSIX installation."
review = "Deliberate shell keyword false-positive case. A process spy checks the constant call; no shell is launched."
difficulty = "intermediate"
[[negative]]
id = "opaque-help-asset"
cwe = "CWE-22"
source = "def read(self, opaque_key)"
sink = "return 200, asset.read_bytes()"
control = "Look up an opaque key in a trusted catalog of public file handles."
secure = "The input selects a preloaded public asset and never becomes a filesystem path."
review = "The catalog must be populated by trusted code. Verification reads a temporary fixture through one known key."
difficulty = "intermediate"
[[negative]]
id = "local-value-roundtrip"
cwe = "CWE-502"
source = "def copy_display_preference"
sink = "return pickle.loads("
control = "Serialize a new primitive-only value inside the same function and deserialize only those locally generated bytes."
secure = "The caller controls a bounded enum-like string. The object decoder receives bytes created in the same call from an exact, validated primitive value."
review = "A same-process provenance counterexample. The decoder is replaced by a spy that checks canonical local bytes; no pickle input is decoded."
difficulty = "advanced"
[[negative]]
id = "fixed-options-fragment"
cwe = "CWE-79"
source = "def language_option"
sink = "return '<option"
control = "Quote and escape the value attribute and escape visible option text."
secure = "Both dynamic fields are escaped before insertion into their respective HTML contexts."
review = "Tests harmless strings containing quotes and angle brackets, checking parsed fields and element shape."
difficulty = "intermediate"
[[negative]]
id = "audit-selection-before-serialize"
cwe = "CWE-532"
source = "def log_checkout"
sink = "logger.info("
control = "Construct a new event from the permitted count before serialization."
secure = "Passing the checkout into the function does not mean the whole object reaches the log. The emitted event contains only type and item count."
review = "Fake private fields in cart items and checkout metadata are absent from the emitted event."
difficulty = "intermediate"
[[negative]]
id = "exception-observer"
cwe = "CWE-209"
source = "except RuntimeError as error"
sink = "return 503"
control = "Send details to a trusted internal observer and use a constant public response."
secure = "The exception becomes text only for an internal observer. The public response is independent of the exception message."
review = "The fixture differentiates the response channel from the private observer."
difficulty = "intermediate"
[[negative]]
id = "reproducible-layout-jitter"
cwe = "CWE-338"
source = "def preview_positions"
sink = "generator = random.Random("
control = "Use the PRNG exclusively for deterministic non-security presentation."
secure = "Layout coordinates confer no authority and contain no credential, so a seeded PRNG is appropriate."
review = "A sink-context counterexample. The test observes repeatability, length and coordinate bounds."
difficulty = "introductory"
[[negative]]
id = "tls-guard-at-connector"
cwe = "CWE-295"
source = "context = config.server_context"
sink = "return context.wrap_socket("
control = "Require certificate and hostname checks immediately before socket wrapping."
secure = "The injected context may be misconfigured, but the connector refuses to wrap it unless server authentication is enabled and the expected name is supplied."
review = "Assumes trusted, request-local configuration. The fixture observes guards with a fake socket wrapper."
difficulty = "advanced"
[[negative]]
id = "secure-browser-policy-cookie"
cwe = "CWE-614"
source = "secure: bool"
sink = "response.set_cookie("
control = "Validate the secure flag at construction and store it in a frozen policy."
secure = "The cookie call receives a variable flag whose policy object requires True at construction and is not mutated by untrusted code."
review = "The variable-looking Secure argument is invariant over supported application use."
difficulty = "advanced"
framework = "django-compatible"
[[negative]]
id = "account-scoped-invoice-query"
cwe = "CWE-862"
source = "def read_invoice"
sink = "return connection.execute("
control = "Bind the authenticated principal's server-side account scope in the database predicate."
secure = "The chosen invoice number is checked against the principal's account inside the query, so no standalone authorization branch is required."
review = "A real in-memory SQLite query verifies own-account lookup and no row outside that account under the server-side principal assumption."
difficulty = "advanced"
|