Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
show on this site's /mcp
CLI
abso show 82 --json
JSON
/christopher/abso-core/versions/82?format=json

Terminal text: conceal (SGR 8) is found by value, as a terminal reads it. 08, 008 and 8:1 are 8 too and are dropped. 038;05;8 is still a color and is kept.

of shared·pinch··Not checked

Version 81 · Files at version 82

2 files, 15 lines added, 5 removed.

--- a/client/src/terminal-text.ts
+++ b/client/src/terminal-text.ts
@@ -22,19 +22,23 @@
2222}
2323
2424/**
25− * An SGR sequence without parameter 8 (conceal), which would hide the text after it from the reader. The 8 in an
26− * extended color (38;5;8, 48;2;8;8;8) is a color, so those are copied whole. Nothing is left when 8 was all it said.
25+ * An SGR sequence without parameter 8 (conceal), which would hide the text after it from the reader. Parameters
26+ * are read by value, as a terminal reads them: 08 and 8:1 are 8 too. The 8 in an extended color (38;5;8,
27+ * 48;2;8;8;8, 038;05;8) is a color, so those are copied whole. Nothing is left when 8 was all it said.
2728 */
2829function withoutConceal(sgr: string): string {
2930 const parts = sgr.slice(2, -1).split(";");
31+ const value = (p: string | undefined) => (p === undefined ? Number.NaN : Number(p.split(":")[0]));
3032 const kept: string[] = [];
3133 for (let i = 0; i < parts.length; i++) {
3234 const p = parts[i]!;
33− if ((p === "38" || p === "48" || p === "58") && (parts[i + 1] === "5" || parts[i + 1] === "2")) {
34− const n = parts[i + 1] === "5" ? 3 : 5;
35+ const v = value(p);
36+ const mode = value(parts[i + 1]);
37+ if ((v === 38 || v === 48 || v === 58) && !p.includes(":") && (mode === 5 || mode === 2)) {
38+ const n = mode === 5 ? 3 : 5;
3539 kept.push(...parts.slice(i, i + n));
3640 i += n - 1;
37− } else if (p !== "8") kept.push(p);
41+ } else if (v !== 8) kept.push(p);
3842 }
3943 if (kept.length === parts.length) return sgr;
4044 return kept.length === 0 ? "" : `\x1b[${kept.join(";")}m`;
--- a/client/test/terminal-text.test.ts
+++ b/client/test/terminal-text.test.ts
@@ -30,6 +30,12 @@
3030 assert.equal(terminalText(`${ESC}[38;5;8;48;2;8;8;8mx`, true), `${ESC}[38;5;8;48;2;8;8;8mx`);
3131 assert.equal(terminalText(`${ESC}[38;5;8;8mx`, true), `${ESC}[38;5;8mx`);
3232 assert.equal(terminalText(`${ESC}[mx${ESC}[28m`, true), `${ESC}[mx${ESC}[28m`);
33+ // By value, as a terminal reads it (Security 2): leading zeros and a sub-parameter are still 8.
34+ assert.equal(terminalText(`${ESC}[08mx`, true), "x");
35+ assert.equal(terminalText(`${ESC}[1;008mx`, true), `${ESC}[1mx`);
36+ assert.equal(terminalText(`${ESC}[8:1mx`, true), "x");
37+ assert.equal(terminalText(`${ESC}[038;05;8mx`, true), `${ESC}[038;05;8mx`);
38+ assert.equal(terminalText(`${ESC}[38:5:8mx`, true), `${ESC}[38:5:8mx`);
3339 });
3440
3541 it("shows OSC 52 (the clipboard) and OSC 8 (links) as text, with or without colors", () => {