masking: a record from before a restart says its text was in memory only

brianeee2 on X: in Docker, the masked content can't be seen after the
container restarts; is a mounted folder missing?

No folder is missing. Reproduced on xiaomi-gpu with the image built from
905166d78 (volume on /config, a fake provider with redaction on, a
request carrying DB_PASSWORD=...): /config/magpie/masking/<day>.jsonl
holds the record and survives `docker restart`. The request's text, the
lines around each placeholder, the Sent body and the values behind the
placeholders are memory only by design (maskrec, gateway-routing.md,
README, privacy page; TestNoValueOnDisk), so after a restart they are
gone in any install, Docker or not.

What was wrong is the page. A record with neither body nor snips (every
record from before a restart) said "Still here: ... the line around each
placeholder as the vendor got it" and, under it, that the text was kept
in memory only: one claim false, the two contradicting each other. It
now says once that the request's text and values were kept in memory
only, never on disk, and that the record keeps each value's kind, length
and first characters. The old msk-none line's key goes from i18n.js;
the new one is in en, zh, zh-TW, ja and de.

Run:
- masking-records.test.cjs new test, chromium + webkit, 5 languages at
  640px, on mote: 10/10. Broken by hand: with HEAD's page.js it is red
  ("no second message").
- GUI files mask*, masking*, privacy*, redact*, i18n-keys,
  routing-masking, plugin-page on mote: 380/380.
- go test ./internal/gui/ ./internal/maskrec/ on mote: ok.

