opencode-browser-annotation-plugin 0.6.0 → 0.6.1
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.
- package/extension/manifest.json +1 -1
- package/extension/overlay.js +14 -2
- package/package.json +1 -1
package/extension/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "OpenCode Browser Annotation",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"description": "Alt+A to annotate an element, Alt+Shift+A for the annotation list. Sends element metadata to your OpenCode agent.",
|
|
6
6
|
"permissions": [
|
|
7
7
|
"activeTab",
|
package/extension/overlay.js
CHANGED
|
@@ -355,9 +355,18 @@
|
|
|
355
355
|
try {
|
|
356
356
|
const tag = el.tagName.toLowerCase();
|
|
357
357
|
const attrs = [];
|
|
358
|
+
const nameAttr = el.getAttribute("name") || "";
|
|
359
|
+
const typeAttr = el.getAttribute("type") || "";
|
|
360
|
+
// Redact the value= of any input whose name/type looks sensitive (CSRF
|
|
361
|
+
// tokens, passwords, hidden auth fields), regardless of input type.
|
|
362
|
+
const valueIsSecret = SECRET_ATTR.test(nameAttr) || /password|hidden/i.test(typeAttr);
|
|
358
363
|
for (const a of Array.from(el.attributes || [])) {
|
|
364
|
+
// Skip class/style: class is already captured (cleaned) in `classes`,
|
|
365
|
+
// and inline style is noise. This avoids duplication and the ugly
|
|
366
|
+
// mid-class truncation.
|
|
367
|
+
if (a.name === "class" || a.name === "style") continue;
|
|
359
368
|
let v = a.value;
|
|
360
|
-
if (SECRET_ATTR.test(a.name) || (a.name === "value" &&
|
|
369
|
+
if (SECRET_ATTR.test(a.name) || (a.name === "value" && valueIsSecret)) {
|
|
361
370
|
v = "[redacted]";
|
|
362
371
|
} else if (v && v.length > 120) {
|
|
363
372
|
v = v.slice(0, 120) + "…";
|
|
@@ -365,7 +374,7 @@
|
|
|
365
374
|
attrs.push(v === "" ? a.name : `${a.name}="${v}"`);
|
|
366
375
|
}
|
|
367
376
|
const open = `<${tag}${attrs.length ? " " + attrs.join(" ") : ""}>`;
|
|
368
|
-
return open
|
|
377
|
+
return open;
|
|
369
378
|
} catch {
|
|
370
379
|
return undefined;
|
|
371
380
|
}
|
|
@@ -395,6 +404,9 @@
|
|
|
395
404
|
framework: fw ? fw.framework : undefined,
|
|
396
405
|
html: safeOpenTag(el),
|
|
397
406
|
};
|
|
407
|
+
// Drop the opening tag if it carries no attributes beyond the tag name
|
|
408
|
+
// (redundant with `tag` once class/style are excluded).
|
|
409
|
+
if (m.html && /^<[a-z0-9-]+>$/i.test(m.html)) delete m.html;
|
|
398
410
|
for (const k of Object.keys(m)) if (m[k] === undefined) delete m[k];
|
|
399
411
|
if (Array.isArray(m.ancestors) && m.ancestors.length === 0) delete m.ancestors;
|
|
400
412
|
return m;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-browser-annotation-plugin",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Select an element in your browser, type an instruction, and send it to your OpenCode agent over a loopback + SSH tunnel. Text and element metadata only (no screenshots).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|