map: runtime parameter coordinates, spans and fingerprints (schema v2) - #124
Merged
Conversation
|
Adds runtime parameter coordinates and spans to input map schema v2. 🎯 Quality: 91% Elite · 📦 Size: Extra Large — strongly consider breaking this down 🛡️ Standards: no pre-flight fit check ran for this change — wire 📈 This month: Your 57th PR — above team average · Averaging Excellent |
Contributor
Author
|
/review |
daniloradovic
approved these changes
Aug 13, 2026
Track 1 of the agreed two-track plan ("trusted coordinates" before "candidate
generation"): give a server everything it needs to compile a map input into a rule
engine parameter — and, crucially, refuse to emit a coordinate it cannot compile.
- Every input now carries `source` (json-body / form-body / query / route-param /
header / cookie / file / server-fn-data / …) and `runtimeParameter`, the EXACT
engine parameter that addresses it: `post.shipping.email`, `get.q`,
`server.HTTP_X_API_KEY`, `cookie.session`, `files.avatar`. Server-function args are
`post.<path>` because createServerFnGuard delivers them as the JSON body.
- Two cases deliberately return `runtimeParameter: null` + a reason, both verified
against engine/request.js rather than assumed:
* ROUTE PARAMS have no coordinate — the resolver exposes get/post/request/cookie/
server/files, but not `req.params`. Emitting `get.tenant` would compile a rule
that silently never matches.
* ARRAY PATHS have no dotted coordinate — `#getNestedValue` walks own properties, so
`tags[].label` needs an `array_key_value` rule instead.
- `ruleGeneratable` + `ruleGeneratableReasons` on every flow, deliberately SEPARATE from
`confidence`: "the source reaches the sink" is not authorization to block traffic.
Everything still missing is listed, so it doubles as the improvement queue. Nothing is
generatable yet — sink argument roles are unmodelled, which is the Track-2 gate.
- Endpoints and sinks carry `start`/`end` (documented as UTF-16 offsets) and endpoints a
content `fingerprint`, so a server can reject stale coordinates after a deploy.
- Schema version bumped to 2.
Also: PS_MAP_DEBUG surfaces extractor errors. The per-file fail-open is right for
production but made a crash indistinguishable from an unparseable file — it hid a
self-recursion bug in the new span helper during this change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ty families) Generating example outputs surfaced a recall bug in exactly the flows a candidate compiler would target first. `req.body.webhookUrl` produced the read path `body.webhookUrl`, but inputs are named relative to their namespace (`webhookUrl`, whose coordinate is `post.webhookUrl`) — so the two never matched and SSRF / traversal / command-injection flows all came out `heuristic`: axios.get(req.body.webhookUrl) webhookUrl -> http now precise (post.webhookUrl) fs.readFileSync(req.body.filename) filename -> fs now precise (post.filename) exec(req.body.command) command -> exec now precise (post.command) fs.readFileSync(req.query.file) file -> fs now precise (get.file) A leading request-namespace segment is dropped when the root is the request object. Note the direction of the remaining risk: a body field genuinely named `body`/`query` inside a differently-rooted container would be stripped too, which loses precision (heuristic) rather than inventing it — the safe direction. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
patchstackdave
force-pushed
the
feat/map-runtime-coordinates
branch
from
August 13, 2026 13:13
1e97ba8 to
8741138
Compare
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.
Track 1 of the agreed two-track plan — finish trusted coordinates before building candidate generation, without blurring them.
The point
Give a server everything it needs to compile a map input into a rule-engine parameter — and refuse to emit a coordinate it cannot compile.
Every input now carries
sourceandruntimeParameter:{ "name": "shipping.email", "source": "server-fn-data", "runtimeParameter": "post.shipping.email" }post.<dotted path>get.<name>cookie.<name>files.<field>server.HTTP_<UPPER_SNAKE>Server-function args map to
post.*becausecreateServerFnGuarddelivers them as the JSON body.Two cases deliberately return
null+ a reasonBoth verified against
engine/request.js, not assumed — a coordinate the resolver can't resolve compiles into a rule that silently never matches, which is worse than emitting none:get/post/request/cookie/server.*/files— notreq.params. Emittingget.tenantwould be a dead rule.#getNestedValuewalks own properties, sotags[].labelneeds anarray_key_valuerule instead.ruleGeneratable, separate fromconfidence{ "confidence": "precise", "ruleGeneratable": false, "ruleGeneratableReasons": ["sink argument role is not modelled yet"] }precisemeans the source reaches the sink — not authorization to block traffic. Every remaining obstacle is listed, so this doubles as the improvement queue. Nothing is generatable yet: sink argument roles are unmodelled, which is exactly the Track-2 gate.Coordinates you can invalidate
Endpoints and sinks carry
start/end(documented as UTF-16 offsets), and endpoints a contentfingerprint, so a server can reject stale coordinates after a deploy. Schemaversionbumped to 2.A recall bug the example outputs caught
Generating sample maps exposed that the highest-value flows never reached
precise:req.body.webhookUrlproduced read pathbody.webhookUrlwhile the input is namespace-relative (webhookUrl). Fixed — SSRF / traversal / command-injection now come out precise with correct coordinates, and are covered by tests. The residual risk direction is a false negative, not a false positive.Also:
PS_MAP_DEBUGsurfaces extractor errors — the per-file fail-open is right for production but made a crash indistinguishable from an unparseable file, and it hid a self-recursion bug during this change.798 tests green; typecheck clean.