The owner opened the newest masked request and got "This request's
record is gone: records are kept for 30 days", and a request opened from
the list said its whole text was no longer in memory. A record's key is
its time in nanoseconds (~1.79e18), past 2^53, so JSON.parse rounded it
to 256ns: /api/masking/record?key= and /api/masking/sent?key= looked up
a key no record has. A list row worked only because it carried its
record. Every way in by key failed: the Gateway page's and tray panel's
masked badge, ?key= in the address, and each request's sent text; the
list's before= paging was off by the rounding too.
gateway.Masked's key and /api/masking/record(s)' key now go as JSON
strings (",string"); records on disk keep their number. The page keeps
the key a string (no unary +), and a refresh compares keys as BigInt.
Tests: TestMaskedRequestIsRecorded and TestMaskingRecordsAPI check the
key is a string, and masking-records' fake API uses 19-digit string keys
in place of 1001-1005, which no rounding touched.
Broken by hand: with the Go change out, both Go tests fail ("key not a
string"); with the page.js/client.js change out, "chromium: a masked call
on the Gateway page, and a key in the address, open its request" fails.
Run: go test ./internal/gui (twice ok; a first run under load ~180 went
red with its log cut by tail, so the test is unnamed; two reruns with
the whole log were ok), ./internal/gateway ok, ./internal/maskrec ok;
GOOS=linux/windows go vet ./internal/gateway ok; GUI masking-records,
routing-bodies, i18n-keys: 96 of 96 ok, both engines.
Not tried: the real app with a real masked request.
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
// 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, 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-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)); },
|
||
});
|
||
});
|