Expand description
Emit declaration / reference / call facts plus privilege / dynamic-SQL / unknown facts.
Bridges the semantic-layer extractors (calls, dml-edges,
privilege model, dynamic-SQL evidence, opacity reasons) and
the declaration table into the normalized [Fact] stream
defined by. Each emitter takes the typed
per-family input + a FactProvenance and pushes minted
facts into a FactStore.
“With evidence” (FACT-004): the privilege / dynamic-SQL /
opacity payloads are deliberately lightweight — the evidence a
consumer needs to defend the fact (the grant tuple, the
dynamic-SQL site text, the opacity reason) travels in the
payload string, and richer structured evidence is re-fetched
from the originating crate’s model by FactId.
Keeping emission in one module means the engine wiring layer
has a single call site per fact family and the
FactId derivation stays consistent.
§/oracle evidence
DATABASE-REFERENCE.mdPL/SQL Language Reference — the declaration / reference / call grammar 1:1 with the fact families.LOW-LEVEL-CATALOGS.mdData Dictionary View Families —ALL_OBJECTS(declarations),ALL_DEPENDENCIES(call edges),ALL_IDENTIFIERS(references) are the server-side mirrors.
Structs§
- Cursor
ForLoop Site - One detected cursor
FORloop. - Detail
Fact Site - A site carrying a unit id plus a short detail string (the matched deprecated feature / non-deterministic construct).
- Exception
Handler Site - One detected
EXCEPTION WHEN <scope> THEN <body>handler. - Hardcoded
Credential Site - One string literal that is, by strong syntactic context, a hardcoded secret (SEC003).
- Invoker
Rights Site - One unit declaring invoker’s rights (
AUTHID CURRENT_USER) (SEC004). - IsNull
Indexed Site - One
<col> IS NULLpredicate on a column the same source indexes (PERF003). - Missing
Instrumentation Site - One routine body with no recognized instrumentation call. Reports absence only — STYLE001 (opt-in) decides whether that is a finding.
- Synonym
Fact Site - One sensitive
CREATE PUBLIC SYNONYMsite (SEC005). - Unit
Fact Site - One unit whose
RETURNtype is a REF CURSOR (SEC007), one function with row-level DML in its body (QUAL007), or one unboundedBULK COLLECT(QUAL003). All carry only the unit id — the rule explains; the fact reports presence.
Functions§
- emit_
call_ facts - Emit one
DependencyEdgefact per call site.from_logical_idis the routine the call appeared in; the callee path is joined with.into the edge target. - emit_
cross_ schema_ write_ facts - Emit
CrossSchemaWritefacts (DEP001). - emit_
cursor_ for_ loop_ facts - Emit one
CursorForLoopfact per site, mirroringemit_exception_handler_facts. - emit_
declaration_ facts - Emit one
Declarationfact per registered declaration. Returns the count emitted (post-dedup). - emit_
declarations_ from - Convenience: emit a declaration fact for every entry a
DeclLikesource yields. The trait keeps this module free of a hardplsql-symbolsdependency (which would invert the layer order — symbols depends on ir, not the reverse). - emit_
deprecated_ feature_ facts - Emit
DeprecatedFeaturefacts (QUAL005). - emit_
deterministic_ misuse_ facts - Emit
DeterministicMisusefacts (QUAL008). - emit_
dml_ in_ function_ facts - Emit
DmlInFunctionfacts (QUAL007). - emit_
dynamic_ sql_ facts - Emit one
DynamicSqlEvidencefact per recognised dynamic-SQL site.sitecarries the evidence — typically the logical id of the unit plus a fragment/classification summary fromDynamicSqlEvidence. - emit_
exception_ handler_ facts - Emit one
ExceptionHandlerfact per detected handler so QUAL001 / QUAL004 can consume them viaby_kindlike every other fact-based rule. - emit_
flow_ env_ facts - Emit flow-lattice facts for every tracked name in a
FlowEnv. - emit_
flow_ facts - Emit flow-lattice facts from explicit
(name, ValueFlow)rows. - emit_
hardcoded_ credential_ facts - Emit one
HardcodedCredentialfact per site (SEC003). - emit_
invoker_ rights_ facts - Emit one
InvokerRightsfact per site (SEC004). - emit_
is_ null_ on_ indexed_ column_ facts - Emit
IsNullOnIndexedColumnfacts (PERF003). - emit_
log_ without_ reraise_ facts - Emit
LogWithoutReraisefacts (QUAL002). - emit_
missing_ instrumentation_ facts - Emit one
MissingInstrumentationfact per site. - emit_
mutating_ table_ trigger_ facts - Emit
MutatingTableTriggerfacts (QUAL006). - emit_
privilege_ facts - Emit one
Privilegefact per resolved(grantee, privilege, on)triple. The triple is the evidence: who can do what to which object. Returns the post-dedup count. - emit_
ref_ cursor_ return_ facts - Emit
RefCursorReturnfacts (SEC007). - emit_
reference_ facts - Emit one
Referencefact per (from_decl, to_logical_id) pair. - emit_
sensitive_ public_ synonym_ facts - Emit
SensitivePublicSynonymfacts (SEC005). - emit_
unbounded_ bulk_ collect_ facts - Emit
UnboundedBulkCollectfacts (QUAL003). - emit_
unknown_ facts - Emit one
Opacityfact per(target_logical_id, reason)pair — the “unknown” family.reasonis the evidence string (typically a stringifiedUnknownReason) so a consumer can explain why the analyser could not see through the target. - scan_
cross_ schema_ write - DEP001: a DML statement whose target is schema-qualified to a
schema other than the unit’s own (cross-schema write surface).
Unit schema = first dotted segment of
unit_logical_id. - scan_
cursor_ for_ loops - Scan a routine
sourcefor cursorFORloops, yielding oneCursorForLoopSiteper loop. Text-level, mirroringscan_exception_handlers. A numeric range loop (FOR i IN 1..10 LOOP) is not a cursor loop and yields no site (R13: a false fact is worse than a missing one). - scan_
deprecated_ features - QUAL005: well-known deprecated / legacy constructs. Conservative (R13): only unambiguous, widely policy-flagged forms; literals are masked so a mention in a string never matches. One site per distinct feature found.
- scan_
deterministic_ misuse - QUAL008: a
DETERMINISTICfunction whose body contains a non-deterministic construct. One site per distinct construct. - scan_
dml_ in_ function - QUAL007: a
FUNCTIONwhose body performs row-level DML. Only fires when the source is a function (thefunctionkeyword is present as a word) andbody_has_dml(R13: a procedure with DML is normal and is not flagged here). - scan_
exception_ handlers - Scan a routine
sourcefor its exception section and yield oneExceptionHandlerSiteperWHEN ... THEN ...handler. - scan_
hardcoded_ credentials - Scan
sourcefor hardcoded credentials: a credential marker (in code position, never inside a literal) immediately followed (same statement, before;) by a quoted string literal. Text-level + conservative, mirroringscan_exception_handlers. - scan_
invoker_ rights - Scan
sourcefor anAUTHID CURRENT_USERclause. Literal contents are masked first so the phrase can’t self-match inside a string; whitespace betweenauthidandcurrent_useris collapsed. Conservative:AUTHID DEFINER(or absence) yields no site. At most one site per unit. - scan_
is_ null_ on_ indexed_ column - PERF003: a
<col> IS NULLpredicate where the same source declares an index whose key list containscol. B-tree indexes do not store all-NULL keys, so the predicate forces a full scan. R13: requires BOTH the index DDL and the predicate in this source; catalog-only indexes are out of this source-level scope.is nullis not a substring ofis not null, so negated predicates never match. - scan_
log_ without_ reraise - QUAL002: an exception handler that instruments/logs but neither
re-raises nor signals — the error is recorded then swallowed.
At most one site per unit. Mirrors the lightweight exception-
section split used by
scan_exception_handlers. - scan_
missing_ instrumentation - Scan a routine
source: if it has a body (BEGIN) but no recognized instrumentation marker, yield a singleMissingInstrumentationSite. A spec with no body yields nothing (R13 — we only report a unit we can see executes). - scan_
mutating_ table_ trigger - QUAL006: a
FOR EACH ROWtrigger whose body references its own base table in a query/DML (ORA-04091 mutating-table hazard). R13-conservative: requires a cleanon <table>extraction andfor each row; otherwise no fact. - scan_
ref_ cursor_ return - SEC007: a function returning a REF CURSOR. Detects the common
RETURN SYS_REFCURSORand explicitRETURN REF CURSORforms (strongly-typed named ref-cursor returns need type resolution and are out of this text-level scope — R13, documented). - scan_
sensitive_ public_ synonym - SEC005: a
CREATE [OR REPLACE] PUBLIC SYNONYM <syn> FOR <tgt>where the synonym or its target name matches the sensitivity heuristic. Literal-masked, conservative: a non-public synonym or a benign name yields no fact. - scan_
unbounded_ bulk_ collect - QUAL003: a
BULK COLLECT INTOwith noLIMITin the same statement — unbounded PGA materialization. One site per offending statement.