Repository navigation
Commit dd95368
fix(analyzer): stabilize TM1 window identity (#578)
* fix(analyzer): stabilize TM1 window identity
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): track eager receiver side effects
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): preserve lexical TM1 when dataflow abstains
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): require a retained companion owner
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): preserve execution scope in binding evidence
Signed-off-by: Christopher Kevin <[email protected]>
* style(analyzer): simplify binding event deduplication
Signed-off-by: Christopher Kevin <[email protected]>
* fix: preserve runtime and retained shell evidence
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): preserve called-slot identity and cached method evidence
Signed-off-by: Christopher Kevin <[email protected]>
* fix: preserve cached subprocess slot state across scoped imports
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): reconcile explicit cached-slot evidence across scopes
Signed-off-by: Christopher Kevin <[email protected]>
* fix: abstain from cached slot proof after eager effects
Signed-off-by: Christopher Kevin <[email protected]>
* test: retain lexical findings after unknown cached-slot effects
Signed-off-by: Christopher Kevin <[email protected]>
* fix: bound direct called-slot evidence to known execution order
Signed-off-by: Christopher Kevin <[email protected]>
* fix: limit direct slot proof to single assignment targets
Signed-off-by: Christopher Kevin <[email protected]>
* fix: invalidate slot evidence on protocols and unsafe releases
Signed-off-by: Christopher Kevin <[email protected]>
* fix: keep legacy shadow proof isolated from later effects
Signed-off-by: Christopher Kevin <[email protected]>
* fix: abstain from cached replacement proof after unknown effects
Signed-off-by: Christopher Kevin <[email protected]>
* fix: retain native callable detection across cached slot stores
Signed-off-by: Christopher Kevin <[email protected]>
* fix: retain shell findings for native receiver assignments
Signed-off-by: Christopher Kevin <[email protected]>
* fix: preserve native Popen replacement warnings
Signed-off-by: Christopher Kevin <[email protected]>
* fix(analyzer): require proven replacement before revoking lexical TM1
Address the three remaining review findings on lexical TM1 reconciliation,
where a bound shell=True call still ran natively but lost its HIGH finding:
- Untaken expression stores: a walrus in a short-circuited BoolOp operand,
an untaken conditional-expression arm, or a comprehension/generator body
is no longer recorded as replacement evidence. Only constant operands
and tests prove that the store executed.
- Identity-preserving stores: unpacked targets are paired with their RHS
elements. Self-stores are transparent, truthy constants keep the flag,
and native receiver aliases (saved = subprocess, import subprocess as
saved, Popen = subprocess.Popen) keep the native receiver.
- Deferred bodies: an outer store only proves replacement when every
invocation the owner scope can reach sees it. Any reference to the
function, method or class (compound statements, main guards, callbacks,
other bodies) can invoke it from that point on, and decorators or
lambdas can run once defined. This also covers a re-import before a
later invocation.
The release-trigger test for a called function now matches its
module-level twin: the companion abstains and the lexical HIGH remains.
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* test: account for TM1 Python parsing in marker ownership ledger
Main's #784 test expects the tool-misuse ledger event for an invalid
Python file to carry obfuscated_instruction_text. This PR makes tool
misuse parse Python for TM1 reconciliation, so the runner's
higher-precedence syntax_error now names that partial event. Keep the
fail-closed contract: assert the marker reading through the lexical-only
anti-refusal analyzer and keep tool misuse partial with syntax_error.
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(analyzer): keep one TM1 owner for true-prefixed names without AST proof
Port the six true-prefixed TM1 regression tests from #577. This branch
already carries test_true_direct_calls_on_one_line_keep_distinct_locations
as test_true_direct_calls_around_safe_comprehension_keep_distinct_locations,
so only the other five are added. Two of them reported the same call twice
on this branch:
- A variable window for a name spelled `true` (in any case) duplicated
the case-insensitive direct `shell=True` owner at the same call. AST
reconciliation removes that window only when the dataflow companion
takes the call, so a file that does not parse, or a call after an
unknown receiver effect, kept both findings. coalesce_path_findings
now drops such a window when a direct lexical owner starts at the
same call. A window for a call whose direct candidate was folded into
an identical same-line call still reports that call.
- A call-anchored window for a longer true-prefixed name (`true_value`)
used its raw text as identity, so the raw and normalized security
views of one call did not collapse, and reconciliation then moved both
to the call. The window now takes its identity from the normalized
view text, as the direct owner already does.
Also cover both root causes with a test for a nested `true` call after
an unknown receiver effect and a normalized `true_value` call in a file
that does not parse.
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(analyzer): report each true-prefixed shell call that #577 reports
The `\b`-bounded direct pattern does not match `shell=true_value`, so on
this branch such a call was reported only through a variable window. That
window pairs an assignment with a single call, skips an assignment
inside an earlier window, and was dropped outside Python. Compared with
#577 this lost:
- calls in JavaScript and Markdown files, fenced or plain;
- a later call that the AST companion abstains on, for example after an
unknown receiver effect;
- all but the last same-line call in a file that does not parse, and the
second of two identical same-line `shell=true` calls outside Python,
which the direct candidate key folds into one;
- a call whose assignment sits inside the window of an earlier one.
_variable_shell_matches now pairs every assignment of a true-prefixed
name with each call its bounded window reaches, and the nearest
assignment owns each call. Candidate generation, analysis and AST
reconciliation share that list, and a window's candidate identity uses
its full text, so windows to different calls do not collapse on a shared
200-character preview. Outside Python, call-anchored windows for
true-prefixed names are kept, and coalescing still drops one when a
direct owner reports the same call. With an AST, each added window
passes the same visibility, counterevidence, cached replacement and
companion checks as before. Windows for other names are unchanged.
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-authored-by: Christopher Kevin <[email protected]>
Co-authored-by: Narendran Raghavan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>1 parent 8f4ca7d commit dd95368
8 files changed
Lines changed: 4087 additions & 493 deletions
File tree
- src/skillspector
- nodes/analyzers
- tests/nodes/analyzers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| |||
1679 | 1681 | | |
1680 | 1682 | | |
1681 | 1683 | | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
1682 | 1708 | | |
1683 | 1709 | | |
1684 | 1710 | | |
| |||
1689 | 1715 | | |
1690 | 1716 | | |
1691 | 1717 | | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
1703 | | - | |
1704 | | - | |
1705 | | - | |
1706 | | - | |
1707 | | - | |
| 1718 | + | |
1708 | 1719 | | |
1709 | 1720 | | |
1710 | 1721 | | |
| |||
1813 | 1824 | | |
1814 | 1825 | | |
1815 | 1826 | | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
1816 | 1876 | | |
1817 | 1877 | | |
1818 | 1878 | | |
| |||
2171 | 2231 | | |
2172 | 2232 | | |
2173 | 2233 | | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
2174 | 2263 | | |
2175 | 2264 | | |
2176 | 2265 | | |
| |||
0 commit comments