| description | How READS_FROM, WRITES_TO, and FLOWS_TO model I/O and value flow, and how to read their edge properties. |
|---|
This page explains the three relationships that model how code touches external
resources and how values move between them: READS_FROM, WRITES_TO, and
FLOWS_TO. For the one-line schema summary see Graph Schema;
this page is the detailed reference.
All three are opt-in. They belong to the io capture group, which is
excluded from the default capture set, so a default build emits none of them and
does no extra work. Enable them with the io capture group (see
Capture Groups).
The design borrows the vocabulary of taint analysis, a standard technique in program analysis. The idea is a drop of dye in water: mark a value where it enters the program, then follow it wherever it spreads.
- A source is where a value enters from the outside world (reading an environment variable, a file, a socket). A value read from a source is tainted — it carries a note about where it came from.
- Propagation is how that note travels: through assignments, into function calls as arguments, and back out through return values.
- A sink is where a value leaves for the outside world (writing to standard output, to a file, over the network).
"Taint" carries no other meaning here. When the docs say "x is tainted by
ENV::K", read it as "x holds a value that originated at the ENV::K
resource, and the analysis is tracking it until it is written out or
overwritten." Turning that tracking into graph edges is what lets a single
query answer does anything from this source reach that sink?
Sources and sinks are represented by synthetic Resource nodes. A resource
qualified name has the form resource::<KIND>::<identity>:
identityis the static string literal target when one is available (a file path, an environment variable name) and<dynamic>when the target is not a compile-time constant (for exampleopen(path)wherepathis a variable, or standard streams that have no literal target).KINDis one of the values below. The table shows what each represents and, for the current Python registry, which calls produce it and in which direction.
KIND |
Represents | Detected from (Python) | Direction |
|---|---|---|---|
FILE |
A file on disk | open(...) and pathlib.Path(...), and their handle methods (.read, .write, .read_text, …), bound (p = Path(x); p.read_text()) or inline (Path(x).read_text()); json.load / json.dump |
read + write |
ENV |
An environment variable | os.getenv(...), os.environ.get(...), os.environ["K"] (read); os.environ["K"] = v (write); os.environ.setdefault(...) (read + write) |
read + write |
NETWORK |
A network endpoint / URL | requests.get / .head, urllib.request.urlopen, httpx.get (read); requests.post / .put / .patch / .delete, httpx.post (write); httpx.Client / AsyncClient and aiohttp.ClientSession handle methods |
read + write |
DATABASE |
A database connection | sqlite3.connect(...) handle methods (.execute, .fetchone, .commit, …) |
read + write |
SOCKET |
A network socket | socket.socket(...) handle methods (.recv, .send, …) |
read + write |
STDOUT |
Standard output | print(...), print(..., file=sys.stdout), sys.stdout.write / .writelines |
write |
STDIN |
Standard input | (defined in the schema; no Python source registered yet) | — |
STDERR |
Standard error | print(..., file=sys.stderr), sys.stderr.write / .writelines |
write |
PROCESS |
A command being run; a tainted value reaching it models command injection | subprocess.run / call / check_call / check_output / Popen, os.system, os.popen |
write |
ENDPOINT |
An HTTP route a handler serves | (not an I/O call: written by endpoint detection) | — |
RPC |
A codegen contract operation, shared by its client stubs and server implementations | (not an I/O call: written by RPC linking) | — |
DISPATCH |
A string key that task-queue and workflow handlers are registered under | (not an I/O call: written by dispatch linking) | — |
CONTRACT |
An operation a contract file declares | (not an I/O call: written by contract linking) | — |
Example: os.getenv("K") refers to resource::ENV::K; print(x) refers to
resource::STDOUT::<dynamic>. The registry is extended in
codebase_rag/parsers/io_access/registry.py. The Python registry does not yet
register STDIN sources, but other languages emit them (for example C
scanf).
print(x, file=...) writes where its file= argument says:
sys.stdoutorsys.stderr(also throughfrom sys import stderr) is that stream;- a name or
self.<attr>bound to a handle (f = open("out.txt", "w")) is that handle's resource,FILE::out.txt: the binding in effect where the print runs, so a rebind in a siblingif/elsebranch does not count, a name rebound toNoneis stdout again, and a local named like an imported stream (err = open(...)afterfrom sys import stderr as err) is its file; - any other stream, such as a parameter, records no edge rather than claiming stdout.
In JavaScript and TypeScript, process.env.K and process.env["K"] read
ENV::K, and so do the binding forms of the same read:
const { K } = process.env, including a renamed or defaulted property ({ K: k },{ K = "dev" });- a parameter that defaults to
process.env(function f({ K } = process.env)); - an alias (
const env = process.env; env.K).
The bound local carries the value into FLOWS_TO. A ...rest element reads
ENV::<dynamic>.
These connect a callable to a resource it touches. The direction is decided by the call and (for file handles) its mode:
| Code | Edge |
|---|---|
os.getenv("K") |
Function -READS_FROM-> Resource(ENV::K) |
print(x) |
Function -WRITES_TO-> Resource(STDOUT::<dynamic>) |
print(x, file=sys.stderr) |
Function -WRITES_TO-> Resource(STDERR::<dynamic>) |
open("out.txt", "w") |
Function -WRITES_TO-> Resource(FILE::out.txt) |
open("cfg.yaml") |
Function -READS_FROM-> Resource(FILE::cfg.yaml) |
The source of the edge is the immediate enclosing scope of the call — the
Function, Method, or Module that directly contains it. A read or write
inside a nested function is attributed to that nested function alone, never
bubbled up to an enclosing function or the module. (This matches how CALLS is
attributed, and how FLOWS_TO treats nested scopes below.)
An inline callback is the exception: a Python lambda, a JS/TS arrow or
function expression with no name of its own, a Go func literal, a Java or C#
lambda, or a Rust closure. Such a callback has no caller of its own, so it runs
as part of the function that writes it. In
items.forEach((x) => console.log(x)) the write is attributed to the enclosing
function, as the callback's CALLS are. A value the callback reads from the
enclosing scope flows into its sinks. A return inside the callback leaves the
callback, not the enclosing function. A named callback (const handler = (req) => …) is a function of its own and keeps its own edges. A callback bound to a
local (let g = || … in Rust, g := func() {…} in Go, Runnable r = () -> …
in Java, Action a = () => … in C#) counts as named too: it runs only where
that name is called, so the enclosing function is not credited with its I/O.
FLOWS_TO records value flow: that a value moved from one place to another.
It turns provenance questions into plain graph reachability. Every FLOWS_TO
edge carries two properties that say what kind of flow it is and how the value
travelled:
FLOWS_TO · <kind> · <via>
│ │ │
relationship which of the channel the
type (always the three value crossed
FLOWS_TO) shapes through
kind is the primary category; via is the precise channel, present on two of
the three shapes. All three below come from one function body:
def build():
return os.getenv("K") # build returns a value read from ENV::K
def forward(v):
print(v)
def leak():
x = os.getenv("K") # x now carries ENV::K
print(x) # shape 1
t = os.getenv("T")
forward(t) # shape 2
r = build()
print(r) # shape 3The four FLOWS_TO edges that body produces. Shape 1 appears twice: once
inside leak, and once through the call to forward:
FLOWS_TO · kind · via
A value read from one resource reaches a write to another within a function
body. No via.
Resource(ENV::K) -FLOWS_TO {kind: resource, scope: flow.leak}-> Resource(STDOUT::<dynamic>)
x is read from ENV::K, then passed to print(x), which writes STDOUT. Both
endpoints are resource nodes. This is the leak/provenance answer: a value
from the environment reached standard output.
The source and the sink need not share a body. t carries ENV::T into
forward, whose print(v) writes STDOUT, so the same body also records
Resource(ENV::T) -FLOWS_TO {kind: resource, scope: flow.leak}-> Resource(STDOUT::<dynamic>)
beside the shape 2 edge for the call itself (see the forward argument taint
under Scope of the current phase). print(r)
adds no fifth edge: r carries ENV::K back from build, the same
ENV::K → STDOUT pair as print(x) in the same scope, and an edge is
recorded once per pair and scope.
scope is the qualified name of the function whose body produced the flow, or
the module's for top-level code. Both endpoints are shared Resource nodes, so
the edge is owned through it. Two functions that leak the same value give two
edges. Each edge is removed when its function's file is re-parsed or its
project is deleted, so a fixed leak does not stay in the graph. An edge that
runs through a function in a file the incremental run leaves alone
(log(os.getenv("K")), where an unchanged log prints) cannot be rebuilt
from the re-parsed caller. Such a composed edge lists in through the
functions it was derived through, and it is put back as long as the caller
still makes a call through one of them with the same origin, or prints what
one of them returns. A direct edge, with no through, is never put back.
A tainted local value is passed as an argument into a first-party callee. via
names the conduit.
Function(leak) -FLOWS_TO {kind: arg, via: arg:0}-> Function(forward)
t (tainted by ENV::T) is passed to forward(t) as the 0th positional
argument, so via = arg:0. A keyword call such as forward(v=t) records
via = kw:v instead. Both endpoints are code nodes; the edge records taint
crossing a call boundary into the callee.
A callee whose return value is tainted flows that value back to its caller.
Function(build) -FLOWS_TO {kind: return, via: return}-> Function(leak)
build() returns os.getenv("K"), and leak does r = build(), so taint
crosses the call boundary out of the callee. via = return is simply the
channel name. This edge is emitted both when the returned value is assigned
(r = build()) and when it is returned directly (return build()).
The arg and return edges can look confusing side by side, because they point
in opposite directions even though the caller is the same in both:
leak -FLOWS_TO {kind: arg}-> forward (leak passes t INTO forward)
build -FLOWS_TO {kind: return}-> leak (build hands a value BACK to leak)
Both come from leak's body — leak is the caller in both. The arrow points
opposite ways because the value travels opposite ways across the call
boundary. Picture each function as a box with input slots on the front and one
output chute on the back:
t ──▶│ forward │ │ build │──▶ r
└─────────┘ └───────┘
value goes IN value comes OUT
caller → callee (arg) callee → caller (return)
leak operates both boxes: it pushes t into forward's input slot
(leak → forward), and it catches what build's chute produces
(build → leak).
Note that the assignment in r = build() is not what flips the direction. A
return value flows out of the callee regardless; the r = only gives that
out-flowing value a name so it can be tracked further downstream (which is how
print(r) later completes the ENV::K → STDOUT resource flow). The rule is
simply:
Direction follows the value. In as an argument → caller → callee (
arg). Out as a return → callee → caller (return).
Read any FLOWS_TO edge as a sentence:
a value flowed from left to right, and it was a
<kind>flow that travelled<via>.
Keeping kind and via as properties on a single relationship type means one
query — MATCH ()-[:FLOWS_TO]->() — walks the entire data-flow graph, and you
filter on r.kind / r.via only when you need the detail.
kind is one of exactly three values:
kind |
Endpoints | Meaning | via |
|---|---|---|---|
resource |
Resource → Resource |
A value read from one resource reaches a write to another. | (none) |
arg |
code → code | A tainted value is passed into a callee as an argument. | arg:<index> or kw:<name> |
return |
code → code | A callee's tainted return value flows back to its caller. | return |
"code" endpoints are Module, Function, or Method nodes.
via names the exact channel the value crossed. It is present only on arg and
return edges (a resource edge has no via):
via |
Appears on | Meaning |
|---|---|---|
arg:<index> |
kind = arg |
Passed as a positional argument; <index> is the 0-based position, e.g. arg:0 for the first argument. |
kw:<name> |
kind = arg |
Passed as a keyword argument; <name> is the parameter name, e.g. kw:token for forward(token=t). |
return |
kind = return |
Handed back through the callee's return statement. |
Within a function body, taint moves and disappears by these rules:
- Copy.
b = acopiesa's taint (and its origin resource) tob. - Rebind to a new source.
x = os.getenv("B")afterx = os.getenv("A")makesxcarryENV::B; the discardedENV::Ano longer flows fromx. - Unpack and walrus. In Python, every name an assignment binds takes the
taint of what it is bound to.
user, pw = getenv("U"), getenv("P")pairs by position, sopwcarriesENV::Pand notENV::U.first, *rest = ...givesrestthe union of the leftover elements. Unpacking a value that is not a literal sequence (a, b = pair) gives every name the whole value's taint. Every target ofa = b = valueis bound, and a walrus (if (tok := getenv("K")):) bindstokfor the code the condition guards. A walrus Python may skip (the right ofand/or, a conditional arm, a chained comparison past its first link, a comprehension, an assert, acaseguard) leaves the name's old taint in place as well. - Transform. A value built from a tainted one is still tainted, with the
union of its operands' origins. In Python this covers a builtin or library
call (
float(raw),json.dumps(cfg)), a method on the value (raw.strip().lower()), string building (f"token={t}", a dynamic format spec such asf"{'':{t}>8}","%s" % t,"{}".format(t),"k=" + t,s += t,", ".join(parts)), arithmetic, containers ([t],{"k": t}), a slice or attribute of the value (t[:4],resp.text),await, and comprehensions ("".join(c for c in t)). This is the usual taint-engine default for code the analysis cannot see into. A first-party callee is not treated this way: it keeps its own return summary, sofresh(t)withdef fresh(v): return "x"is clean. - Taint-clearing calls. A short list of calls whose result reveals nothing
of their input stops taint:
len,bool,id,hash,type,isinstance,issubclass,callable,hasattr,any,all, thehashlib/hmacdigests andcompare_digest, and thestrpredicate and lookup methods (startswith,endswith,is*,count,find,index). Those methods clear only on a receiver known to be a string: a literal or f-string, or a name every binding of which in its scope is a string. That is astrannotation, or a plainname = valuewhose value is a string: an env read such asos.getenv(...)oros.environ[...]with no default or a string default, an unshadowedstr(...)/repr(...)/input(), or a str method such as.strip()on a string. Any other binding form (unpacking,+=, a walrus, a for / with / except target, a match capture, an import, a nested def or class,del, a type parameter or alias, aglobal/nonlocaldeclaration), a name read inside a lambda or comprehension, and a name whose own bindings refer back to it (t = t.strip()) leave the name unknown. On any receiver not known to be a string, such asclient.find(secret)or astrparameter rebound to a client, the receiver and the arguments keep their taint. A comparison (t == "x") ornot tyields a bool and is clean too. Escaping and quoting (html.escape,shlex.quote) deliberately stay transforms:FLOWS_TOtracks where a value came from, and an escaped secret written to stdout still leaks the secret. The list isPY_TAINT_CLEARING_CALLS/PY_TAINT_CLEARING_METHODSincodebase_rag/constants/ast_python.py. - Kill. Assigning a tainted variable to something clean removes its taint:
x = "safe",x = <untainted variable>orx = len(x)meansxis no longer tracked, so a laterprint(x)produces no resource flow. TheREADS_FROM/WRITES_TOedges for the individual calls are still recorded; only the false data-flow edge is suppressed. - Co-occurrence is not flow. An unrelated read sitting next to an untainted
call produces no
FLOWS_TOedge. ReadingENV::Kin the same function that callshelper(u)with an untaintedudoes not connect the two.
A multi-hop chain like a = getenv(...); b = a; c = b; print(c) might look as if
it needs a backward search from the sink (print) down through c → b → a to
the source. It does not. The analyser makes a single forward pass, top to
bottom, carrying one live table:
tainted= { variable name → the origin resource it currently carries }
The table's value is the origin resource, not a pointer to the previous variable, so each assignment copies the origin forward:
a = os.getenv("K") # getenv is a source → tainted = { a: ENV::K }
b = a # 'a' is tainted, copy it → tainted = { a: ENV::K, b: ENV::K }
c = b # 'b' is tainted, copy it → tainted = { a: ENV::K, b: ENV::K, c: ENV::K }
print(c) # sink; look up 'c' → ENV::K → emit ENV::K → STDOUT
By the time the sink is reached, the origin is already known by an O(1) lookup —
there is no sink-to-source traversal. The intermediate variables a, b, c
are not graph nodes; they exist only in this table, and the chain collapses
to a single edge between the two resource endpoints it connects.
Because the origin rides forward at every =, chain length is irrelevant — one
hop or fifty, it is still one sweep and one edge. And if any hop is overwritten
with something clean, that variable drops out of the table (the kill rule
above), so the sink finds nothing and no edge is drawn.
Each function, method, and nested definition is analysed as its own unit. A read, write, or flow is attributed to the immediate scope that contains it, never to an enclosing scope. In particular a value tainted inside a nested function does not leak into the outer function's flow, and the outer function's own reads and writes are unaffected.
FLOWS_TO and its Resource endpoints are only produced when the io capture
group is enabled. When enabled, the resource endpoints of a FLOWS_TO edge are
always ensured as nodes first, so an edge never dangles to a missing node — even
if READS_FROM / WRITES_TO themselves are filtered out by a narrower capture
selection.
Once a graph is built with the io capture group, these Cypher queries answer
the provenance questions the edges are designed for:
// Every value that flows from an environment variable to standard output.
// One edge per producing function, so DISTINCT for the pairs alone.
MATCH (a:Resource)-[r:FLOWS_TO {kind: 'resource'}]->(b:Resource)
WHERE a.kind = 'ENV' AND b.kind = 'STDOUT'
RETURN DISTINCT a.qualified_name, b.qualified_name;
// Multi-hop reachability: does any source reach any sink across calls?
MATCH p = (src:Resource)-[:FLOWS_TO*1..8]->(dst:Resource)
RETURN p;
// Which callables read a given resource directly.
MATCH (fn)-[:READS_FROM]->(r:Resource {qualified_name: 'resource::ENV::K'})
RETURN fn.qualified_name;On the example body above, the first query returns two rows: resource::ENV::K
and resource::ENV::T, each to resource::STDOUT::<dynamic>.
Recorded on the snippet above saved as flow.py; the queries run in mgconsole against the indexed graph.
A resource handle bound in one scope and used in another is resolved against the scope that constructed it, so the I/O is credited to the scope that runs it:
- Instance attributes.
self.conn = sqlite3.connect(...)in__init__(or any method) is visible to every other method, soself.conn.execute(...)in a different method emits the DATABASE edge on that method. - Enclosing locals. A module-level or outer-function
conn = sqlite3.connect(...)is visible to nested functions that use it. A same-named local rebind shadows the inherited handle.
Source and handle detection matches the canonical dotted callee even when the
module is re-exported under its own name. A project that does
from .utils import sqlite3 (a common stdlib/pysqlite3 shim) still has its
sqlite3.connect(...) recognised as a DATABASE handle.
FLOWS_TO is intentionally conservative in this phase:
- Value flow inside a function body is tracked by an intra-procedural walk. A callee
returning different sources on different branches carries every origin to its
callers. It is not path-sensitive: a kill on one branch of an
if/elsedrops taint conservatively. - The Transform rule above is Python's. The lean walks keep narrower
per-language tables: Go type conversions, Rust borrows and value-preserving
methods (
as_bytes,to_string,unwrap), C# await helpers, Dart string interpolation and Rust format macros carry taint, but a JavaScript template literal,+concatenation or.trim()still ends the flow there. A Pythonforstatement does not bind its loop variable to the iterable's taint (a comprehension does). - Return taint composes transitively across functions and files. Per-function summaries are resolved by a worklist fixpoint once every file has been walked, so a callee defined after (or in a different file from) its caller is still known to return a tainted value at the caller's site.
- Forward argument taint composes into callee sinks for Python and every lean-walk
language with a parameter-name extractor, which is now all of them: Go, JavaScript,
TypeScript/TSX, C++, Java, C#, Rust, C, PHP, Dart, Lua and Scala. A
parameter that reaches a write sink inside its body is recorded as a per-function
parameter-sink summary (closed over transitive parameter hand-offs by the same
finalize fixpoint), so a tainted argument passed at a call site emits the full
resource -> resourceflow even when the source and the sink live in different bodies — the logging-wrapper casesecret = getenv('K'); log_it(secret)withlog_it(m): logger.info(m)connects ENV to STDOUT. Only resolved callees participate; there are still noParameternodes and no SSA-level precision. - Forward argument taint also composes through a callee's return value
(pass-through helpers such as
def redact(v): return v): a parameter that reaches the function's return is closed over by the same finalize fixpoint, and a call site passing a tainted argument into such a parameter folds that argument's origins into the callee's return summary, so a caller consuming the return (y = redact(secret); print(y)) resolves the secret to the sink. The composition is keyed by the individual call site, so a second call to the same helper with a clean argument keeps a clean result. A DIRECT pass-through (return v) composes in every language the walk covers: Python, JavaScript, TypeScript, Java, C#, Go, PHP, C, C++, Dart, Rust, Lua and Scala. Two of those spell the return without a keyword and are handled as the body's value rather than a return node: Rust's trailing block expression, and a Scaladefwhose body IS its result (a bare expression, a call, or a block ending in one). Chaining transitively through another call (return other(p)) composes in those same languages: a returned call records which of the enclosing function's parameters it forwards, and the finalize closure follows the hand-off to any depth, so a wrapper of a wrapper resolves. The chain is positional throughout, so forwarding a parameter into a slot the inner callee does not return ends it. - Lua's
...occupies its positional slot but binds no name, so a secret passed into a vararg parameter seeds nothing and the flow stops there. Because Lua requires...to be last, it can never displace a named parameter, so only propagation is affected, not the positional mapping. - The
kind = argedge itself is still recorded one level deep — it marks that a tainted value reached a call — and is emitted alongside the forward composition above. Sources and sinks are direct I/O calls from the registry. - The source/sink registry covers Python, JavaScript, TypeScript (including TSX),
Go, Java, Rust, C, C++, C#, Lua, PHP, Dart, and Scala; a language not in the registry
emits no I/O or flow edges until its table is added. Scala models Predef console
output (
println/print/printf,Console.err.*),scala.io.Source.fromFile/fromURLandscala.io.StdIn.readLinereads, thesys.env/sys.propsapply calls andSystem.getenv/get/set/clearProperty(→ ENV), and thejava.nio.file.Filesinterop read/write surface. PHP models$_GET/$_POST/$_REQUEST/$_COOKIE(untrusted HTTP input → NETWORK) and$_ENV/$_SERVER(→ ENV) superglobal sources,getenv/file_get_contentsreads,file_put_contentsandecho/print(keyword STDOUT sinks) writes, andfopen+ arg-shapedfwrite/fputshandle writes. - Handle-based writes in the lean (non-Python)
FLOWS_TOwalk are being taught incrementally (issue #1204). Go, Rust, Java, C#, JS/TS, and Lua now track handle bindings, so a taint written through a file/socket handle (f := os.Create(p); f.Write(x), Rustlet mut f = File::create(p)?; f.write_all(s.as_bytes())?, Javanew FileWriter(p).write(s)— including the wrappernew BufferedWriter(new FileWriter(p))and factoryFiles.newBufferedWriter(Path.of(p))forms — C#new StreamWriter(p).Write(s), JS/TSfs.createWriteStream(p).write(s), or Lualocal f = io.open(p, "w"); f:write(s)) emits a flow edge to the handle's resource — path-sensitively (a rebind on one branch writes to all feasible resources) and mode-aware (a read-onlyos.Open/File::open/new FileReader/new StreamReaderhandle is not a write sink; Lua'sio.openmode is unknowable to the binder, so it stays a sound may-write gated by the method table). C and C++ cover the arg-shaped libcFILE*API, where the handle rides an argument rather than a receiver (FILE *f = fopen(p, "w"); fwrite(x, 1, n, f),fprintf(f, fmt, x), orfprintf(stderr, fmt, x)to a pre-bound std stream): the tainted payload arguments flow to the handle's resource, an untrackedFILE*degrading toFILE:<dynamic>. Each arg sink pins its payload position —fprintfforwards every non-handle argument (format + varargs), butfwrite(buffer, size, count, stream)forwards onlybuffer(arg 0), so a taintedsize/countis control metadata, not a leak. The libc model applies only to unresolved calls, so a project-defined function that happens to be namedfwrite/fprintfis analysed as itself. C++ also binds type-declaration stream handles (std::ofstream out(p)), so a taintedout << x(stream insertion) orout.write(..)reaches the file. Bothnew-shaped constructors and their wrapper / identity-carrier (new PrintWriter(new File(p))) forms resolve, reusing the same registry tables theREADS_FROM/WRITES_TOwalk uses. Every catalogued handle-write shape across the lean languages now emits a flow edge rather than a falseNO_FLOW. - Python handles start and end flows too (issue #2751). The flow walk binds
the same handles the
READS_FROM/WRITES_TOwalk does:f = open(p),with open(p) as f,conn = sqlite3.connect(p), a derivedcur = conn.cursor(), asocket.socket(), andself.<attr>handles set in another method. A read through a handle is a source (f.read(),s.recv(n),cur.fetchall(),conn.execute("SELECT ..").fetchall(),open(p).read()). A write through one is a sink, sof.write(token)givesENV::K -> FILE::p. Anexecutecall's direction follows its SQL verb. Handles are tracked in source order, not per branch, and rebinding a name to anything else drops its handle. - Nested factory identity resolution (
Files.newBufferedWriter(Path.of("cfg"))and the static-importedof("cfg")spelling) is a lightweight registry-membership check, not shadow-aware (issue #1216): a same-class or inherited method namedof, or a local nested class namedPath, still matches thejava.nio.file.Path.ofregistry entry, so the handle gets a concrete literal identity where<dynamic>would be correct. Both triggers are valid but uncommon Java: for the static-import spelling, a same-class member shadows the import (leaving it unusable at that call site); for the qualified spelling, a local nested class reuses a well-known name likePath. Closing either would mean threading the full call resolver into an intentionally cheap path shared by every language, so this stays an accepted limitation.
These are deliberate ceilings, chosen so the feature is correct and cheap where it applies rather than broad and noisy.
FLOWS_TO covers all 14 supported languages — every language whose
source/sink table is registered in FLOW_REGISTERED_LANGUAGES
(codebase_rag/parsers/io_access/registry.py). Python uses the deep,
path-sensitive walk; the rest use the descriptor-driven lean walk. A file whose
language falls outside this set (an unsupported extension) is still parsed into
the graph where a grammar exists — it simply emits no FLOWS_TO edges, so a
reachability question over it returns UNKNOWN rather than NO_FLOW (see the
three-verdict query below).
| Language | FLOWS_TO |
Walk |
|---|---|---|
| Python | ✅ | deep, path-sensitive |
| JavaScript | ✅ | lean descriptor |
| TypeScript | ✅ | lean descriptor |
| TSX | ✅ | lean descriptor |
| Go | ✅ | lean descriptor |
| Java | ✅ | lean descriptor |
| Rust | ✅ | lean descriptor |
| C++ | ✅ | lean descriptor |
| C | ✅ | lean descriptor |
| C# | ✅ | lean descriptor |
| Lua | ✅ | lean descriptor |
| PHP | ✅ | lean descriptor |
| Scala | ✅ | lean descriptor |
| Dart | ✅ | lean descriptor + Dart selector-chain path |
An empty flow result is ambiguous on its own: "no flow exists" and "the flow sits outside what the analysis covers" look identical, and for assurance questions an absent path must never be read as a pass. Two mechanisms make the distinction queryable:
- Every file-backed
Modulenode carries aflow_coveredboolean:truewhen the module's language is in the source/sink registry and theFLOWS_TOcapture group was enabled at indexing time. A bodied inlinemodstamps the same value as its file; inline Module nodes that keep a syntheticinline_module_*path have no independent coverage and are excluded from gap reporting rather than counted as gaps. Directly queryable in Cypher. - A source-to-sink reachability question, exposed as the
flow_verdictMCP tool, answers with one of three verdicts:FOUND— aFLOWS_TOpath exists; the qualified-name path is returned.NO_FLOW— no path, and every module of the project was inside analysed coverage.UNKNOWN— no path was found, but one cannot be ruled out: part of the project sits outside coverage (the uncovered files are named), or, for a question with a resource at either end, the walk reached a function it cannot follow the value through (that function is named). A handler a value was sent to, and a function other than the source whose writes can go on to the sink (it writes the sink, a resource whose own flows lead there, or a NETWORK resource another handler serves), are such functions: a write records no value, soprint("ok")andprint(item)leave the same edge. A question between two functions keeps the function-level walk: it goes on through what every function it reaches writes, into the handler of an endpoint that function calls.
The coverage read is deliberately project-wide rather than restricted to the
query's reachable surface: without path sensitivity, a flow through an
uncovered file cannot be ruled out from the covered part of the graph, so
narrowing the check would manufacture false NO_FLOW verdicts. Reachability
itself runs client-side over a linear scan of the project's FLOWS_TO
edges, the same discipline as dead-code detection.
