@cadraos/sdk 0.3.14-p46.0 → 0.3.14-p46.2

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.
@@ -82,7 +82,12 @@ var HANDOFF_VERDICT_JSON_SCHEMA = {
82
82
  required: ["label", "url"],
83
83
  properties: {
84
84
  label: { type: "string", minLength: 1, maxLength: 120 },
85
- url: { type: "string", minLength: 1, maxLength: 2e3 }
85
+ url: {
86
+ type: "string",
87
+ minLength: 1,
88
+ maxLength: 2e3,
89
+ description: "An http(s):// URL or a same-origin path starting with '/'. Do not link files you wrote (artifact:<id>) \u2014 they are already attached to the card."
90
+ }
86
91
  }
87
92
  }
88
93
  }
@@ -90,6 +95,7 @@ var HANDOFF_VERDICT_JSON_SCHEMA = {
90
95
  if: { properties: { kind: { const: "DECIDE" } }, required: ["kind"] },
91
96
  then: { required: ["decision"] }
92
97
  };
98
+ var ARTIFACT_REF_URL_RE = /^artifact:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
93
99
  function isSafeHandoffUrl(url) {
94
100
  if (typeof url !== "string" || url.length === 0) return false;
95
101
  if (/[\u0000-\u001f\u007f\s]/.test(url)) return false;
@@ -199,13 +205,15 @@ function parseHandoffVerdict(output) {
199
205
  };
200
206
  }
201
207
  }
202
- for (const [i, l] of (v.links ?? []).entries()) {
208
+ const links = v.links?.filter((l) => !ARTIFACT_REF_URL_RE.test(l.url));
209
+ for (const [i, l] of (links ?? []).entries()) {
203
210
  if (!isSafeHandoffUrl(l.url)) {
204
211
  return { ok: false, reason: `links[${i}].url must be http(s):// or a same-origin /path` };
205
212
  }
206
213
  }
207
214
  const verdict = {
208
215
  ...v,
216
+ ...links ? { links } : {},
209
217
  ...v.state ? {
210
218
  state: {
211
219
  repos: v.state.repos ?? [],