Repository navigation
Work on what the scan reports on real projects, from the false positives of the Python and TypeScript real-code development sets (bench/dag/dev-realcode, tuning halves only), plus one new deterministic fix.
- Protections one call away from the sink (
scanner/src/sast/helper-guards.js, wired intodropGuardedFindings, each drop ledgered under its own kind). The window guards read the lines around a sink; these follow the call on the sink line to the project's own definition. A helper is trusted only when every definition of that name in the scanned tree has the protecting shape.redirect-origin-pinned-by-helper(CWE-601, JS/TS): the redirect target is a project URL builder whose every return fixes the origin, by a literal prefix or bynew URL(path, base)whose arguments read no parameter.sandboxed-template-environment(template injection, Python):from_stringon a Jinja sandboxed environment or a project subclass of one, bound locally, at module level, or imported from the module that builds it.deserialized-authenticated-plaintext(CWE-502, Python): the bytes unpickled are the plaintext of an authenticated decryption (Fernet, an AEAD). A cipher of unknown mode proves nothing.path-confined-by-helper(CWE-22, Python): the opened path was returned by a function that resolves it, tests a path relation and refuses; one level of delegation is followed.
- File-system sinks that are not.
readFile,writeFileand the other JS write sinks no longer match a method of the same name that takes an options record, or a call on a file handle (a local bound to the result ofopen), whosewriteFiletakes the content and no path. - Measured on the real-code sets (16 pinned projects, both engines scanned on the same trees in this session; the labelled sites are a sample). Python: labelled sites still flagged 23 to 19 (tuning 10 to 8, verification 13 to 11), both true positives kept, population 968 to 964 non-info findings. TypeScript: 29 to 22 (tuning 12 to 7, verification 17 to 15), population 1670 to 1661. No site added in either set (one multi-sink summary changed its count and therefore its title). Precision on the labelled sample is now 2 of 19 for Python and 0 of 22 for TypeScript: better, and still poor. The verification halves were not read while the fixes were designed; they are read by the same labeller, so they are not blind to the classes fixed.
- What it did not fix, by design of the rule. Two path findings in one project whose confinement happens in the caller and is passed down as a parameter, or is returned through a nested closure; three markup findings whose content comes from operator-installed plugins or administrator configuration; a request to a URL from an operator-configured upstream. These need facts the code does not state, or an interprocedural summary this release does not add.
- New deterministic fix
prototype-key-guard(CWE-1321, JS/TS): when the finding names a block-bodiedfor (const k in o) {orfor (const k of Object.keys(o)) {header, one guard statement is inserted at the top of the body that skips__proto__,constructorandprototype. The structural detector reads the result as fixed. A callback, a split path, a single-statement loop or a for..of over anything else isneeds-review, never a patch. Required obligations:rescan-original-absent,project-tests. - Gates before the bump. New suites: helper guards 8 of 8, deterministic fix 12 of 12. Taint suite 1,751 pass, 0 fail; detector suite 1,225 of 1,225; mutation 503/503; self-scan no drift (four regular expressions in the new module were first reported by the gate as backtracking risks and were rewritten without nested repetition, not re-baselined); real-code precision baseline re-recorded from the scans above.
A scan that never finished
Re-running the independent population on 0.224.0 lost one chunk of twenty entries: a Ruby project with a 347 KB bundled service worker never finished scanning. The check that decides whether a JavaScript file runs in the browser looked for a "use client" directive after any leading comments, and its expression let one block comment run on into the next, so a file that opens with hundreds of comments made it try every pairing. The directive is now found by a plain walk over whitespace and comments. The old code does not return on that file within 20 seconds; the new code returns in under a millisecond, and the whole project scans to completion. The same forms are read as before (a directive after comments, either quote), and a directive inside a comment or after code is still not one.
Measured on code the engine was not built on
The independent population (283 advisories from third-party projects, development and validation splits, the same entries as the 0.195.32 run) was re-run on this release's engine at commit e31efb7f, run 52f99f514b77. 279 entries scored, 4 timed out at the ten minute limit (large trees, the same class as in earlier runs), none unaccounted.
- Found at the advisory's own location: 74 of 279 (0.195.32: 7 of 279).
- Reported sites that are the advisory's: 74 of 79.
- F1 0.413, 95% interval 0.338 to 0.484 (resampling whole repositories).
A first run on 0.224.0 lost a chunk to the hang described above and is not quoted. On the 258 entries both runs scored, this release's precision changes removed no true positive.
Real-code fix synthesis (bench/fix-correctness, the maintainers' own fix as ground truth): a patch is produced for 1 of 100 localized true positives, at the maintainers' location, with a different approach. The earlier figure was 0 of 11 on 0.208.0. The denominator grew because the engine now finds far more of these; the fixer still answers almost none of them, and that is the weakest measured part of the product.
z3-solver moved to 5.5.0.