Files
magpie/internal/gui/assets/plugins/redact/client.js
T
yetone 76218200af gui: a demo's made-up account is never blurred by Hide accounts (data-no-pii)
outloudvi on Discord (#feedback, 1564923315095732276): with Hide accounts
on, the masking demo's letter on Insights › Masking had its account
(yetone@example.com) blurred and its password (hunter2-prod) not. The
blur is hideAccounts, which masks every address in the window's body.
It isn't the demo's own masking. The demo's values are made up, and
showing them is the point of it.

An element marked data-no-pii, and everything inside it, is now skipped
by the text walker and the tooltip pass. The demo's section carries the
marker. The class: any illustration with made-up accounts takes the same
attribute. A search of the GUI assets found no other drawn one. The only
other fake address is ops@company.com, in input placeholders, which the
blur never touches. Text added later in a marked element stays unmasked
too: the observer's mask(e) passes through the same checks.

New test masking-demo-unblurred: Hide accounts on, an address elsewhere
on the page still masked, the demo played (reduced motion on and off),
its account and password slots both readable, and no .pii in #maskDemo.
A generic [data-no-pii] element with a title and text changed after
masking stays unmasked. It runs en and zh, in both engines.

Run on mote:
- masking-demo-unblurred and masking-demo at this tree: green.
- go test -tags nogui -run Budget ./internal/gui: ok (no budget raised).
- The 124-file GUI run in the commit before, at this tree: none of its
  reds in masking files (masking-records zh-TW was green when rerun).
Broken by hand:
- Marker removed from client.js: red, account slot "ilottn@aamital.cmd"
  in webkit (the reporter's blur).
- Walker and title checks removed from app.js: red.
Not tried: Linux and Windows.
2026-10-28 17:58:50 +08:00

38 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Insights › Masking: what masking kept from vendors, request by request.
//
// A page the redact plugin adds to the window (kernel.js), its words in
// i18n.js beside this file. This file registers the page and its markup,
// before app.js; page.js, after app.js, is the page's code. The card on
// top says how much was masked over 7 or 30 days and where it went, the
// list under it each request (or each value) masking changed (between
// them, folded, demo.js's 小鹊 shows how masking works), and a
// request opened says what it carried, what the vendor got instead, and
// how each value was found and put back. The hooks are what the shell
// asks of it: open, refresh (the window came back), reload (Refresh in
// the sidebar), leave, and focus (a masked call's badge opens its request).
magpie.plugin("redact", (ctx) => {
ctx.slots.add("page", {
key: "masking",
title: "Masking",
html: `
<section class="msk-card" id="maskCard"></section>
<section class="msk-demo" id="maskDemo" data-no-pii>
<button type="button" class="md-row" id="mdRow" aria-expanded="false" aria-controls="mdBody">
<span class="md-thumb" aria-hidden="true"></span>
<span class="md-words"><span class="md-name" data-t>How masking works</span><span class="md-sub" data-t>Little Magpie walks one request through: passwords become placeholders before it leaves, and come back on your computer with the answer</span></span>
<span class="md-len">0:27</span>
<svg class="md-chev" viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="m6 3.5 4.5 4.5L6 12.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
<div class="md-body" id="mdBody" hidden></div>
</section>
<section class="msk-list" id="maskList"></section>
<section class="msk-one" id="maskOne" hidden></section>
`,
open() { return maskPageOpen(); },
refresh(again) { return maskPageLoad(again); },
reload() { return maskPageLoad(true); },
leave() { maskTipOff(); },
focus(key) { maskOneOpen(String(key)); },
});
});