@cairnvibe/indexer 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/manifest.js +18 -5
  2. package/package.json +1 -1
package/dist/manifest.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assembleManifest = assembleManifest;
4
+ exports.parseApiCall = parseApiCall;
4
5
  const node_child_process_1 = require("node:child_process");
5
6
  function assembleManifest(rootDir, facts, l2, l3) {
6
7
  const globalElements = facts.frameworkElements.map((el) => toManifestElement(el, l3.globalElements.find((e) => e.id === el.id), "present in the root layout"));
@@ -29,13 +30,23 @@ function assembleManifest(rootDir, facts, l2, l3) {
29
30
  }
30
31
  const MUTATING_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
31
32
  /**
32
- * Turns l1-scan's traced `"POST /api/items/${id}"`-shaped string into
33
- * structured, executable data — this is what lets a `do` action actually
34
- * run (verb-executor.ts) instead of only ever describing itself. Only
35
- * real mutating methods count as an action; `"navigate ..."` (a Link) and
36
- * a bare GET aren't "do" material — see ApiCallSchema's doc comment in
33
+ * Turns l1-scan's traced `"POST /api/items"`-shaped string into structured,
34
+ * executable data — this is what lets a `do` action actually run
35
+ * (verb-executor.ts) instead of only ever describing itself. Only real
36
+ * mutating methods count as an action; `"navigate ..."` (a Link) and a bare
37
+ * GET aren't "do" material — see ApiCallSchema's doc comment in
37
38
  * @cairnvibe/core for the safety reasoning (bounded to calls a human
38
39
  * developer already wrote and shipped, nothing invented at runtime).
40
+ *
41
+ * Only accepts a clean, static, same-origin relative path. l1-scan.ts's URL
42
+ * capture falls back to a call's raw source text when the first argument
43
+ * isn't a plain string literal — for a template literal (a per-row action
44
+ * built as `` `/api/items/${id}/archive` ``) that's literal backticks and a
45
+ * "${...}" hole, not a real fetchable URL; for a bare identifier or some
46
+ * other expression it isn't a URL at all. Rejecting both instead of
47
+ * guessing at resolving them is what keeps this bounded to calls that are
48
+ * actually safe to fire as-is — see ApiCallSchema's doc comment for the
49
+ * real gap this leaves (per-row actions aren't auto-executable yet).
39
50
  */
40
51
  function parseApiCall(handlerCall) {
41
52
  if (!handlerCall)
@@ -47,6 +58,8 @@ function parseApiCall(handlerCall) {
47
58
  const url = handlerCall.slice(spaceIndex + 1);
48
59
  if (!MUTATING_METHODS.has(method) || !url)
49
60
  return null;
61
+ if (!/^\/[a-zA-Z0-9/_.-]*$/.test(url))
62
+ return null;
50
63
  return { method: method, url };
51
64
  }
52
65
  function toManifestElement(el, elDesc, baseEvidence) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cairnvibe/indexer",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Cairn's analyzer and installer (the `cairn` CLI) — scans Next.js source or crawls any running app, and scaffolds the backend either way.",
5
5
  "license": "MIT",
6
6
  "publishConfig": { "access": "public" },