docs(spec): entrypoint detection for typescript, matching python - #150
Open
rahlk wants to merge 1 commit into
Open
docs(spec): entrypoint detection for typescript, matching python#150rahlk wants to merge 1 commit into
rahlk wants to merge 1 commit into
Conversation
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec for TypeScript entrypoint detection at parity with codeanalyzer-python's #27. Committed as provenance; no code.
Starting point
TypeScript has none.
grep -rniE "entry_?point" src/returns one hit, and it is a bundler comment indataflow/pool.ts.codeanalyzer/entrypoints/, 5 filesPyEntrypoint,PyEntrypointReportis_entrypoint,entrypoint_frameworks--entrypoint-rulesWithout this, the analyzer emits a call graph with no distinguished roots — so a consumer cannot ask what is reachable from outside the application, which is the first question any taint or attack-surface query asks.
What the spec commits to
Mirror python's contract exactly:
TSEntrypoint/TSEntrypointReport,entrypoints+is_entrypointonTSCallableandTSType, the same Neo4j properties, a declarative rules file with a stage-0 framework gate,--entrypoint-rulesfor user rules, gradeddeclared|certain|heuristicconfidence,via:dispatch modelling, and a coverage report. Level-free L1 post-pass; rule loading is a hard error, detection is best-effort and never aborts the analysis.The part that cannot be ported
Python's engine has two matchers — decorators and base classes — and they cover its ecosystem. They do not cover TypeScript's:
app.get('/p', h)— a callapp/**/route.ts,+server.tshandlerbin/mainin package.jsonSo the rules format has to be designed for three matcher kinds python never needed, rather than copied and extended later. Two decisions are called out explicitly: whether a file-convention entrypoint can hang off a module (python's schema has no module-level entrypoints, so this would diverge from the shared vocabulary), and how call-site matching stays level-free — recommendation is a syntactic L1 match at
confidence: heuristicrather than gating Express to-a >= 2and breaking "identical at every -a".What TS has going for it
Better positioned than python was: decorators are structured and checker-resolved as of #143 —
qualified_nameis the direct analog of the Jedi definition path python matches on, andpositional_arguments/keyword_argumentsare exactly whatroute: {from: positional, index: 0}needs. Heritage is resolved tocan://ids, so transitive base matching is a graph walk rather than a name match. And the stage-0 gate has two ready sources inTSImportand the artifact layer'sTSDependency, where python had to regex manifests.Recommendation on #72
#72 ("entrypoint finders (Express/Angular routes)") is scoped too narrowly — two frameworks and no engine. Built as written it would produce hardcoded detectors with no rules file, no confidence grading, no coverage report and no extensibility, then need rewriting for parity. Retitle it or close it in favour of the engine-shaped unit.
Caveats it states plainly
Controllerin a non-NestJS project must not register, which is why the stage-0 gate is not an optimisationheuristic; Express handlers registered via a variable or helper will be missed, and that belongs in the report'sunresolvedcounts