What masking did moves out of Settings › Privacy into a page of its own under Insights (plugins/redact: client.js, page.js, redact.css, i18n.js). Privacy keeps how it is found and what to mask, with a "What was masked" row that opens the page. - The top card is Privacy's card, made shorter: the flow animation (agents → this computer → providers) with magpie's bird on the centre line and "magpie masks it on this computer" under it, so a screenshot says who masked it; the count and a 7-day bar. Nothing the list repeats. - The list: one row per masked request, narrowed by kind, by who found it (rules or the local model), by agent or provider, or to held-back requests; or by value, each with how often it was put back. - A request: the message as it went to the vendor beside the original, each mask marked, unchanged parts folded; picking a value lights every place it was masked; a held-back request offers "Mask it instead". - Gateway's masked badge and ?view=masking&key=N (trace.go's mainView) open one request. - Classes are msk-: library.css owns mk- (a first cut stacked the flow). - Budgets lowered to the core's size after the move. - Not shown: rule names and the local model's confidence; the records don't keep them. Run onf5b1d36ff(rebased since onto344d11484, which only raised the budgets and changed a dialog's centring and two unrelated files): - masking-records.test.cjs: 32/32, Chromium and WebKit, 5 languages, 1100px and 640px (card, list, filters, detail, put back, held back, Gateway badge, deep link, Settings row, no scroll on click), with key-import and i18n-keys: 48/48. - go test ./internal/maskrec ./internal/redact ./plugins/redact ./internal/gui ./internal/provider: ok. TestCoreScriptBudget and TestMainView ok; gofmt -l clean. - Before the rebase, on628e18987: go test ./... -timeout 45m, every package ok; GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... clean. - Budgets lowered to the sizes at the pushed head (app.js 1,317,486, core 1,524,789), ~26KB under whatf35c721c4raised them to after ce5b23cdb's add-key spinner put the core over. Broken by hand: the bird's href (#bird → #nobird) turns masking-records red. Not run at this head when pushed: internal/gateway, which main's newer commits touched (run right after; the result goes on the release). Not tried: the whole GUI suite (hours long, and another session's runs held the machine), the real Linux (WebKitGTK) and Windows apps.
47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
// Package redact is Settings → Privacy's masking: secrets, personal data
|
||
// and the user's own words go to a vendor as placeholders, and come back
|
||
// as they were. While the settings ask for any of it, it stays on.
|
||
//
|
||
// It is the masker of the gateway's middleware point (P3 of
|
||
// docs/subsystems/plugin-runtime.md): Apply serves masking.Masker, and the point
|
||
// fails closed: a request the settings say to mask is not sent while no
|
||
// masker serves it. The logs' and archives' scrubbing (redact.Scrub) is
|
||
// the core's, whatever the settings say.
|
||
package redact
|
||
|
||
import (
|
||
"github.com/yetone/magpie/internal/gwmw"
|
||
"github.com/yetone/magpie/internal/masking"
|
||
"github.com/yetone/magpie/internal/pluginrt"
|
||
"github.com/yetone/magpie/internal/settings"
|
||
)
|
||
|
||
func init() {
|
||
pluginrt.Register(pluginrt.Manifest{
|
||
ID: "redact", API: "^1", Requires: []string{"settings", "gateway"}, Essential: true,
|
||
Name: "Privacy masking", Sub: "Secrets, personal data and your own words go to vendors as placeholders, and come back as they were",
|
||
One: "Masking is on", Many: "Masking is on",
|
||
InUse: InUse,
|
||
// Insights › Masking: what masking did, request by request
|
||
Parts: []pluginrt.Part{{Slot: "nav.page", Key: "masking"}},
|
||
Client: []string{"i18n.js", "redact.css", "client.js", "page.js"},
|
||
Apply: func(c *pluginrt.Ctx) error {
|
||
c.OnDispose(gwmw.Mask(masking.Masker{}))
|
||
return nil
|
||
},
|
||
})
|
||
}
|
||
|
||
// InUse is 1 while the settings ask for anything to be masked; settings
|
||
// that can't be read are not known, so it stays on.
|
||
func InUse() (int, error) {
|
||
st, err := settings.LoadChecked()
|
||
if err != nil {
|
||
return 0, err
|
||
}
|
||
if masking.Wanted(st) {
|
||
return 1, nil
|
||
}
|
||
return 0, nil
|
||
}
|