Not done: snips and bodies are still not kept on disk; keeping them
would break the documented never-on-disk promise, an owner's call.
What the answer put back (Back) is memory only too and isn't reworded.
This commit is contained in:
yetone
2026-10-29 07:38:50 +08:00
parent f193c3865f
commit 310efb635c
4 changed files with 47 additions and 10 deletions
-4
View File
@@ -4013,7 +4013,6 @@ const I18N = {
"Nothing masked yet": "还没有脱敏过任何内容",
"Load more": "加载更多",
"A vendor": "厂商",
"The text around them was kept in memory only, and magpie has restarted since": "周围的文字只存在内存里,而 magpie 之后重启过",
"1 value masked before it went to the vendor: {kinds}": "发给厂商前脱敏了 1 处:{kinds}",
"{n} values masked before it went to the vendor: {kinds}": "发给厂商前脱敏了 {n} 处:{kinds}",
"API keys": "API 密钥",
@@ -8064,7 +8063,6 @@ const I18N = {
"Nothing masked yet": "還沒有脫敏過任何內容",
"Load more": "載入更多",
"A vendor": "廠商",
"The text around them was kept in memory only, and magpie has restarted since": "周圍的文字只存在記憶體裡,而 magpie 之後重新啟動過",
"1 value masked before it went to the vendor: {kinds}": "發給廠商前脫敏了 1 處:{kinds}",
"{n} values masked before it went to the vendor: {kinds}": "發給廠商前脫敏了 {n} 處:{kinds}",
"API keys": "API 金鑰",
@@ -12117,7 +12115,6 @@ const I18N = {
"Nothing masked yet": "まだ何もマスクしていません",
"Load more": "さらに読み込む",
"A vendor": "ベンダー",
"The text around them was kept in memory only, and magpie has restarted since": "前後のテキストはメモリにのみ保存され、その後 magpie が再起動しました",
"1 value masked before it went to the vendor: {kinds}": "ベンダーに送る前に 1 か所をマスク:{kinds}",
"{n} values masked before it went to the vendor: {kinds}": "ベンダーに送る前に {n} か所をマスク:{kinds}",
"API keys": "API キー",
@@ -16170,7 +16167,6 @@ const I18N = {
"Nothing masked yet": "Noch nichts maskiert",
"Load more": "Mehr laden",
"A vendor": "Ein Anbieter",
"The text around them was kept in memory only, and magpie has restarted since": "Der Text um sie herum lag nur im Speicher, und magpie wurde seitdem neu gestartet",
"1 value masked before it went to the vendor: {kinds}": "1 Wert maskiert, bevor es an den Anbieter ging: {kinds}",
"{n} values masked before it went to the vendor: {kinds}": "{n} Werte maskiert, bevor es an den Anbieter ging: {kinds}",
"API keys": "API-Schlüssel",
@@ -37,6 +37,7 @@ magpie.strings({
"Side by side": "对照",
"This request's whole text is no longer in memory: magpie keeps it for the newest requests only. The lines around each value are still here.": "这条请求的全文已不在内存里:magpie 只保留最近的请求。每个值前后的那一小段还在。",
"What was written is kept in memory only, and magpie has restarted since. Still here: each value's kind, length and first characters, and the line around each placeholder as the vendor got it.": "原文和原值只存在内存里,magpie 重启后就没有了。这里还看得到每个值的种类、长度、开头几个字,以及占位符前后厂商看到的那一小段。",
"This request's text and the values masked in it were kept in memory only, never on disk, and magpie has restarted since. The record keeps each value's kind, length and first characters.": "这条请求的原文和原值只存在内存里,从不写入磁盘,magpie 之后重启过。记录里还留着每个值的种类、长度和开头几个字。",
"Show only the changes": "只看改动",
"Show all of it": "显示全部",
"1 part unchanged": "1 段没有改动",
@@ -128,6 +129,7 @@ magpie.strings({
"Side by side": "對照",
"This request's whole text is no longer in memory: magpie keeps it for the newest requests only. The lines around each value are still here.": "這則請求的全文已不在記憶體裡:magpie 只保留最近的請求。每個值前後的那一小段還在。",
"What was written is kept in memory only, and magpie has restarted since. Still here: each value's kind, length and first characters, and the line around each placeholder as the vendor got it.": "原文和原值只存在記憶體裡,magpie 重新啟動後就沒有了。這裡還看得到每個值的種類、長度、開頭幾個字,以及佔位符前後廠商看到的那一小段。",
"This request's text and the values masked in it were kept in memory only, never on disk, and magpie has restarted since. The record keeps each value's kind, length and first characters.": "這則請求的原文和原值只存在記憶體裡,從不寫入磁碟,magpie 之後重新啟動過。記錄裡還留著每個值的種類、長度和開頭幾個字。",
"Show only the changes": "只看改動",
"Show all of it": "顯示全部",
"1 part unchanged": "1 段沒有改動",
@@ -219,6 +221,7 @@ magpie.strings({
"Side by side": "並べて比較",
"This request's whole text is no longer in memory: magpie keeps it for the newest requests only. The lines around each value are still here.": "このリクエストの全文はもうメモリにありません:magpie は最近のリクエストの分だけ保持します。各値の前後の行はまだ残っています。",
"What was written is kept in memory only, and magpie has restarted since. Still here: each value's kind, length and first characters, and the line around each placeholder as the vendor got it.": "原文と元の値はメモリにだけあり、magpie はその後再起動しています。残っているのは各値の種類・長さ・先頭の数文字と、ベンダーに届いたプレースホルダー前後の行です。",
"This request's text and the values masked in it were kept in memory only, never on disk, and magpie has restarted since. The record keeps each value's kind, length and first characters.": "このリクエストの原文と元の値はメモリにだけあり、ディスクには書かれません。magpie はその後再起動しています。記録に残っているのは各値の種類・長さ・先頭の数文字です。",
"Show only the changes": "変更だけ表示",
"Show all of it": "すべて表示",
"1 part unchanged": "変更なし 1 件",
@@ -310,6 +313,7 @@ magpie.strings({
"Side by side": "Nebeneinander",
"This request's whole text is no longer in memory: magpie keeps it for the newest requests only. The lines around each value are still here.": "Der ganze Text dieser Anfrage ist nicht mehr im Speicher: magpie behält ihn nur für die neuesten Anfragen. Die Zeilen um jeden Wert sind noch da.",
"What was written is kept in memory only, and magpie has restarted since. Still here: each value's kind, length and first characters, and the line around each placeholder as the vendor got it.": "Was geschrieben war, liegt nur im Speicher, und magpie wurde seitdem neu gestartet. Noch da: Art, Länge und erste Zeichen jedes Werts und die Zeile um jeden Platzhalter, wie der Anbieter sie bekam.",
"This request's text and the values masked in it were kept in memory only, never on disk, and magpie has restarted since. The record keeps each value's kind, length and first characters.": "Der Text dieser Anfrage und die maskierten Werte lagen nur im Speicher, nie auf der Festplatte, und magpie wurde seitdem neu gestartet. Der Eintrag behält von jedem Wert Art, Länge und erste Zeichen.",
"Show only the changes": "Nur die Änderungen zeigen",
"Show all of it": "Alles zeigen",
"1 part unchanged": "1 Teil unverändert",
+9 -5
View File
@@ -818,13 +818,17 @@ function maskContent(r, o, info) {
fold.fold.push(l);
}
} else {
// only the lines around each value are left: the request's whole text
// was in memory, and is no longer
if (!r.blocked) sec.append(el("p", "msk-gone", o.vals.size
// only the lines around each value are left, while memory has the
// record: the request's whole text was in memory, and is no longer
items = maskSnipTexts(r).map((text) => ({ leaf: { path: "", role: "", text } }));
if (items.length && !r.blocked) sec.append(el("p", "msk-gone", o.vals.size
? t("This request's whole text is no longer in memory: magpie keeps it for the newest requests only. The lines around each value are still here.")
: t("What was written is kept in memory only, and magpie has restarted since. Still here: each value's kind, length and first characters, and the line around each placeholder as the vendor got it.")));
items = maskSnipTexts(r).map((text) => ({ leaf: { path: "", role: "", text } }));
if (!items.length) sec.append(el("div", "msk-none", t("The text around them was kept in memory only, and magpie has restarted since")));
// after a restart nothing of the text is left, by design: the record on
// disk never holds it (maskrec), so no folder or volume brings it back
// (brianeee2 on X, in Docker). A request held back sent nothing, and
// its card says so.
else if (!items.length && !r.blocked) sec.append(el("p", "msk-gone", t("This request's text and the values masked in it were kept in memory only, never on disk, and magpie has restarted since. The record keeps each value's kind, length and first characters.")));
}
const list = el("div", "msk-msgs" + (view === "both" ? " both" : ""));
if (view === "both") {
+34 -1
View File
@@ -158,7 +158,7 @@ const shot = (page, name) => process.env.MASK_SHOTS && page.screenshot({ path: p
// English that a translated page must not show
const english = ["Kept from vendors", "By request", "By value", "masked these on this computer", "Different values", "values masked", "Held back",
"Request content", "How it was masked", "What happened", "Side by side", "Only the parts masking changed", "parts unchanged", "Found by", "In the answer",
"This request was not sent", "Mask it instead", "See the rules", "Nothing to put back", "no longer in memory", "Masked most", "Local model"];
"This request was not sent", "Mask it instead", "See the rules", "Nothing to put back", "no longer in memory", "never on disk", "Masked most", "Local model"];
const untranslated = async (page, lang) => {
if (lang === "en") return;
const said = await page.locator("#view-masking").innerText();
@@ -466,6 +466,39 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
}
}
// After a restart a record has no text left at all: the request's text,
// the lines around its values and the values are memory's alone, never on
// disk (maskrec). The page says that once, and doesn't say the lines are
// still there (brianeee2 on X, in Docker, took it for a missing volume).
const restarted = {
records: [{ key: K1, t: ago(300e3), route: "chat", what: "chat", agent: "claude", provider: "anthropic", model: "claude-opus-4-1", n: 1,
values: [{ p: NAME, k: "PERSON", b: "model", h: "", l: 3, n: 1 }] }],
sent: {},
};
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
test(`${engine} ${lang}: a request from before a restart says its text was in memory only, once`, async (t) => {
const { browser, page, errors, asked } = await open(engine, lang, 640, summary, "", restarted);
t.after(() => browser.close());
await page.locator("#maskList .msk-row").first().click();
const one = page.locator("#maskOne");
await until(() => asked.includes("sent " + K1));
await one.locator(".msk-gone").waitFor();
assert.equal(await one.locator(".msk-gone").count(), 1, "one message");
assert.equal(await one.locator(".msk-none").count(), 0, "no second message");
assert.equal(await one.locator(".msk-msg").count(), 0);
const said = await one.locator(".msk-gone").innerText();
if (lang === "en") {
assert.match(said, /never on disk/);
assert.doesNotMatch(said, /line around each placeholder/, "no line is left to show");
}
await untranslated(page, lang);
assert.deepEqual(await wide(page), { page: false, over: [] });
assert.deepEqual(errors, []);
});
}
}
// Clear records… deletes what masking kept, after a confirm (maxyou2090:
// strict masking had kept many records): Cancel sends nothing, Clear posts
// once and the page reads again to nothing; a failed clear says why and